Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldTextFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldTextFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldTextFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Text;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldTextFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.STRING, DataTypes.SUBTYPE_TEXT);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldText(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for string fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldTextFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldText.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldText.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldText.java	(revision 1235)
@@ -0,0 +1,112 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Text;
+
+import javax.swing.JScrollPane;
+import javax.swing.JViewport;
+
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextArea;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldText extends AbstractJDynFormField  implements JDynFormField {
+	
+	private final int CHAR_ROW_LIMIT = 3;
+	private String assignedValue  = null;
+	
+	public JDynFormFieldText(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		if(this.getParameterValue()!=null)
+			this.assignedValue = this.getParameterValue().toString();
+	}
+
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	private JCustomTextArea getJTextArea() {
+		JViewport port = ((JScrollPane)this.contents).getViewport();
+		return (JCustomTextArea) port.getView();
+	}
+	
+	public void initComponent() {
+		this.contents = new JScrollPane(new JCustomTextArea(this.getLabel()));
+		this.getJTextArea().setLineWrap(true);
+		this.getJTextArea().setWrapStyleWord(true);
+                
+                this.getJTextArea().setRows(getTagValueAsInt("dynform.rows",CHAR_ROW_LIMIT));
+		if(this.getDefinition().isReadOnly()) {
+			this.getJTextArea().setEditable(false);
+		}
+		this.setValue(this.assignedValue);
+	}
+	
+//	public void setReadOnly(boolean readonly) {
+//		this.getJTextArea().setEditable(!readonly);
+//	}
+//	
+	public void setValue(Object value) {
+		String s = null;
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				s = "";
+			} else {
+				s = value.toString();
+			}
+		} else {
+			s = value.toString();
+		}
+		this.getJTextArea().setText(s);
+	}
+	
+	public Object getValue() {
+		Object value = null;
+		String s = this.getJTextArea().getText();
+		if( s.trim().length()==0 ) {
+			value = (String) this.getDefinition().getDefaultValue();
+		} else {
+			value = s;
+		}
+		this.setValue(value);
+		return value;
+	}
+	
+	public boolean hasValidValue() {
+		return true;
+	}
+
+    public void clear() {
+        Object value = this.getDefinition().getDefaultValue();
+        if (value != null) {
+            value = value.toString();
+        } else {
+            value = "";
+        }
+        this.getJTextArea().setText((String) value);
+    }	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Text/JDynFormFieldText.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersion.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersion.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersion.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Version;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldVersion extends AbstractJDynFormFieldWithValueList {
+	
+	
+	public JDynFormFieldVersion(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersionFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersionFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersionFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Version;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldVersionFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.VERSION, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldVersion(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for version fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Version/JDynFormFieldVersionFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldIntegerFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldIntegerFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldIntegerFactory.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Integer;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldIntegerFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.INT, null);
+		}
+		return this.name;
+	}
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldInteger(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for interger fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldIntegerFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldInteger.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldInteger.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldInteger.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Integer;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldInteger extends AbstractJDynFormFieldWithValueList {
+	
+	public JDynFormFieldInteger(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = Integer.valueOf(s);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid integer.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null ) {
+				value = null;
+			} else {
+				value = x.getValue();
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+	
+	public String getJTextFieldRegex(){
+		return "[0-9]";
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Integer/JDynFormFieldInteger.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTime.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTime.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTime.java	(revision 1235)
@@ -0,0 +1,152 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Time;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.Date;
+
+import javax.swing.JCheckBox;
+import javax.swing.JSpinner;
+
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomSpinner;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldTime extends AbstractJDynFormField implements JDynFormField, FocusListener {
+	
+	protected Object assignedValue  = null;
+	private JCustomSpinner timeSpinner;
+	
+	public JDynFormFieldTime(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = this.getParameterValue();
+	}
+
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	protected JSpinner getJSpinner() {
+		return (JSpinner) this.contents;
+	}
+			
+	public void initComponent() {
+		DynObjectValueItem[] availableValues = this.getDefinition().getAvailableValues();
+		if( availableValues==null ) {
+			timeSpinner = new JCustomSpinner(this.getLabel());
+			JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss");
+			timeSpinner.setEditor(timeEditor);
+			//timeSpinner.setValue(new Date());
+			this.contents = timeSpinner;
+			this.contents.addFocusListener(this);
+			if( this.getDefinition().isReadOnly() ) {
+				this.getJSpinner().setEnabled(false);
+			}
+		}
+		this.setValue(this.assignedValue);
+	}
+	
+	public void setValue(Object value) {
+		Date s = null;
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				value = new Date();
+			}
+		} else {
+			try {
+				this.getDefinition().validate(value);
+				this.problemIndicator().clear();
+			} catch (DynFieldValidateException e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		if( this.contents instanceof JSpinner) {
+			this.getJSpinner().setValue(value);
+		} 
+		this.assignedValue = value;
+	}
+	
+	/* 
+	 * Métodos específicos de cada tipo de datos
+	 */
+	
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JCheckBox ) {
+			value = getJSpinner().getValue();
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+	
+	@SuppressWarnings("unused")
+	public boolean hasValidValue() {
+		try {
+			Object value = this.getValue();
+		} catch(Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		if( this.hasValidValue() ) {
+			this.problemIndicator().clear();
+		} else {
+			try {
+				Object value = this.getValue();
+			} catch(Exception e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		fireFieldExitEvent();
+	}
+
+        public void clear() {
+            Object value = this.getDefinition().getDefaultValue();
+            if( value != null ) {
+                value = value.toString();
+            }
+            this.timeSpinner.setValue(value);
+        }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTime.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTimeFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTimeFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTimeFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Time;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldTimeFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.TIME, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldTime(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for time fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Time/JDynFormFieldTimeFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURIFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURIFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURIFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.URI;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldURIFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.URI, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldURI(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for URI fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURIFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURI.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURI.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURI.java	(revision 1235)
@@ -0,0 +1,100 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.URI;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.swing.JFileChooser;
+
+import org.gvsig.tools.dynform.services.dynformfield.File.JDynFormFieldFile;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldURI extends JDynFormFieldFile {
+	
+	protected URI assignedValue = null;
+	protected URI currentValue = null;
+	
+	public JDynFormFieldURI(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = (URI) this.getParameterValue();
+	}
+	
+	public Object getValue() {
+		URI value = null;
+		String s = "";
+		s = this.jtext.getText();
+		if( s.trim().length()==0 ) {
+			Object x = this.getDefinition().getDefaultValue();
+			if( x == null ) {
+				value = null;
+			} else {
+					try {
+						value = new URI(x.toString());
+					} catch (URISyntaxException e) {
+						logger.info("Error. URI Syntax: "+x.toString());
+						value = null;
+					}
+			}
+		} else {
+				try {
+					value = new URI(s);
+				} catch (URISyntaxException e) {
+					logger.info("Error. URI Syntax: "+s);
+					value = null;
+				}
+		}
+		return value;
+	}
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			this.jtext.setText("");
+			this.assignedValue = null;
+		} else {
+			if( !(value instanceof URI) ) {
+				logger.info("setValue invoked with non URI value ("+value.toString()+").");
+				return;
+			}
+			this.jtext.setText(((URI)value).getPath());
+			try {
+				this.assignedValue = new URI(((URI)value).getPath());
+			} catch (URISyntaxException e) {
+				logger.info("Error in URI creation.");
+				this.assignedValue = null;
+			}
+		}
+		
+		this.currentValue = this.assignedValue;
+		
+	}
+	
+	public File[] showOpenFileDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_AND_DIRECTORIES, false, initialPath, null, false);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URI/JDynFormFieldURI.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLongFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLongFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLongFactory.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Long;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldLongFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.LONG, null);
+		}
+		return this.name;
+	}
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldLong(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for long fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLongFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLong.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLong.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLong.java	(revision 1235)
@@ -0,0 +1,72 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Long;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldLong extends AbstractJDynFormFieldWithValueList {
+	
+	public JDynFormFieldLong(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = Long.valueOf(s);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid long.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null ) {
+				value = null;
+			} else {
+				value = x.getValue();
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Long/JDynFormFieldLong.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURL.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURL.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURL.java	(revision 1235)
@@ -0,0 +1,99 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.URL;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.JFileChooser;
+
+import org.gvsig.tools.dynform.services.dynformfield.File.JDynFormFieldFile;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldURL extends JDynFormFieldFile {
+	
+	protected URL assignedValue = null;
+	protected URL currentValue = null;
+	
+	public JDynFormFieldURL(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = (URL) this.getParameterValue();
+	}
+	
+	public Object getValue() {
+		URL value = null;
+		String s = "";
+		s = this.jtext.getText();
+		if( s.trim().length()==0 ) {
+			Object x = this.getDefinition().getDefaultValue();
+			if( x == null ) {
+				value = null;
+			} else {
+				try {
+					value = new URL(x.toString());
+				} catch (MalformedURLException e) {
+					logger.info("Error. URL Syntax: "+x.toString());
+					value = null;
+				}
+			}
+		} else {
+				try {
+					value = new URL(s);
+				} catch (MalformedURLException e) {
+					logger.info("Error. URL Syntax: "+s.toString());
+					value = null;
+				}
+		}
+		return value;
+	}
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			this.jtext.setText("");
+			this.assignedValue = null;
+		} else {
+			if( !(value instanceof URL) ) {
+				logger.info("setValue invoked with non URL value ("+value.toString()+").");
+				return;
+			}
+			this.jtext.setText(((URL)value).getPath());
+			try {
+				this.assignedValue = new URL(((URL)value).getPath());
+			} catch (MalformedURLException e) {
+				logger.info("Error in URL creation.");
+				this.assignedValue = null;
+			}
+		}
+		
+		this.currentValue = this.assignedValue;
+	}
+	
+	public File[] showOpenFileDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_AND_DIRECTORIES, false, initialPath, null, false);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURL.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURLFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURLFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURLFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.URL;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldURLFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.URL, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldURL(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for URL fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/URL/JDynFormFieldURLFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByteFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByteFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByteFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Byte;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldByteFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.BYTE, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldByte(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for byte fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByteFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByte.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByte.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByte.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Byte;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldByte extends AbstractJDynFormFieldWithValueList {
+	
+	
+	public JDynFormFieldByte(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = Byte.valueOf(s);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid char.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null) {
+				value = null;
+			} else {
+				if(x.getValue().toString().length()>0)
+					value = Byte.valueOf(x.getValue().toString());
+				else 
+					value = null;
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Byte/JDynFormFieldByte.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestampFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestampFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestampFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Timestamp;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldTimestampFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.TIMESTAMP, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldTimestamp(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for timestamp fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestampFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestamp.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestamp.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestamp.java	(revision 1235)
@@ -0,0 +1,212 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Timestamp;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.Date;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JSpinner;
+
+import org.freixas.jcalendar.DateEvent;
+import org.freixas.jcalendar.DateListener;
+import org.freixas.jcalendar.JCalendar;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomSpinner;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldTimestamp extends AbstractJDynFormField implements JDynFormField, FocusListener {
+	
+	protected Object assignedValue  = null;
+	private JCalendar jcalendar = null;
+	private JCustomSpinner timeSpinner = null;
+	private JButton button = null;
+	private boolean readonly = false;
+	
+	public JDynFormFieldTimestamp(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = this.getParameterValue();
+	}
+
+	public void setReadOnly(boolean readonly) {
+		this.readonly  = readonly;
+		if( this.contents != null ) {
+			if( readonly ) {
+				this.timeSpinner.setEditable(false);
+				this.button.setEnabled(false);
+			} else {
+				this.timeSpinner.setEditable(true);
+				this.button.setEnabled(true);
+			}
+		}
+	}
+	
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	protected JSpinner getJSpinner() {
+		return (JSpinner) this.timeSpinner;
+	}
+	
+	protected JButton getJButton() {
+		return (JButton) this.button;
+	}
+	
+	protected JCalendar getJCalendar() {
+		if(this.jcalendar==null){
+			this.jcalendar = new JCalendar();
+			this.jcalendar.addDateListener(new DateListener() {
+				public void dateChanged(DateEvent arg0) {
+					Date currentDate = (Date) getJSpinner().getValue();
+					Date newDate = getJCalendar().getDate();
+					
+					newDate.setHours(currentDate.getHours());
+					newDate.setMinutes(currentDate.getMinutes());
+					newDate.setSeconds(currentDate.getSeconds());
+					
+					getJSpinner().setValue(newDate);
+					
+				}
+			});
+		}
+		return (JCalendar) this.jcalendar;
+	}
+	
+			
+	public void initComponent() {
+		DynObjectValueItem[] availableValues = this.getDefinition().getAvailableValues();
+		if( availableValues==null ) {
+			this.contents = new JPanel();
+			this.contents.setLayout(new BorderLayout());
+			
+			timeSpinner = new JCustomSpinner(this.getLabel());
+			JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "dd-MM-yyyy  HH:mm:ss");
+			timeSpinner.setEditor(timeEditor);
+			button  = new JButton("...");
+			button.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent event) {
+					JPopupMenu menu = new JPopupMenu();
+					menu.add(getJCalendar());
+					
+					JComponent thisComp = (JComponent)event.getSource();
+					menu.show(thisComp, 0, thisComp.getY()+22);
+				}
+			});
+			
+
+			
+			this.contents.addFocusListener(this);
+			if(this.getDefinition().isReadOnly()) {
+				this.getJSpinner().setEnabled(false);
+				this.getJButton().setEnabled(false);
+			}
+			
+			this.contents.add(timeSpinner,BorderLayout.CENTER);
+			this.contents.add(button,BorderLayout.LINE_END);
+		}
+		this.setValue(this.assignedValue);
+	}
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				value = new Date();
+			}
+		} else {
+			try {
+				this.getDefinition().validate(value);
+				this.problemIndicator().clear();
+			} catch (DynFieldValidateException e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		if( this.contents instanceof JSpinner) {
+			this.getJSpinner().setValue(value);
+		} 
+		this.assignedValue = value;
+	}
+	
+	/* 
+	 * Métodos específicos de cada tipo de datos
+	 */
+	
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JCheckBox ) {
+			value = getJSpinner().getValue();
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+	
+	@SuppressWarnings("unused")
+	public boolean hasValidValue() {
+		try {
+			Object value = this.getValue();
+		} catch(Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		if( this.hasValidValue() ) {
+			this.problemIndicator().clear();
+		} else {
+			try {
+				Object value = this.getValue();
+			} catch(Exception e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		fireFieldExitEvent();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Timestamp/JDynFormFieldTimestamp.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloat.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloat.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloat.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Float;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFloat extends AbstractJDynFormFieldWithValueList {
+	
+	public JDynFormFieldFloat(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = Float.valueOf(s);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid float.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null ) {
+				value = null;
+			} else {
+				value = x.getValue();
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+	public String getJTextFieldRegex(){
+		return "[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$";
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloat.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloatFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloatFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloatFactory.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Float;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFloatFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.FLOAT, null);
+		}
+		return this.name;
+	}
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldFloat(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for float fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Float/JDynFormFieldFloatFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldString.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldString.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldString.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.String;
+
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldString extends AbstractJDynFormFieldWithValueList {
+	
+	
+	public JDynFormFieldString(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+	
+	protected String getDefaultValue(){
+		return "";
+	}
+
+	public Object getValue() {
+		Object value = null;
+		String s = this.getValueFromJComponent();
+		if( StringUtils.isBlank(s) ) {
+			Object x = this.getDefinition().getDefaultValue();
+			if( x != null ) {
+                            value = x.toString();
+			}
+		} else {
+			value = s;
+		}
+		return value;
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldString.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldStringFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldStringFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldStringFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.String;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldStringFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.STRING, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldString(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for string fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/String/JDynFormFieldStringFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDoubleFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDoubleFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDoubleFactory.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Double;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDoubleFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.DOUBLE, null);
+		}
+		return this.name;
+	}
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldDouble(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for double fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDoubleFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDouble.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDouble.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDouble.java	(revision 1235)
@@ -0,0 +1,72 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Double;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDouble extends AbstractJDynFormFieldWithValueList {
+	
+	public JDynFormFieldDouble(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = Double.valueOf(s);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid double.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null ) {
+				value = null;
+			} else {
+				value = x.getValue();
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Double/JDynFormFieldDouble.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolder.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolder.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolder.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Folder;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+import org.gvsig.tools.dynform.services.dynformfield.File.JDynFormFieldFile;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFolder extends JDynFormFieldFile {
+	
+	public JDynFormFieldFolder(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			this.jtext.setText("");
+		} else {
+			if( !(value instanceof File) ) {
+				logger.info("setValue invoked with non Folder value ("+value.toString()+").");
+				return;
+			}
+			this.jtext.setText(((File)value).getPath());
+		}
+		this.assignedValue = (File) value;
+		this.currentValue = this.assignedValue;
+	}
+
+	public File[] showOpenFileDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY, false, initialPath, null, false);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolderFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Folder;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFolderFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.FOLDER, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldFolder(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for folder fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Folder/JDynFormFieldFolderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldCharFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldCharFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldCharFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Char;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldCharFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.CHAR, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldChar(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for char fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldCharFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldChar.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldChar.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldChar.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Char;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldWithValueList;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldChar extends AbstractJDynFormFieldWithValueList {
+	
+	
+	public JDynFormFieldChar(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+	}
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JTextField ) {
+			String s = getJTextField().getText();
+			if( s.trim().length()==0 ) {
+				value = this.getDefinition().getDefaultValue();
+			} else {
+				try {
+					value = s.charAt(0);
+				} catch(Exception ex) {
+					throw new IllegalFieldValue(this, "Is not a valid char.");
+				}
+			}
+		} else {
+			DynObjectValueItem x = (DynObjectValueItem) ((JComboBox)this.contents).getSelectedItem();
+			if( x==null) {
+				value = null;
+			} else {
+				if(x.getValue().toString().length()>0)
+					value = x.getValue().toString().charAt(0);
+				else 
+					value = null;
+			}
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Char/JDynFormFieldChar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDateFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDateFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDateFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Date;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDateFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.DATE, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldDate(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for date fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDateFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDate.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDate.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDate.java	(revision 1235)
@@ -0,0 +1,223 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Date;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JSpinner;
+
+import org.freixas.jcalendar.DateEvent;
+import org.freixas.jcalendar.DateListener;
+import org.freixas.jcalendar.JCalendar;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomSpinner;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDate extends AbstractJDynFormField implements JDynFormField, FocusListener {
+
+	protected Object assignedValue  = null;
+	private JCalendar jcalendar = null;
+	private JCustomSpinner timeSpinner = null;
+	private JButton button = null;
+	private boolean readonly;
+	private static final String DATE_PANEL_NAME = "Date panel";
+
+	public JDynFormFieldDate(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = this.getParameterValue();
+	}
+
+	public void setReadOnly(boolean readonly) {
+		this.readonly = readonly;
+		if( this.contents != null ) {
+			if( this.readonly ) {
+				this.timeSpinner.setEditable(false);
+				this.button.setEnabled(false);
+			} else {
+				this.timeSpinner.setEditable(true);
+				this.button.setEnabled(true);
+			}
+		}
+	}
+
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	protected JSpinner getJSpinner() {
+		return (JSpinner) this.timeSpinner;
+	}
+
+	protected JButton getJButton() {
+		return (JButton) this.button;
+	}
+
+	protected JCalendar getJCalendar() {
+		if(this.jcalendar==null){
+			this.jcalendar = new JCalendar();
+			this.jcalendar.addDateListener(new DateListener() {
+				public void dateChanged(DateEvent arg0) {
+					getJSpinner().setValue(getJCalendar().getDate());
+				}
+			});
+		}
+		return (JCalendar) this.jcalendar;
+	}
+
+
+	public void initComponent() {
+		DynObjectValueItem[] availableValues = this.getDefinition().getAvailableValues();
+		if( availableValues==null ) {
+			this.contents = new JPanel();
+			this.contents.setName(DATE_PANEL_NAME);
+			this.contents.setLayout(new BorderLayout());
+
+			//timeSpinner = new JSpinner( new SpinnerDateModel() );
+			timeSpinner = new JCustomSpinner(this.getLabel());
+			JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "dd-MM-yyyy");
+			timeSpinner.setEditor(timeEditor);
+			//timeEditor.dismiss(timeSpinner);
+			button  = new JButton("...");
+			button.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent event) {
+					JPopupMenu menu = new JPopupMenu();
+					menu.add(getJCalendar());
+
+					JComponent thisComp = (JComponent)event.getSource();
+					menu.show(thisComp, 0, thisComp.getY()+22);
+				}
+			});
+
+
+
+			this.contents.addFocusListener(this);
+			if(this.getDefinition().isReadOnly()) {
+				this.getJSpinner().setEnabled(false);
+				this.getJButton().setEnabled(false);
+			}
+
+			this.contents.add(timeSpinner,BorderLayout.CENTER);
+			this.contents.add(button,BorderLayout.LINE_END);
+		}
+		this.setValue(this.assignedValue);
+	}
+
+	public void setValue(Object value) {
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				value = null;
+			}
+		} else {
+			try {
+				this.getDefinition().validate(value);
+				this.problemIndicator().clear();
+			} catch (DynFieldValidateException e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		if( this.contents instanceof JPanel && this.contents.getName().equalsIgnoreCase(DATE_PANEL_NAME) ) {
+			this.getJSpinner().setValue(value);
+		}
+		this.assignedValue = value;
+	}
+
+	/*
+	 * Métodos específicos de cada tipo de datos
+	 */
+
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JPanel && this.contents.getName().equalsIgnoreCase(DATE_PANEL_NAME) ) {
+			value = getJSpinner().getValue();
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+
+	@SuppressWarnings("unused")
+	public boolean hasValidValue() {
+		try {
+			Object value = this.getValue();
+		} catch(Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		if( this.hasValidValue() ) {
+			this.problemIndicator().clear();
+		} else {
+			try {
+				Object value = this.getValue();
+			} catch(Exception e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		fireFieldExitEvent();
+	}
+
+        public void clear() {
+            Object value = this.getDefinition().getDefaultValue();
+            if( value != null ) {
+                if (!(value instanceof Date)){
+                    try {
+                        value = DateFormat.getInstance().parse(value.toString());
+                    } catch (ParseException e) {
+                        this.problemIndicator().set(e.getLocalizedMessage());
+                    }
+                }
+            }
+            this.timeSpinner.setValue(value);
+        }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Date/JDynFormFieldDate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectListFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectListFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectListFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.DynObjectList;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDynObjectListFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.LIST, null,"DynObject");
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldDynObjectList(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for DynObjectList fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectListFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectList.java	(revision 1235)
@@ -0,0 +1,232 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.DynObjectList;
+
+import java.awt.BorderLayout;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.List;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.JDynFormSet;
+import org.gvsig.tools.dynform.JDynFormSet.JDynFormSetListener;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDynObjectList extends AbstractJDynFormField implements JDynFormField, JDynFormListener, JDynFormSetListener, FocusListener {
+	
+	protected List assignedValue  = null;
+	protected List currentValue = null;
+	protected JDynFormSet jdynFormSet = null;
+	protected boolean readonly = false;
+
+	public JDynFormFieldDynObjectList(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = (List) this.getParameterValue();
+	}
+
+	public void setReadOnly(boolean readonly) {
+		super.setReadOnly(readonly);
+		if( this.contents != null ) {
+			this.jdynFormSet.setReadOnly(readonly);
+		}
+	}
+	
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+	
+	public void initComponent() {
+		this.contents = new JPanel();
+		this.contents.setLayout(new BorderLayout());
+		try {
+			DynFormFieldDefinition def = this.getDefinition();
+			DynField_v2 fielddef = (DynField_v2)def;
+			DynStruct struct = fielddef.getDynClassOfItems();
+                        String viewMode = getTagValueAsString("ViewMode", "dynform.viewmode", "Subform");
+                        try{
+                                this.jdynFormSet = DynFormLocator.getDynFormManager().createJDynFormSet(viewMode,struct);
+                        } catch(Exception e){
+                                logger.warn("Error en la creaci�n del DynFormSet '"+ viewMode +"'" , e);
+                                this.jdynFormSet = DynFormLocator.getDynFormManager().createJDynFormSet(struct);
+                        }
+
+                        int height = getTagValueAsInt("dynform.height", -1);
+                        if( height>0 ) {
+                            this.jdynFormSet.setFormSize(50,height); 
+                        }
+
+                        this.jdynFormSet.addListener(this);
+                        this.jdynFormSet.setLayoutMode(getTagValueAsInt("layoutMode", "dynform.layoutmode",JDynFormSet.USE_PLAIN));
+                        this.jdynFormSet.setAllowNew(getTagValueAsBoolean("allowNew", "dynform.action.new", false));
+                        this.jdynFormSet.setAllowUpdate(getTagValueAsBoolean("allowUpdate", "dynform.action.update", false));
+                        this.jdynFormSet.setAllowDelete(getTagValueAsBoolean("allowDelete", "dynform.action.delete", false));
+                        this.jdynFormSet.setAllowSearch(getTagValueAsBoolean("allowSearch", "dynform.action.search", false));
+			this.jdynFormSet.setAllowClose(false);
+			this.jdynFormSet.setUseScrollBars(false);
+//			this.jdynFormSet.setShowMessageStatus(false);
+//			this.jdynFormSet.addListener(this);
+			this.contents.add(jdynFormSet.asJComponent(),BorderLayout.CENTER);
+			this.contents.setVisible(true);
+			this.jdynFormSet.setReadOnly(readonly);
+			this.setValue(this.assignedValue);
+		} catch (Exception e) {
+			logger.warn("",e);
+		}
+//		this.jdynForm.addFocusListener(this);
+
+	}
+	
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			// TODO
+			// this.jdynForm.clear();
+		} else {
+			if( !(value instanceof List) ) {
+				logger.info("setValue invoked with non List value ("+value.toString()+").");
+				return;
+			}
+			try {
+				this.jdynFormSet.setValues((List)value);
+			} catch (ServiceException e) {
+				logger.warn("Error settings values to DynformSet",e);
+			}
+		}
+		this.assignedValue = (List) value;
+		this.currentValue = this.assignedValue;
+	}
+	
+	public Object getValue() {
+		return this.jdynFormSet.getValues();
+	}
+	
+	public boolean hasValidValue() {
+		return this.jdynFormSet.hasValidValues();
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		fireFieldExitEvent();
+	}
+
+	public void message(String message) {
+		fireMessageEvent(message);
+	}
+
+	public void fieldChanged(JDynFormField field) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formMessage(String message) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formClose() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formMovedTo(int currentPosition) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException {
+		DynFormFieldDefinition def = this.getDefinition();
+		DynField_v2 fielddef = (DynField_v2)def;
+		DynStruct struct = fielddef.getDynClassOfItems();
+		DynObject value = createDynObject(struct);
+		this.currentValue.add(value);
+
+		
+	}
+	
+	private DynObject createDynObject(DynStruct dynStruct){
+		DynObject value = ToolsLocator.getDynObjectManager().createDynObject(dynStruct);
+		DynField[] fields = dynStruct.getDynFields();
+		for(int i=0;i<fields.length; i++){
+			DynField_v2 field = (DynField_v2) fields[i];
+			if(field.getDataType().isDynObject()){
+				value.setDynValue(field.getName(), createDynObject(field.getDynClassOfValue()));
+			}
+		}
+		return value;
+	}
+
+	public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException {
+		this.currentValue.remove(dynformSet.getCurrentIndex());
+	}
+
+	public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formAfterSave(JDynFormSet dynformSet) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formAfterNew(JDynFormSet dynformSet) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formAfterDelete(JDynFormSet dynformSet) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void formAfterSearch(JDynFormSet dynformSet) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBooleanFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBooleanFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBooleanFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Boolean;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldBooleanFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.BOOLEAN, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldBoolean(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for boolean fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBooleanFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBoolean.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBoolean.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBoolean.java	(revision 1235)
@@ -0,0 +1,139 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Boolean;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+
+import javax.swing.JCheckBox;
+
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField.IllegalFieldValue;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldBoolean extends AbstractJDynFormField implements JDynFormField, FocusListener {
+	
+	protected Object assignedValue  = null;
+	
+	public JDynFormFieldBoolean(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = this.getParameterValue();
+	}
+
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	protected JCheckBox getJCheckBox() {
+		return (JCheckBox) this.contents;
+	}
+			
+	public void initComponent() {
+		DynObjectValueItem[] availableValues = this.getDefinition().getAvailableValues();
+		if( availableValues==null ) {
+			this.contents = new JCheckBox();
+			this.contents.addFocusListener(this);
+			if( this.getDefinition().isReadOnly() ) {
+				this.getJCheckBox().setEnabled(false);
+			}
+		}
+		this.setValue(this.assignedValue);
+	}
+	
+	public void setValue(Object value) {
+		boolean s = false;
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value != null ) {
+				s = (Boolean) value;
+			}
+		} else {
+			s = (Boolean) value;
+			try {
+				this.getDefinition().validate(value);
+				this.problemIndicator().clear();
+			} catch (DynFieldValidateException e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		if( this.contents instanceof JCheckBox) {
+			this.getJCheckBox().setSelected(s);
+		} 
+		this.assignedValue = value;
+	}
+	
+	/* 
+	 * M�todos espec�ficos de cada tipo de datos
+	 */
+	
+	public Object getValue() {
+		Object value = null;
+		if( this.contents instanceof JCheckBox ) {
+			boolean s = getJCheckBox().isSelected();
+			value = s;
+		}
+		try {
+			this.getDefinition().validate(value);
+			this.problemIndicator().clear();
+		} catch (DynFieldValidateException e) {
+			throw new IllegalFieldValue(this, e.getLocalizedMessage());
+		}
+		return value;
+	}
+
+	
+	@SuppressWarnings("unused")
+	public boolean hasValidValue() {
+		try {
+			Object value = this.getValue();
+		} catch(Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		if( this.hasValidValue() ) {
+			this.problemIndicator().clear();
+		} else {
+			try {
+				Object value = this.getValue();
+			} catch(Exception e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		fireFieldExitEvent();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Boolean/JDynFormFieldBoolean.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFile.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFile.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFile.java	(revision 1235)
@@ -0,0 +1,237 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.File;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.io.File;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.Tags;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFile extends AbstractJDynFormField implements JDynFormField, FocusListener {
+
+    protected File assignedValue = null;
+    protected File currentValue = null;
+    protected JTextField jtext = null;
+    protected JButton jbutton = null;
+    protected boolean readonly = false;
+
+    public JDynFormFieldFile(DynObject parameters,
+            ServiceManager serviceManager) {
+        super(parameters, serviceManager);
+        this.assignedValue = (File) this.getParameterValue();
+    }
+
+    public void setReadOnly(boolean readonly) {
+        super.setReadOnly(readonly);
+        if (this.contents != null) {
+            if (readonly) {
+                this.jtext.setEditable(false);
+                this.jbutton.setEnabled(false);
+            } else {
+                this.jtext.setEditable(true);
+                this.jbutton.setEnabled(true);
+            }
+        }
+    }
+
+    public Object getAssignedValue() {
+        return this.assignedValue;
+    }
+
+    public void initComponent() {
+        this.contents = new JPanel();
+        this.contents.setLayout(new BorderLayout());
+
+        this.jtext = new JCustomTextField(this.getLabel());
+        this.jtext.addFocusListener(this);
+        //this.jtext.setEditable(false);
+        this.jbutton = new JButton("...");
+        this.jbutton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                onClickBrowse();
+            }
+        });
+
+        this.contents.add(jtext, BorderLayout.CENTER);
+        this.contents.add(jbutton, BorderLayout.LINE_END);
+        this.contents.setVisible(true);
+
+        if (this.readonly) {
+            this.jtext.setEditable(false);
+            this.jbutton.setEnabled(false);
+        } else {
+            this.jtext.setEditable(true);
+            this.jbutton.setEnabled(true);
+        }
+        this.setValue(this.assignedValue);
+    }
+
+    public void onClickBrowse() {
+        fireFieldEnterEvent();
+        this.problemIndicator().restore();
+
+        File initialPath = null;
+        FileFilter filter = null;
+        Tags tags = this.getDefinition().getTags();
+        if (tags.has("path")) {
+            initialPath = new File((String) tags.get("path"));
+        }
+        if (tags.has("filter")) {
+            try {
+                String extensions = (String) tags.get("filter");
+                String filterDescription = extensions;
+                if (tags.has("filterDescription")) {
+                    filterDescription = (String) tags.get("filterDescription");
+                }
+                filter = new FileNameExtensionFilter(filterDescription, extensions.split("[|]"));
+            } catch (Exception ex) {
+                // Ignore 
+            }
+        }
+
+        if (this.currentValue != null) {
+            initialPath = this.currentValue.getParentFile();
+        }
+        File[] x = showOpenFileDialog(this.getLabel(), initialPath, filter);
+        if (x == null) {
+            return;
+        }
+        this.currentValue = x[0];
+        this.jtext.setText(x[0].getPath());
+        this.fireFieldChangedEvent();
+    }
+
+    public void setValue(Object value) {
+        if (value == null) {
+            this.jtext.setText("");
+        } else {
+            if (!(value instanceof File)) {
+                logger.info("setValue invoked with non File value (" + value.toString() + ").");
+                return;
+            }
+            this.jtext.setText(((File) value).getPath());
+        }
+        this.assignedValue = (File) value;
+        this.currentValue = this.assignedValue;
+    }
+
+    public Object getValue() {
+        File value = null;
+        String s = "";
+        s = this.jtext.getText();
+        if (s.trim().length() == 0) {
+            Object x = this.getDefinition().getDefaultValue();
+            if ((x != null && x instanceof File)) {
+                value = new File(x.toString());
+            } else {
+                value = null;
+            }
+        } else {
+            value = new File(s);
+        }
+        return value;
+    }
+
+    public boolean hasValidValue() {
+        return true;
+    }
+
+    public File[] showOpenFileDialog(String title, File initialPath, FileFilter filter) {
+        return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, filter, true);
+    }
+
+    public File[] showChooserDialog(
+            final String title,
+            final int type, // SAVE_DIALOG / OPEN_DIALOG
+            final int selectionMode, //    JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES
+            final boolean multiselection,
+            final File initialPath,
+            final FileFilter filter,
+            final boolean fileHidingEnabled
+    ) {
+        File[] returnValue = null;
+
+        JFileChooser fc = new JFileChooser();
+        fc.setDialogTitle(title);
+        fc.setDialogType(type);
+        fc.setFileSelectionMode(selectionMode);
+        fc.setMultiSelectionEnabled(multiselection);
+        fc.setCurrentDirectory(initialPath);
+        fc.setFileFilter(filter);
+        fc.setFileHidingEnabled(fileHidingEnabled);
+        int r = JFileChooser.CANCEL_OPTION;
+        switch (type) {
+            case JFileChooser.SAVE_DIALOG:
+                r = fc.showSaveDialog(this.contents);
+                break;
+            case JFileChooser.OPEN_DIALOG:
+            default:
+                r = fc.showOpenDialog(this.contents);
+                break;
+        }
+        if (r != JFileChooser.APPROVE_OPTION) {
+            returnValue = null;
+        } else {
+            if (fc.isMultiSelectionEnabled()) {
+                returnValue = fc.getSelectedFiles();
+            } else {
+                returnValue = new File[]{fc.getSelectedFile()};
+            }
+        }
+        return returnValue;
+    }
+
+    public void focusGained(FocusEvent arg0) {
+        fireFieldEnterEvent();
+        this.problemIndicator().restore();
+    }
+
+    public void focusLost(FocusEvent arg0) {
+        fireFieldExitEvent();
+    }
+
+    public void clear() {
+        Object value = this.getDefinition().getDefaultValue();
+        if (value != null) {
+            value = value.toString();
+        } else {
+            value = "";
+        }
+        this.jtext.setText((String) value);
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFile.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFileFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFileFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFileFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.File;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldFileFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.FILE, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldFile(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for file fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFileFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObject.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObject.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObject.java	(revision 1235)
@@ -0,0 +1,144 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.DynObject;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import javax.swing.BorderFactory;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDynObject extends AbstractJDynFormField implements JDynFormField, JDynFormListener, FocusListener {
+	
+	protected DynObject assignedValue  = null;
+	protected DynObject currentValue = null;
+	protected JDynForm jdynForm = null;
+	protected boolean readonly = false;
+
+	public JDynFormFieldDynObject(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = (DynObject) this.getParameterValue();
+	}
+
+	public void setReadOnly(boolean readonly) {
+		super.setReadOnly(readonly);
+		if( this.jdynForm != null ) {
+			this.jdynForm.setReadOnly(readonly);
+		}
+	}
+	
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+	
+	public void initComponent() {
+		this.contents = new JPanel();
+		this.contents.setLayout(new BorderLayout());
+		try {
+			DynStruct struct = this.getDefinition().getDynClassOfValue();
+			this.jdynForm = DynFormLocator.getDynFormManager().createJDynForm(struct);
+        		this.jdynForm.setLayoutMode(getTagValueAsInt("layoutMode", "dynform.layoutmode", JDynForm.USE_PLAIN ));
+			this.jdynForm.setUseScrollBars(false);
+			this.jdynForm.setShowMessageStatus(false);
+			this.jdynForm.addListener(this);
+			this.contents.add(jdynForm.asJComponent(),BorderLayout.CENTER);
+			this.contents.setVisible(true);
+			this.jdynForm.setReadOnly(readonly);
+                        if( this.jdynForm.getShowFields().size() >1 ) {
+                            if( !getTagValueAsBoolean("dynform.border.empty", false) ) {
+                                this.jdynForm.asJComponent().setBorder(BorderFactory.createLineBorder(Color.GRAY));
+                            }
+                        }
+			this.setValue(this.assignedValue);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+//		this.jdynForm.addFocusListener(this);
+
+	}
+	
+	
+	public void setValue(Object value) {
+		if( value == null ) {
+			// TODO
+			// this.jdynForm.clear();
+		} else {
+			if( !(value instanceof DynObject) ) {
+				logger.info("setValue invoked with non DynObject value ("+value.toString()+").");
+				return;
+			}
+			this.jdynForm.setValues((DynObject)value);
+		}
+		this.assignedValue = (DynObject) value;
+		this.currentValue = this.assignedValue;
+	}
+	
+	public Object getValue() {
+		this.jdynForm.getValues(this.currentValue);
+		return this.currentValue;
+	}
+	
+	public boolean hasValidValue() {
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		fireFieldExitEvent();
+	}
+
+	public void message(String message) {
+		fireMessageEvent(message);
+	}
+
+	public void fieldChanged(JDynFormField field) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+    public void clear() {
+        if( this.jdynForm!=null ) {
+            this.jdynForm.clear();
+        }
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObjectFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObjectFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObjectFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.DynObject;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldDynObjectFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.DYNOBJECT, null, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldDynObject(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for DynObject fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObject/JDynFormFieldDynObjectFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknow.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknow.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknow.java	(revision 1235)
@@ -0,0 +1,113 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Unknow;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+/**
+ * This class is used when need to view a field that type is not supported.
+ * It shows an string not editable with the toString representation of the 
+ * value.
+ * 
+ * @author gvSIG Association
+ *
+ */
+public class JDynFormFieldUnknow extends AbstractJDynFormField  implements JDynFormField, FocusListener {
+	
+	private Object assignedValue  = null;
+	
+	public JDynFormFieldUnknow(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = (String) this.getParameterValue();
+	}
+	
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	private JTextField getJTextField() {
+		return (JTextField) this.asJComponent();
+	}
+
+	public void initComponent() {
+		this.contents = new JCustomTextField(this.getLabel());
+		this.contents.addFocusListener(this);
+		this.getJTextField().setEditable(false);;
+		this.setValue(this.assignedValue);
+	}
+	
+	public void setValue(Object value) {
+		String s = null;
+		if( value == null ) {
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				s = "";
+			} else {
+				s = value.toString();
+			}
+		} else {
+			s = value.toString();
+		}
+		this.getJTextField().setText(s);
+		this.assignedValue = value;
+	}
+	
+	public Object getValue() {
+		return this.assignedValue;
+	}
+	
+	public boolean hasValidValue() {
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		fireFieldExitEvent();
+	}
+	
+	public void setReadOnly(boolean readonly) {
+		this.getJTextField().setEditable(false);;
+	}
+	
+	public boolean isReadOnly() {
+		return true;
+	}
+
+	public boolean isModified() {
+		return false;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknow.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknowFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknowFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknowFactory.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformfield.Unknow;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class JDynFormFieldUnknowFactory implements JDynFormFieldFactory {
+
+	private String name = null;
+	private DynStruct parametersDefinition = null;
+	
+	public String getName() {
+		if( name == null ) {
+			DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+			this.name = manager.makeServiceName(DataTypes.UNKNOWN, null);
+		}
+		return this.name;
+	}
+
+
+	public Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException {
+		return new JDynFormFieldUnknow(parameters, serviceManager);
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for string fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/Unknow/JDynFormFieldUnknowFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/FormSetButtonBar.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/FormSetButtonBar.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/FormSetButtonBar.java	(revision 1235)
@@ -0,0 +1,343 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformset.subform;
+
+import com.sun.java.swing.plaf.motif.MotifBorders;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.BevelBorder;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.swing.api.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FormSetButtonBar implements Component {
+
+	protected static final Logger logger = LoggerFactory
+			.getLogger(FormSetButtonBar.class);
+
+
+	public static final int ActionFirst = 1;
+	public static final int ActionPrevious = 2;
+	public static final int ActionNext = 3;
+	public static final int ActionLast = 4;
+	public static final int ActionSave = 5;
+	public static final int ActionNew = 6;
+	public static final int ActionDelete = 7;
+	public static final int ActionSearch = 8;
+	public static final int ActionClose = 9;
+
+	private static final int MAX_ACTIONS = 10;
+
+	public Boolean activatedActions[] = new Boolean[MAX_ACTIONS];
+
+	private static final int COUNTER_HEIGHT = 50;
+	private static final int COUNTER_WIDTH = 100;
+
+	public interface FormSetListener {
+		public boolean doActionFirst();
+		public boolean doActionPrevious();
+		public boolean doActionNext();
+		public boolean doActionLast();
+		public boolean doActionSave();
+		public boolean doActionNew();
+		public boolean doActionDelete();
+		public boolean doActionSearch();
+		public boolean doActionClose();
+	}
+
+	private JPanel contents = null;
+	private Set listeners = null;
+	private int current = 0;
+	private int numrecords = 0;
+
+	private boolean readOnly = false;
+
+
+	private JLabel records;
+	private JComponent buttons[] = new JLabel[MAX_ACTIONS];
+
+
+	public FormSetButtonBar() {
+		// Activamos todas las acciones por defecto
+		for(int i = 0; i<this.activatedActions.length; i++){
+			this.activatedActions[i]=true;
+		}
+		this.listeners = new HashSet();
+	}
+
+	public JComponent asJComponent() {
+		if( this.contents == null ) {
+			this.initComponents();
+		}
+		return this.contents;
+	}
+
+	public void addListener(FormSetListener listener) {
+		this.listeners.add(listener);
+	}
+
+	public void removeListener(FormSetListener listener) {
+		this.listeners.remove(listener);
+	}
+
+	protected void fireEvent(int eventid) {
+		if(this.readOnly){
+			Iterator it = this.listeners.iterator();
+			while (it.hasNext()) {
+				FormSetListener listener = (FormSetListener) it.next();
+				try {
+					switch(eventid) {
+					case ActionFirst:
+						listener.doActionFirst();
+						break;
+					case ActionPrevious:
+						listener.doActionPrevious();
+						break;
+					case ActionNext:
+						listener.doActionNext();
+						break;
+					case ActionLast:
+						listener.doActionLast();
+						break;
+					case ActionSearch:
+						listener.doActionSearch();
+						break;
+					case ActionClose:
+						listener.doActionClose();
+						break;
+					}
+				} catch (Exception ex) {
+					logger.info("Error calling listener " + listener.toString()
+							+ "(" + listener.getClass().getName() + ") from "
+							+ this.toString() + "(" + this.getClass().getName()
+							+ ").", ex);
+				}
+                        }
+                } else {
+			Iterator it = this.listeners.iterator();
+			while (it.hasNext()) {
+				FormSetListener listener = (FormSetListener) it.next();
+				try {
+					switch(eventid) {
+					case ActionFirst:
+						listener.doActionFirst();
+						break;
+					case ActionPrevious:
+						listener.doActionPrevious();
+						break;
+					case ActionNext:
+						listener.doActionNext();
+						break;
+					case ActionLast:
+						listener.doActionLast();
+						break;
+					case ActionSave:
+						listener.doActionSave();
+						break;
+					case ActionNew:
+						listener.doActionNew();
+						break;
+					case ActionDelete:
+						listener.doActionDelete();
+						break;
+					case ActionSearch:
+						listener.doActionSearch();
+						break;
+					case ActionClose:
+						listener.doActionClose();
+						break;
+					}
+				} catch (Exception ex) {
+					logger.info("Error calling listener " + listener.toString()
+							+ "(" + listener.getClass().getName() + ") from "
+							+ this.toString() + "(" + this.getClass().getName()
+							+ ").", ex);
+				}
+			}
+		}
+	}
+
+	private void updateRecords() {
+		setEnabled(ActionNew, true);
+		if( numrecords <= 0 ) {
+			this.records.setText( "0 / 0");
+			setEnabled(ActionFirst, false);
+			setEnabled(ActionPrevious, false);
+			setEnabled(ActionNext, false);
+			setEnabled(ActionLast, false);
+			return;
+		} 
+		this.records.setText((current+1) + " / " + numrecords);
+		if( current<=0 ) {
+			current = 0;
+			setEnabled(ActionFirst, false);
+			setEnabled(ActionPrevious, false);
+			setEnabled(ActionNext, true);
+			setEnabled(ActionLast, true);
+		}
+		else if( current >= numrecords -1) {
+			current = numrecords-1;
+			setEnabled(ActionNext, false);
+			setEnabled(ActionLast, false);
+			setEnabled(ActionFirst, true);
+			setEnabled(ActionPrevious, true);
+		}else{
+			setEnabled(ActionNext, true);
+			setEnabled(ActionLast, true);
+			setEnabled(ActionFirst, true);
+			setEnabled(ActionPrevious, true);
+		}
+	}
+
+	private void initComponents() {
+		I18nManager i18nManager = ToolsLocator.getI18nManager();
+		this.contents = new JPanel();
+                //this.contents.setBorder(BorderFactory.createLineBorder(Color.GRAY));
+		this.contents.setLayout( new FlowLayout(FlowLayout.LEADING, 4,4));
+		//		this.contents.setBorder( BorderFactory.createLineBorder(Color.GRAY, 1));
+
+		JComponent firstButton = createButton(i18nManager.getTranslation("first"), "first.png", ActionFirst);
+		this.contents.add(firstButton);
+		this.contents.add(createButton(i18nManager.getTranslation("back"), "previous.png", ActionPrevious));
+
+		this.records = new JLabel();
+                int height = this.records.getFont().getSize();
+                if( height <16 ) {
+                    height = 16;
+                }
+		this.records.setPreferredSize(new Dimension(COUNTER_WIDTH, height));
+		this.records.setHorizontalAlignment( SwingConstants.CENTER ); 
+                //this.records.setBorder(BorderFactory.createLineBorder(Color.WHITE));
+		this.contents.add(this.records);
+
+		this.contents.add(createButton(i18nManager.getTranslation("next"), "next.png", ActionNext));
+		this.contents.add(createButton(i18nManager.getTranslation("last"), "last.png", ActionLast));
+
+		this.contents.add(createButton(i18nManager.getTranslation("guardar"), "save.png", ActionSave));
+		this.contents.add(createButton(i18nManager.getTranslation("nuevo"), "new.png", ActionNew));
+		this.contents.add(createButton(i18nManager.getTranslation("borrar"), "delete.png", ActionDelete));
+		this.contents.add(createButton(i18nManager.getTranslation("search"), "search.png", ActionSearch));
+
+		this.contents.add(createButton("Close", "close.png", ActionClose));
+		this.initButtons();
+		this.updateRecords();
+	}
+
+	private void initButtons() {
+		setActionActive(ActionSave, isActionActive(ActionSave));
+		setActionActive(ActionNew, isActionActive(ActionNew));
+		setActionActive(ActionSearch, isActionActive(ActionSearch));
+		setActionActive(ActionDelete, isActionActive(ActionDelete));
+		setActionActive(ActionClose, isActionActive(ActionClose));
+	}
+
+	private JComponent createButton(final String tip, final String image, final int action) {
+		JLabel jlabel = new JLabel();
+		jlabel.setToolTipText(tip);
+		URL url = this.getClass().getClassLoader().getResource("org/gvsig/tools/dynform/impl/"+image);
+		Icon icon = new ImageIcon(url);
+		jlabel.setIcon(icon);
+		jlabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+		jlabel.addMouseListener(new MouseAdapter()  {
+			public void mouseClicked(MouseEvent evt) {
+				int count = evt.getClickCount();
+				if (count == 1) {
+					fireEvent(action);
+				}
+			}
+		});
+		this.buttons[action] = jlabel;
+		return jlabel;
+	}
+
+	public void setEnabled(int action, boolean enabled) {
+		JLabel label = (JLabel) this.buttons[action];
+		if( enabled ) {
+			label.setCursor(new Cursor(Cursor.HAND_CURSOR));
+			label.setEnabled(true);
+		} else {
+			label.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+			label.setEnabled(false);
+		}
+	}
+
+	public void setCurrent(int current) {
+		this.current = current;
+		updateRecords();
+	}
+
+	public void setNumrecords(int numrecords) {
+		this.numrecords = numrecords;
+		updateRecords();
+	}
+
+	public void setActionActive(int action, boolean active){
+		if(action == ActionSave || action == ActionDelete ||
+				action == ActionNew ||	action == ActionSearch||
+				action == ActionClose){
+			if( this.contents == null ) {
+				this.initComponents();
+			}
+			this.activatedActions[action] = active;
+			this.buttons[action].setVisible(active);
+		}
+	}
+
+	public boolean isActionActive(int action){
+		return this.activatedActions[action];
+	}
+
+	public void setReadOnly(boolean readOnly) {
+		this.readOnly = readOnly;
+		for(int i=0; i<buttons.length; i++){
+			if(isActionActive(i) && this.buttons[i] != null){
+				this.buttons[i].setEnabled(!readOnly);
+			}
+			if(!readOnly){
+				updateRecords();
+			}
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/FormSetButtonBar.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet.java	(revision 1235)
@@ -0,0 +1,516 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformset.subform;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+import javax.swing.BorderFactory;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.services.dynformset.subform.FormSetButtonBar.FormSetListener;
+import org.gvsig.tools.dynform.spi.AbstractJDynFormSet;
+import org.gvsig.tools.dynform.spi.ActionStore;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SubformJDynFormSet extends AbstractJDynFormSet implements FormSetListener, JDynFormListener {
+
+    private static final Logger logger = LoggerFactory.getLogger(SubformJDynFormSet.class);
+
+    private JLabel jlabel_messages = null;
+    private JDynForm form = null;
+    private FormSetButtonBar buttonBar = null;
+    private int current = 0;
+
+    public SubformJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException {
+        super(manager, definition);
+    }
+
+    public JComponent asJComponent() {
+        if (this.contents == null) {
+            try {
+                this.initComponents();
+            } catch (ServiceException e) {
+                throw new RuntimeException(e.getLocalizedMessage(), e);
+            }
+        }
+        this.fireFormMovedToEvent(current);
+        return this.contents;
+    }
+
+    public JLabel getMessagesJLabel() {
+        if (this.jlabel_messages == null) {
+            this.jlabel_messages = new JLabel();
+//			this.jlabel_messages.setBorder( BorderFactory.createLoweredBevelBorder());
+            this.jlabel_messages.setText(" ");
+            this.jlabel_messages.addMouseListener(new MouseAdapter() {
+                public void mouseClicked(MouseEvent evt) {
+                    int count = evt.getClickCount();
+                    if (count == 2) {
+                        JOptionPane.showMessageDialog(contents, jlabel_messages.getText(), "Status", JOptionPane.INFORMATION_MESSAGE);
+                    }
+                }
+            });
+        }
+        return this.jlabel_messages;
+    }
+
+    public void message() {
+        this.getMessagesJLabel().setText(" ");
+    }
+
+    public void message(String msg) {
+        this.getMessagesJLabel().setText(msg);
+    }
+
+    private FormSetButtonBar getButtonBar() throws ServiceException {
+        if (this.buttonBar == null) {
+            initComponents();
+        }
+        return this.buttonBar;
+    }
+
+    private void initComponents() throws ServiceException {
+        this.contents = new JPanel();
+        this.contents.setBorder(BorderFactory.createLineBorder(Color.GRAY));
+        this.contents.setLayout(new BorderLayout());
+
+        this.form = this.manager.getDynFormManager().createJDynForm(definition);
+        this.form.setUseScrollBars(this.getUseScrollBars());
+        this.form.addListener(this);
+
+        if (!actionsBuffer.isEmpty()) {
+            Iterator it = actionsBuffer.iterator();
+            while (it.hasNext()) {
+                ActionStore actStore = (ActionStore) it.next();
+                if (actStore.isSeparator()) {
+                    form.addSeparatorToPopupMenu(
+                            actStore.getDataType());
+                } else {
+                    form.addActionToPopupMenu(
+                            actStore.getDataType(),
+                            actStore.getActionName(),
+                            actStore.getAction());
+                }
+            }
+        }
+        if (this.getUseScrollBars()) {
+            if (this.formHeight > -1 && this.formWidth > -1) {
+                this.setFormSize(this.formWidth, this.formHeight);
+            }
+        }
+        this.form.setShowMessageStatus(false);
+        this.form.setLayoutMode(this.layoutMode);
+        this.form.addListener(this);
+
+        this.buttonBar = new FormSetButtonBar();
+        this.buttonBar.addListener(this);
+        this.buttonBar.setActionActive(FormSetButtonBar.ActionDelete, this.allowDelete());
+        this.buttonBar.setActionActive(FormSetButtonBar.ActionNew, this.allowNew());
+        this.buttonBar.setActionActive(FormSetButtonBar.ActionSave, this.allowUpdate());
+        this.buttonBar.setActionActive(FormSetButtonBar.ActionSearch, this.allowSearch());
+        this.buttonBar.setActionActive(FormSetButtonBar.ActionClose, this.allowClose());
+
+        this.contents.add(this.buttonBar.asJComponent(), BorderLayout.NORTH);
+        this.contents.add(this.form.asJComponent(), BorderLayout.CENTER);
+        this.contents.add(this.getMessagesJLabel(), BorderLayout.SOUTH);
+        doChangeValues();
+    }
+
+    private void doChangeValues() throws ServiceException {
+        this.current = 0;
+        if (this.values == null || this.values.isEmpty()) {
+            this.form.setReadOnly(true);
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete, false);
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave, false);
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionNew,
+                    this.allowNew() && !this.isReadOnly());
+            this.getButtonBar().setNumrecords(0);
+            this.form.clear();
+        } else {
+            this.form.setValues((DynObject) this.values.get(this.current));
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete,
+                    this.allowDelete() && !this.isReadOnly());
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave,
+                    this.allowUpdate() && !this.isReadOnly());
+            this.getButtonBar().setNumrecords(this.values.size());
+        }
+        this.getButtonBar().setCurrent(this.current);
+    }
+
+    @Override
+    public void setValues(List values) throws ServiceException {
+        super.setValues(values);
+        if (this.contents != null) {
+            doChangeValues();
+        }
+    }
+
+    @Override
+    public void setValues(DynObjectSet values) throws ServiceException {
+        super.setValues(values);
+        if (this.contents != null) {
+            doChangeValues();
+        }
+    }
+
+    @Override
+    public void setReadOnly(boolean readOnly) {
+        super.setReadOnly(readOnly);
+        if (this.buttonBar != null) {
+            this.buttonBar.setReadOnly(readOnly);
+        }
+        if (this.form != null) {
+            this.form.setReadOnly(readOnly);
+        }
+    }
+
+    public boolean doActionFirst() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        if (autosave) {
+            if (!doActionSave()) {
+                return false;
+            }
+        }
+        this.current = 0;
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.buttonBar.setCurrent(this.current);
+        try {
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete,
+                    this.allowDelete() && !this.isReadOnly());
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave,
+                    this.allowUpdate() && !this.isReadOnly());
+        } catch (Exception ex) {
+            logger.warn("Can't enable/disable delete and save buttons",ex);
+        }
+
+        this.fireFormMovedToEvent(this.current);
+        return true;
+    }
+
+    public boolean doActionPrevious() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        if (autosave) {
+            if (!doActionSave()) {
+                return false;
+            }
+        }
+        if (this.current > 0) {
+            this.current--;
+        }
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.buttonBar.setCurrent(this.current);
+        this.fireFormMovedToEvent(this.current);
+        return true;
+    }
+
+    public boolean doActionNext() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        if (autosave) {
+            if (!doActionSave()) {
+                return false;
+            }
+        }
+        if (this.current < this.values.size() - 1) {
+            this.current++;
+        }
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.buttonBar.setCurrent(this.current);
+        this.fireFormMovedToEvent(this.current);
+        return true;
+    }
+
+    public boolean doActionLast() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        if (autosave) {
+            if (!doActionSave()) {
+                return false;
+            }
+        }
+        this.current = this.values.size() - 1;
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.buttonBar.setCurrent(this.current);
+        this.fireFormMovedToEvent(this.current);
+        return true;
+    }
+
+    public boolean doActionSave() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+// Ahora mismo siempre devuelve false, asi que de momento
+// lo quito hasta que se corrija esto.
+//
+//        if (!this.form.isModified()) {
+//            return true;
+//        }
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formBeforeSave(SubformJDynFormSet.this);
+                }
+            });
+        } catch (AbortActionException e) {
+            return false;
+        } catch (BaseException e) {
+            logger.warn("Can't notify to listeners before save.",e);
+            return false;
+        }
+
+        List<String> fieldsName = new ArrayList<String>();
+        if (!this.form.hasValidValues(fieldsName)) {
+            String errores = "";
+            Iterator<String> it = fieldsName.iterator();
+            while (it.hasNext()) {
+                String name = (String) it.next();
+                errores = errores + "     - " + name + "\n";
+            }
+            int r = confirmDialog(
+                    "There are incorrect data in the following fields:\n" + errores + "\nContinuing the incorrect values ​will not be saved. Do you want to continue?", "warning",
+                    JOptionPane.WARNING_MESSAGE,
+                    JOptionPane.YES_NO_OPTION);
+            if (r != JOptionPane.YES_OPTION) {
+                return false;
+            }
+        }
+        if (this.current >= 0 && this.current < this.values.size()) {
+            this.form.getValues((DynObject) this.values.get(this.current));
+        } else {
+            logger.warn("current out of range.");
+        }
+
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formAfterSave(SubformJDynFormSet.this);
+                }
+            });
+        } catch (AbortActionException e) {
+            return false;
+        } catch (BaseException e) {
+            logger.warn("Can't notify to listeners after save.",e);
+            return false;
+        }
+        return true;
+    }
+
+    public boolean doActionNew() {
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formBeforeNew(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+
+        this.current = this.values.size() - 1;
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.form.setReadOnly(this.isReadOnly());
+        this.buttonBar.setNumrecords(this.countValues());
+        this.buttonBar.setCurrent(this.current);
+        try {
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete,
+                    this.allowDelete() && !this.isReadOnly());
+            this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave,
+                    this.allowUpdate() && !this.isReadOnly());
+        } catch (Exception ex) {
+            logger.warn("Can't enable/disable delete and save buttons",ex);
+        }
+
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formAfterNew(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+        return true;
+    }
+
+    public boolean doActionDelete() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        if (this.countValues() < 1) {
+            return true;
+        }
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formBeforeDelete(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+
+        if (this.current >= countValues()) {
+            this.current = countValues() - 1;
+        }
+        if (this.current > -1) {
+            this.form.setValues((DynObject) this.values.get(this.current));
+        }
+        this.buttonBar.setNumrecords(this.countValues());
+        this.buttonBar.setCurrent(this.current);
+
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formAfterDelete(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+        return true;
+    }
+
+    public boolean doActionSearch() {
+        if (this.values.isEmpty()) {
+            return false;
+        }
+
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formBeforeSearch(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+        // Do search
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formBeforeSearch(SubformJDynFormSet.this);
+                }
+            });
+        } catch (BaseException e) {
+            return true;
+        }
+        return true;
+    }
+
+    public boolean doActionClose() {
+        fireCloseEvent();
+        return true;
+    }
+
+    @Override
+    public void setFormSize(int width, int height) {
+        super.setFormSize(width, height);
+        if (this.form != null) {
+            this.form.setFormSize(width, height);
+        }
+    }
+
+    public int getCurrentIndex() {
+        return this.current;
+    }
+
+    public void setCurrentIndex(int index) {
+        if (index < 0 || index > countValues()) {
+            throw new IllegalArgumentException("Index (" + index + ") out of range [0.." + countValues() + "].");
+        }
+        this.current = index;
+        this.form.setValues((DynObject) this.values.get(this.current));
+        this.buttonBar.setCurrent(this.current);
+        this.fireFormMovedToEvent(this.current);
+    }
+
+    public void fieldChanged(JDynFormField field) {
+        logger.warn("Ha cambiado el field: " + field.getName() + " con el valor => " + field.getValue());
+    }
+
+    @Override
+    public DynObject get(int position) {
+        logger.warn("Recojo el field: " + position);
+
+        return (DynObject) this.values.get(position);
+    }
+
+    public List getValues() {
+        if (this.current >= 0 && this.current < this.values.size()) {
+            this.form.getValues((DynObject) this.values.get(this.current));
+        }
+        return this.values;
+    }
+
+    public boolean hasValidValues() {
+        return this.form.hasValidValues();
+    }
+
+    public boolean hasValidValues(List<String> fieldsName) {
+        return this.form.hasValidValues(fieldsName);
+    }
+
+    public void clear() {
+        if (this.form != null) {
+            this.form.clear();
+        }
+    }
+
+    public void getFormValues(DynObject values) {
+        this.form.getValues(values);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSetFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSetFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSetFactory.java	(revision 1235)
@@ -0,0 +1,45 @@
+package org.gvsig.tools.dynform.services.dynformset.subform;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormSetFactory;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class SubformJDynFormSetFactory implements JDynFormSetFactory {
+
+    public static final String NAME = "Subform";
+    private DynStruct parametersDefinition = null;
+
+    public String getName() {
+        return NAME;
+    }
+
+    public Service create(DynObject parameters, ServiceManager serviceManager) throws ServiceException {
+        return new SubformJDynFormSet(
+                serviceManager,
+                (DynFormDefinition) parameters.getDynValue("definition")
+        );
+    }
+
+    public DynObject createParameters() {
+        return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+    }
+
+    public void initialize() {
+        if ( this.parametersDefinition == null ) {
+            String serviceName = this.getName();
+            DynObjectManager manager = ToolsLocator.getDynObjectManager();
+            this.parametersDefinition = manager.createDynClass(
+                    serviceName, "Parameters definition for Subform JDynFormSet");
+            this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FORMSETDEFINITION)
+                    .setClassOfValue(DynFormDefinition.class).setMandatory(true);
+        }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet_save.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet_save.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet_save.txt	(revision 1235)
@@ -0,0 +1,641 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl.jdynformset.subform;
+
+import java.awt.BorderLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
+import org.gvsig.tools.dynform.JDynFormSet;
+import org.gvsig.tools.dynform.impl.ActionStore;
+import org.gvsig.tools.dynform.impl.DefaultDynFormManager;
+import org.gvsig.tools.dynform.impl.DefaultVisitableSet;
+import org.gvsig.tools.dynform.impl.FormSetButtonBar;
+import org.gvsig.tools.dynform.impl.FormSetButtonBar.FormSetListener;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SubformJDynFormSet implements JDynFormSet, FormSetListener, JDynFormListener, Service {
+
+	private static final Logger logger = LoggerFactory.getLogger(SubformJDynFormSet.class);
+	
+	private DynFormSPIManager manager = null;
+	private DynFormDefinition definition = null;
+	private int layoutMode = USE_PLAIN;
+	private JLabel jlabel_messages = null;
+	private boolean readOnly = false;
+	private JDynForm form = null;
+	private FormSetButtonBar buttonBar = null;
+	private JPanel contents = null;
+	private List values=null;
+	private int current=0;
+	private DefaultVisitableSet listeners = null;
+	private boolean autosave = true;
+
+	private boolean hasActionDelete = true;
+	private boolean hasActionNew = true;
+	private boolean hasActionUpdate = true;
+	private boolean hasActionSearch = true;
+	
+	private int formWidth = -1;
+	private int formHeight = -1;
+	
+	private List<ActionStore> actionsBuffer = new ArrayList<ActionStore>();
+	
+	public SubformJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException {
+		this.manager = (DynFormSPIManager)manager;
+		this.definition = definition;
+		this.listeners = new DefaultVisitableSet();
+	}
+	
+	public JComponent asJComponent() {
+		if( this.contents == null ) {
+			try {
+				this.initComponents();
+			} catch (ServiceException e) {
+				throw new RuntimeException(e.getLocalizedMessage(),e);
+			}
+		}
+		this.fireFormMovedToEvent();
+		return this.contents;
+	}
+	
+	public void addListener(JDynFormSetListener listener) {
+		this.listeners.add(listener);
+	}
+
+	public void removeListener(JDynFormSetListener listener) {
+		this.listeners.remove(listener);
+	}
+	
+	protected void fireMessageEvent(final String message) {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formMessage(message);
+				}
+			});
+		} catch (AbortActionException e) {
+			// Do nothing 
+		} catch (Exception e) {
+			logger.info("Error calling to the form message event.",e);
+		}
+	}
+
+	protected void fireCloseEvent() {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formClose();
+				}
+			});
+		} catch (AbortActionException e) {
+			// Do nothing 
+		} catch (Exception e) {
+			logger.info("Error calling to the form close event.",e);
+		}
+	}
+	
+	protected void fireFormMovedToEvent() {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formMovedTo(current);
+				}
+			});
+		} catch (AbortActionException e) {
+			// Do nothing 
+		} catch (Exception e) {
+			logger.info("Error calling to the form moved to event.",e);
+		}
+	}
+	
+	public JLabel getMessagesJLabel() {
+		if( this.jlabel_messages == null ) {
+			this.jlabel_messages = new JLabel();
+//			this.jlabel_messages.setBorder( BorderFactory.createLoweredBevelBorder());
+			this.jlabel_messages.setText(" ");
+			this.jlabel_messages.addMouseListener(new MouseAdapter()  {
+	            public void mouseClicked(MouseEvent evt) {
+	                int count = evt.getClickCount();
+	                if (count == 2) {
+	                    JOptionPane.showMessageDialog(contents,jlabel_messages.getText(),"Status",JOptionPane.INFORMATION_MESSAGE);
+	                }
+	            }
+	        });
+		}
+		return this.jlabel_messages;
+	}
+	
+	public void message() {
+		this.getMessagesJLabel().setText(" ");
+	}
+	
+	public void message(String msg) {
+		this.getMessagesJLabel().setText(msg);
+	}
+	
+	private FormSetButtonBar getButtonBar() throws ServiceException {
+		if( this.buttonBar == null ) {
+			initComponents();
+		}
+		return this.buttonBar;
+	}
+	
+	private void initComponents() throws ServiceException {
+		this.contents = new JPanel();
+		this.contents.setLayout(new BorderLayout());
+		
+		this.form = this.manager.getDynFormManager().createJDynForm(definition);
+		this.form.setUseScrollBars(this.useScrollBars);
+		
+		if(!actionsBuffer.isEmpty()){
+			Iterator it = actionsBuffer.iterator();
+			while(it.hasNext()){
+				ActionStore actStore = (ActionStore) it.next();
+				if(actStore.isSeparator()){
+					form.addSeparatorToPopupMenu(
+							actStore.getDataType());
+				}else{
+					form.addActionToPopupMenu(
+							actStore.getDataType(), 
+							actStore.getActionName(), 
+							actStore.getAction());
+				}
+			}
+		}
+		if( this.useScrollBars ) {
+			if(this.formHeight > -1 && this.formWidth > -1){
+				this.setFormSize(this.formWidth, this.formHeight);
+			}
+		}
+		this.form.setShowMessageStatus(false);
+		this.form.setLayoutMode(this.layoutMode);
+		this.form.addListener(this);
+
+		this.buttonBar = new FormSetButtonBar();
+		this.buttonBar.addListener(this);
+		this.buttonBar.setActionActive(this.buttonBar.ActionDelete, hasActionDelete);
+		this.buttonBar.setActionActive(this.buttonBar.ActionNew, hasActionNew);
+		this.buttonBar.setActionActive(this.buttonBar.ActionSave, hasActionUpdate);
+		this.buttonBar.setActionActive(this.buttonBar.ActionSearch, hasActionSearch);
+		
+		this.contents.add(this.buttonBar.asJComponent(), BorderLayout.NORTH);
+		this.contents.add(this.form.asJComponent(), BorderLayout.CENTER);
+		this.contents.add(this.getMessagesJLabel(), BorderLayout.SOUTH);
+		if( this.values != null ) {
+			doChangeValue();
+		}
+		this.form.setReadOnly(this.readOnly);
+	}
+	
+	public int getLayoutMode() {
+		return this.layoutMode;
+	}
+	
+	public void setLayoutMode(int layoutMode) {
+		if( layoutMode<0 || layoutMode>USE_SEPARATORS) {
+			throw new IllegalArgumentException("layoutMode ("+layoutMode+") out of range. Valid values are 0 .. "+ USE_SEPARATORS+".");
+		}
+		this.layoutMode = layoutMode;
+	}
+
+	private void doChangeValue()  throws ServiceException  {
+		this.current = 0;
+		this.form.setValues((DynObject) this.values.get(this.current));
+
+		this.getButtonBar().setNumrecords(this.values.size());
+		this.getButtonBar().setCurrent(this.current);
+	}
+	
+	public void setValues(List values) throws ServiceException {
+		List x = new ArrayList();
+		x.addAll(values);
+		this.values = x;
+		if( this.contents != null ) {
+			doChangeValue();
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete, true);
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave, true);
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionNew, true);
+		}
+	}
+
+	public void setValues(DynObjectSet values) throws ServiceException {
+		List x = new ArrayList();
+		DisposableIterator it;
+		try {
+			it = values.iterator();
+		} catch (BaseException e) {
+			logger.info("Uf! o se que hacer con este error, lo relanzo sin mas.",e);
+			throw new RuntimeException(e);
+		}
+		while(it.hasNext()) {
+			DynObject obj = (DynObject) it.next();
+			if( obj instanceof Cloneable ) {
+				try {
+					obj = (DynObject) ((Cloneable)obj).clone();
+				} catch (CloneNotSupportedException e) {
+					// Do nothing
+				}
+			}
+			x.add(obj);
+		}
+		this.values = x;
+		if( this.contents != null ) {
+			doChangeValue();
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionDelete, values.isDeleteEnabled());
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionSave, values.isUpdateEnabled());
+			this.getButtonBar().setEnabled(FormSetButtonBar.ActionNew, values.isUpdateEnabled());
+		}
+	}
+
+	public boolean isReadOnly() {
+		return readOnly;
+	}
+	
+	public void setReadOnly(boolean readOnly) {
+		this.readOnly = readOnly;
+		if( this.form != null ) { 
+			this.form.setReadOnly(readOnly);
+		}
+	}
+
+	public boolean doActionFirst() {
+		if( autosave ) {
+			if( !doActionSave() ) {
+				return false;
+			}
+		}
+		this.current = 0;
+		this.form.setValues((DynObject) this.values.get(this.current));
+		this.buttonBar.setCurrent(this.current);
+		this.fireFormMovedToEvent();
+		return true;
+	}
+
+	public boolean doActionPrevious() {
+		if( autosave ) {
+			if( !doActionSave() ) {
+				return false;
+			}
+		}
+		if( this.current > 0 ) {
+			this.current--;
+		}
+		this.form.setValues((DynObject) this.values.get(this.current));
+		this.buttonBar.setCurrent(this.current);
+		this.fireFormMovedToEvent();
+		return true;
+	}
+
+	public boolean doActionNext() {
+		if( autosave ) {
+			if( !doActionSave() ) {
+				return false;
+			}
+		}
+		if( this.current < this.values.size() ) {
+			this.current++;
+		}
+		this.form.setValues((DynObject) this.values.get(this.current));
+		this.buttonBar.setCurrent(this.current);
+		this.fireFormMovedToEvent();
+		return true;
+	}
+
+	public boolean doActionLast() {
+		if( autosave ) {
+			if( !doActionSave() ) {
+				return false;
+			}
+		}
+		this.current = this.values.size()-1;
+		this.form.setValues((DynObject) this.values.get(this.current));
+		this.buttonBar.setCurrent(this.current);
+		this.fireFormMovedToEvent();
+		return true;
+	}
+
+	public boolean doActionSave() {
+		if( !this.form.isModified() ) {
+			return true;
+		}
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formBeforeSave();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		
+		List<String> fieldsName = new ArrayList<String>();
+		if( !this.form.haveValidValues(fieldsName) ) {
+			String errores = "";
+			Iterator<String> it= fieldsName.iterator();
+			while(it.hasNext()){
+				String name = (String)it.next();
+				errores = errores +"     - "+ name + "\n";
+			}
+			int r = confirmDialog(
+					"There are incorrect data in the following fields:\n" +errores+"\nContinuing the incorrect values ​will not be saved. Do you want to continue?", "warning", 
+					JOptionPane.WARNING_MESSAGE, 
+					JOptionPane.YES_NO_OPTION);
+			if(  r != JOptionPane.YES_OPTION ) {
+				return false;
+			}
+		}
+		if( this.current >=0 && this.current<this.values.size() ) {
+			this.form.getValues((DynObject) this.values.get(this.current));
+		} else {
+			logger.warn("current out of range.");
+		}
+			
+		
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formAfterSave();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		return true;
+	}
+
+	public boolean doActionNew() {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formBeforeNew();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		// Do new Actions
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formAfterNew();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		return true;
+	}
+
+	public boolean doActionDelete() {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formBeforeDelete();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		// Do new Actions
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formAfterDelete();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}		return true;
+	}
+
+	public boolean doActionSearch() {
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formBeforeSearch();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		// Do search
+		try {
+			this.listeners.accept(new Visitor() {
+				public void visit(Object listener) throws VisitCanceledException, BaseException {
+					((JDynFormSetListener)listener).formBeforeSearch();
+				}
+			});
+		} catch (BaseException e) {
+			return true;
+		}
+		return true;
+	}
+
+	public boolean doActionClose() {
+		fireCloseEvent();
+		return true;
+	}
+	
+	public boolean isAutosave() {
+		return this.autosave;
+	}
+	
+	public void setAutosave(boolean autosave) {
+		this.autosave = autosave;
+	}
+	
+	public int confirmDialog(final String message, final String title, final int optionType,
+			final int messageType) {
+		return JOptionPane.showConfirmDialog(
+				this.contents, message,title, optionType, messageType);
+	}
+
+	public boolean allowUpdate() {
+		try {
+			return this.getButtonBar().isActionActive(this.getButtonBar().ActionSave);
+		} catch (ServiceException e) {
+			logger.info("Button bar isn't initializated");
+		}
+		return false;
+	}
+
+	public boolean allowDelete() {
+		try {
+			return this.getButtonBar().isActionActive(this.getButtonBar().ActionDelete);
+		} catch (ServiceException e) {
+			logger.info("Button bar isn't initializated");
+		}
+		return false;
+	}
+
+	public boolean allowNew() {
+		try {
+			return this.getButtonBar().isActionActive(this.getButtonBar().ActionNew);
+		} catch (ServiceException e) {
+			logger.info("Button bar isn't initializated");
+		}
+		return false;
+	}
+
+	public boolean allowSearch() {
+		try {
+			return this.getButtonBar().isActionActive(this.getButtonBar().ActionSearch);
+		} catch (ServiceException e) {
+			logger.info("Button bar isn't initializated");
+		}
+		return false;
+	}
+
+	public void setAllowUpdate(boolean allowUpdate) {
+		hasActionUpdate = allowUpdate;
+//		try {
+//			this.getButtonBar().setActionActive(this.getButtonBar().ActionSave, allowUpdate);
+//		} catch (ServiceException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+	}
+
+	public void setAllowDelete(boolean allowDelete) {
+		hasActionDelete = allowDelete;
+//		try {
+//			this.getButtonBar().setActionActive(this.getButtonBar().ActionDelete, allowDelete);
+//		} catch (ServiceException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+	}
+
+	public void setAllowNew(boolean allowNew) {
+		hasActionNew = allowNew;
+	}
+
+	public void setAllowSearch(boolean allowSearch) {
+		hasActionSearch = allowSearch;
+//		try {
+//			this.getButtonBar().setActionActive(this.getButtonBar().ActionSearch, allowSearch);
+//		} catch (ServiceException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+	}
+
+	public void setFormSize(int width, int height) {
+		this.formHeight = height;
+		this.formWidth = width;
+		if(this.form != null){
+			this.form.setFormSize(width, height);
+		}
+	}
+
+	public int getCurrentIndex() {
+		return this.current;
+	}
+
+	public int countValues() {
+		return this.values.size();
+	}
+
+	public void setCurrentIndex(int index) {
+		if( index <0 || index > countValues() ) {
+			throw new IllegalArgumentException("Index ("+index+") out of range [0.."+countValues()+"].");
+		}
+		this.current = index;
+		this.form.setValues((DynObject) this.values.get(this.current));
+		this.buttonBar.setCurrent(this.current);
+		this.fireFormMovedToEvent();
+	}
+
+	public DynObject get(int position) {
+		return (DynObject) this.values.get(position);
+	}
+
+	public void addActionToPopupMenu(DataType tipo, String name, Action action) {
+		try {
+			if(this.form==null){
+				this.actionsBuffer.add(new ActionStore(tipo, name, action));
+			}else{
+				this.form.addActionToPopupMenu(tipo, name, action);
+			}
+		} catch( Exception ex) {
+			String s = (tipo==null)? "(null)" : tipo.getName();
+			logger.warn("Can't add popup menu '"+name+"' to the fields of type '"+s+"' of the form.", ex);
+		}
+	}
+
+	public void addSeparatorToPopupMenu(DataType tipo) {
+		try {
+			if(this.form==null){
+				this.actionsBuffer.add(new ActionStore(tipo));
+			}else{
+				this.form.addSeparatorToPopupMenu(tipo);
+			}
+		} catch( Exception ex) {
+			String s = (tipo==null)? "(null)" : tipo.getName();
+			logger.warn("Can't add separator to the popup menu to the fields of type '"+s+"' of the form.", ex);
+		}
+
+	}		
+	
+	public void setUseScrollBars(boolean usesScrolls) {
+		this.useScrollBars  = usesScrolls;
+	}
+
+	public boolean getUseScrollBars() {
+		return useScrollBars;
+	}
+
+    public Manager getManager() {
+        return this.manager;
+    }
+        
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSet.java	(revision 1235)
@@ -0,0 +1,407 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services.dynformset.simpletable;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.spi.AbstractJDynFormSet;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SimpleTableJDynFormSet extends AbstractJDynFormSet {
+
+    private static final Logger logger = LoggerFactory.getLogger(SimpleTableJDynFormSet.class);
+	private JButton addButton;
+	private JButton deleteButton;
+	private JTable table;
+	private DynObjectListTableModel tableModel;
+	private int currentIndex;
+    private int currentCol;
+
+    public SimpleTableJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException {
+        super(manager, definition);
+        this.formHeight = 80;
+    }
+    
+    @Override
+    public void setValues(List values) throws ServiceException {
+    	super.setValues(values);
+    	this.tableModel.setValues(values);
+    	if(values == null){
+    		addButton.setEnabled(false);
+    		deleteButton.setEnabled(false);
+    	}else{
+    		addButton.setEnabled(true);
+    		deleteButton.setEnabled(!values.isEmpty());
+    	}
+    }
+
+    public JComponent asJComponent() {
+        if ( this.contents == null ) {
+            try {
+                this.initComponents();
+            } catch (ServiceException e) {
+                throw new RuntimeException(e.getLocalizedMessage(), e);
+            }
+        }
+        this.fireFormMovedToEvent(0);
+        return this.contents;
+    }
+
+    public int getCurrentIndex() {
+        return currentIndex;
+    }
+
+    public void setCurrentIndex(int index) {
+    	if(index<tableModel.getRowCount()){
+    		this.currentIndex = index;
+    	}
+    }
+
+    private void initComponents() throws ServiceException {
+        this.contents = getTablePanel();
+    }
+    
+    private JPanel getTablePanel(){
+		JPanel panel_chartType = new JPanel();
+		GridBagLayout gbl_panel_chartType = new GridBagLayout();
+//		gbl_panel_chartType.rowHeights = new int[] { 0, 500, 0, 0, 0, 0, 0,
+//				0,0,0,0,175,10 };
+		panel_chartType.setLayout(gbl_panel_chartType);
+
+//		tablePanel = new JTable() {
+//			/**
+//			 * 
+//			 */
+//			private static final long serialVersionUID = -352323096347454258L;
+//			public boolean isCellEditable(int rowIndex, int colIndex) {
+//				if (colIndex == 0)
+//					return true;
+//				return false; // Disallow the editing of any cell
+//			}
+//		}
+		createJTable();
+		GridBagConstraints gbc_table = new GridBagConstraints();
+		gbc_table.gridheight = 3;
+		gbc_table.gridwidth = 2;
+		gbc_table.insets = new Insets(0, 0, 0, 5);
+		gbc_table.fill = GridBagConstraints.BOTH;
+		gbc_table.weightx = 1.0;
+		gbc_table.weighty = 0.0;
+		gbc_table.gridx = 0;
+		gbc_table.gridy = 0;
+		//table.add(this.form.asJComponent());
+		
+		JScrollPane scrollPane = new JScrollPane(table);
+		scrollPane.setPreferredSize(new Dimension(scrollPane.getWidth(),this.formHeight));
+		panel_chartType.add(scrollPane, gbc_table);
+	
+		
+		GridBagConstraints gbc_addButton = new GridBagConstraints();
+		gbc_addButton.anchor = GridBagConstraints.EAST;
+		gbc_addButton.insets = new Insets(0, 0, 5, 0);
+		gbc_addButton.gridx = 2;
+		gbc_addButton.gridy = 0;
+		panel_chartType.add(getAddButton(), gbc_addButton);
+
+		GridBagConstraints gbc_deleteButton = new GridBagConstraints();
+		gbc_deleteButton.anchor = GridBagConstraints.NORTHEAST;
+		gbc_deleteButton.gridx = 2;
+		gbc_deleteButton.gridy = 2;
+		panel_chartType.add(getDeleteButton(), gbc_deleteButton);
+		
+		return panel_chartType;
+	
+	}
+    
+    private void createJTable(){
+    	table = new JTable();
+		table.setBackground(Color.white);
+    	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+		table.setColumnModel(getColumnModel());
+		
+		table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
+	        public void valueChanged(ListSelectionEvent event) {
+	            setCurrentIndex(table.getSelectedRow());
+                    setCurrentCol(table.getSelectedColumn());
+	        }
+	    });
+		
+		this.tableModel = new DynObjectListTableModel(this.values, this.definition.getElementsType());
+		table.setModel(tableModel);
+    }
+    
+    public static class DynObjectListTableModel implements TableModel{
+    	
+    	private List<DynObject> values;
+		private DynStruct definition;
+		private List<TableModelListener> listeners;
+		private DynField[] fields;
+
+		public DynObjectListTableModel(List<DynObject> objs, DynStruct struct) {
+			this.values = objs;
+    		this.definition = struct;
+    		fields = this.definition.getDynFields();
+    		Arrays.sort(fields, new Comparator<DynField>() {
+    			public int compare(DynField o1, DynField o2) {
+    				return o1.getOder() - o2.getOder();
+    			};
+			});
+    		this.listeners = new ArrayList<TableModelListener>();
+    	}
+
+		public void setValues(List objs) {
+			this.values = objs;
+			fireTableChangeEvent(-1, -1);
+		}
+
+		public void addTableModelListener(TableModelListener arg0) {
+			listeners.add(arg0);
+		}
+
+		public Class<?> getColumnClass(int arg0) {
+			DynField field = this.fields[arg0];
+			return field.getDataType().getDefaultClass();
+		}
+
+		public int getColumnCount() {
+			return this.fields.length;
+		}
+
+		public String getColumnName(int index) {
+			return this.fields[index].getName();
+		}
+
+		public int getRowCount() {
+			if(this.values == null){
+				return 0;
+			}
+			return this.values.size();
+		}
+
+		public Object getValueAt(int row, int col) {
+			if(this.values == null){
+				return null;
+			}
+			DynObject value = this.values.get(row);
+			String colName = this.getColumnName(col);
+			return value.getDynValue(colName);
+		}
+
+		public boolean isCellEditable(int arg0, int arg1) {
+			return true;
+		}
+
+		public void removeTableModelListener(TableModelListener arg0) {
+			this.listeners.remove(arg0);
+		}
+
+		public void setValueAt(Object arg0, int row, int col) {
+			if(this.values == null){
+				return ;
+			}
+			DynObject value = this.values.get(row);
+			String colName = this.getColumnName(col);
+			value.setDynValue(colName, arg0);
+			fireTableChangeEvent(row, TableModelEvent.UPDATE);
+		}
+
+		public void addNew(){
+			if(this.values == null){
+				return;
+			}
+			DynObject dynobj = ToolsLocator.getDynObjectManager().createDynObject(this.definition);
+			this.values.add(dynobj);
+			fireTableChangeEvent(this.values.size(), TableModelEvent.INSERT);
+		}
+		
+		public void remove(int index){
+			if(this.values == null){
+				return ;
+			}
+			this.values.remove(index);
+			fireTableChangeEvent(index, TableModelEvent.DELETE);
+		}
+		
+		private void fireTableChangeEvent(int row, int type){
+			Iterator<TableModelListener> it = this.listeners.iterator();
+			while(it.hasNext()){
+				TableModelListener listener = (TableModelListener) it.next();
+				TableModelEvent ev = null;
+				if(row < 0){
+					ev = new TableModelEvent(this);
+				}else{
+					ev = new TableModelEvent(this, row, row, TableModelEvent.ALL_COLUMNS, type);
+				}
+				listener.tableChanged(ev);
+			}
+		}
+			
+			
+		
+    }
+	
+	private TableColumnModel getColumnModel() {
+		TableColumnModel colModel = new DefaultTableColumnModel();
+		List<String> names = new ArrayList<String>();
+		
+		for(int i=0; i<this.definition.size(); i++){
+			TableColumn col = new TableColumn();
+			DynFormFieldDefinition field = this.definition.get(i);
+			if( field.getTags().has("dynform.width") ) {
+                            try {
+                                int width = field.getTags().getInt("dynform.width");
+                                col.setMaxWidth(width);
+                            } catch (CoercionException ex) {
+                                // Do nothing
+                            }
+                        }
+			col.setHeaderValue(field.getLabel());
+//			col.setCellRenderer(getDefaultTableCellRenderer(field));
+//			col.setCellEditor(getDefaultTableCellEditor(field));
+			
+			colModel.addColumn(col);
+		}
+		
+		return colModel;
+	}
+
+	private SimpleTableCellEditor getDefaultTableCellEditor(DynFormFieldDefinition field) {
+		return new SimpleTableCellEditor(field, this.getServiceManager());
+	}
+
+	private SimpleTableCellRenderer getDefaultTableCellRenderer(DynFormFieldDefinition field) {
+		return new SimpleTableCellRenderer(field);
+	}
+
+	private JButton getAddButton(){
+		if(addButton == null){
+			addButton = new JButton("");
+			addButton.setIcon(getIcon("dynform-table-add.png"));
+			addButton.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent arg0) {
+					tableModel.addNew();
+					deleteButton.setEnabled(true);
+				}
+			});
+			if(this.values == null){
+				addButton.setEnabled(false);
+			}
+		}
+		return addButton;
+	}
+	
+
+	private Icon getIcon(String fielName){
+		URL url = this.getClass().getClassLoader().getResource("org/gvsig/tools/dynform/services/"+fielName);
+		return new ImageIcon(url);
+	}
+	
+	private JButton getDeleteButton(){
+		if(deleteButton == null){
+			deleteButton = new JButton("");
+			deleteButton.setIcon(getIcon("dynform-table-delete.png"));
+			deleteButton.setEnabled(false);
+			deleteButton.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent arg0) {
+					int index = table.getSelectedRow();
+					if(index >= 0){
+						tableModel.remove(index);
+						if(table.getRowCount() == 0){
+							deleteButton.setEnabled(false);
+						}
+					}
+				}
+			});
+		}
+		return deleteButton;
+	}
+	
+	@Override
+	public void setReadOnly(boolean readOnly) {
+        super.setReadOnly(readOnly);
+        this.table.setEnabled(!readOnly);
+        this.getAddButton().setEnabled(!readOnly);
+        this.getDeleteButton().setEnabled(!readOnly);
+    }
+
+    void setCurrentCol(int col) {
+        this.currentCol = col;
+    }
+    public boolean hasValidValues() {
+        return true;
+    }
+
+    public boolean hasValidValues(List<String> fieldsName) {
+        return true;
+    }
+
+    public List getValues() {
+        TableCellEditor editor = this.table.getCellEditor();
+        if( editor!=null ) {
+            editor.stopCellEditing();
+        }
+        return this.values;
+    }
+   
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellEditor.java	(revision 1235)
@@ -0,0 +1,76 @@
+package org.gvsig.tools.dynform.services.dynformset.simpletable;
+
+import java.awt.Component;
+import java.util.EventObject;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.event.CellEditorListener;
+import javax.swing.table.TableCellEditor;
+
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.service.ServiceException;
+
+public class SimpleTableCellEditor implements TableCellEditor{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4395692366122374800L;
+	private DynFormFieldDefinition field;
+	private JDynFormField editor;
+	private DynFormSPIManager manager;
+
+	public SimpleTableCellEditor(DynFormFieldDefinition field, DynFormSPIManager dynFormSPIManager) {
+		this.manager = dynFormSPIManager;
+		try {
+			this.editor = manager.createJDynFormField(field, null);
+		} catch (ServiceException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		this.field = field;
+	}
+	
+	public boolean isCellEditable(EventObject anEvent) {
+		return field.isReadOnly();
+	}
+
+	public Object getCellEditorValue() {
+		return editor.getValue();
+	}
+
+	public Component getTableCellEditorComponent(JTable table, Object value,
+			boolean isSelected, int row, int column) {
+		return editor.asJComponent();
+	}
+
+	public void addCellEditorListener(CellEditorListener arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void cancelCellEditing() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void removeCellEditorListener(CellEditorListener arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public boolean shouldSelectCell(EventObject arg0) {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean stopCellEditing() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellRenderer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellRenderer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellRenderer.java	(revision 1235)
@@ -0,0 +1,19 @@
+package org.gvsig.tools.dynform.services.dynformset.simpletable;
+
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+
+public class SimpleTableCellRenderer extends DefaultTableCellRenderer {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -1754544950650648344L;
+	private DynFormFieldDefinition field;
+	
+	public SimpleTableCellRenderer(DynFormFieldDefinition field) {
+		this.field = field;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableCellRenderer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSetFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSetFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/simpletable/SimpleTableJDynFormSetFactory.java	(revision 1235)
@@ -0,0 +1,45 @@
+package org.gvsig.tools.dynform.services.dynformset.simpletable;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormSetFactory;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public class SimpleTableJDynFormSetFactory implements JDynFormSetFactory {
+
+    public static final String NAME = "SimpleTable";
+    private DynStruct parametersDefinition = null;
+
+    public String getName() {
+        return NAME;
+    }
+
+    public Service create(DynObject parameters, ServiceManager serviceManager) throws ServiceException {
+        return new SimpleTableJDynFormSet(
+                serviceManager,
+                (DynFormDefinition) parameters.getDynValue("definition")
+        );
+    }
+
+    public DynObject createParameters() {
+        return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+    }
+
+    public void initialize() {
+        if ( this.parametersDefinition == null ) {
+            String serviceName = this.getName();
+            DynObjectManager manager = ToolsLocator.getDynObjectManager();
+            this.parametersDefinition = manager.createDynClass(
+                    serviceName, "Parameters definition SimpleTable JDynFormSet");
+            this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FORMSETDEFINITION)
+                    .setClassOfValue(DynFormDefinition.class).setMandatory(true);
+        }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/BasicDynFormFieldsLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/BasicDynFormFieldsLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/BasicDynFormFieldsLibrary.java	(revision 1235)
@@ -0,0 +1,96 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.services;
+
+import org.gvsig.tools.dynform.DynFormLibrary;
+import org.gvsig.tools.dynform.services.dynformfield.Boolean.JDynFormFieldBooleanFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Byte.JDynFormFieldByteFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Char.JDynFormFieldCharFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Date.JDynFormFieldDateFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Double.JDynFormFieldDoubleFactory;
+import org.gvsig.tools.dynform.services.dynformfield.DynObject.JDynFormFieldDynObjectFactory;
+import org.gvsig.tools.dynform.services.dynformfield.DynObjectList.JDynFormFieldDynObjectListFactory;
+import org.gvsig.tools.dynform.services.dynformfield.File.JDynFormFieldFileFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Float.JDynFormFieldFloatFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Folder.JDynFormFieldFolderFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Integer.JDynFormFieldIntegerFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Long.JDynFormFieldLongFactory;
+import org.gvsig.tools.dynform.services.dynformfield.String.JDynFormFieldStringFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Text.JDynFormFieldTextFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Time.JDynFormFieldTimeFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Timestamp.JDynFormFieldTimestampFactory;
+import org.gvsig.tools.dynform.services.dynformfield.URI.JDynFormFieldURIFactory;
+import org.gvsig.tools.dynform.services.dynformfield.URL.JDynFormFieldURLFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Unknow.JDynFormFieldUnknowFactory;
+import org.gvsig.tools.dynform.services.dynformfield.Version.JDynFormFieldVersionFactory;
+import org.gvsig.tools.dynform.services.dynformset.simpletable.SimpleTableJDynFormSetFactory;
+import org.gvsig.tools.dynform.services.dynformset.subform.SubformJDynFormSetFactory;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+
+public class BasicDynFormFieldsLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsServiceOf(DynFormLibrary.class);
+    }
+
+
+	@Override
+	protected void doInitialize() throws LibraryException {
+	}
+
+	@Override
+	protected void doPostInitialize() throws LibraryException {
+		DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
+		if( manager != null ) {
+			manager.addServiceFactory(new JDynFormFieldUnknowFactory());
+			manager.addServiceFactory(new JDynFormFieldDynObjectFactory());
+			manager.addServiceFactory(new JDynFormFieldDynObjectListFactory());
+			manager.addServiceFactory(new JDynFormFieldDateFactory());
+			manager.addServiceFactory(new JDynFormFieldTimeFactory());
+			manager.addServiceFactory(new JDynFormFieldTimestampFactory());
+			manager.addServiceFactory(new JDynFormFieldBooleanFactory());
+			manager.addServiceFactory(new JDynFormFieldByteFactory());
+			manager.addServiceFactory(new JDynFormFieldLongFactory());
+			manager.addServiceFactory(new JDynFormFieldDoubleFactory());
+			manager.addServiceFactory(new JDynFormFieldIntegerFactory());
+			manager.addServiceFactory(new JDynFormFieldFloatFactory());
+			manager.addServiceFactory(new JDynFormFieldCharFactory());
+			manager.addServiceFactory(new JDynFormFieldStringFactory());
+			manager.addServiceFactory(new JDynFormFieldTextFactory());
+			manager.addServiceFactory(new JDynFormFieldFileFactory());
+			manager.addServiceFactory(new JDynFormFieldFolderFactory());
+			manager.addServiceFactory(new JDynFormFieldURLFactory());
+			manager.addServiceFactory(new JDynFormFieldURIFactory());
+			manager.addServiceFactory(new JDynFormFieldVersionFactory());
+                        
+			manager.addServiceFactory(new SubformJDynFormSetFactory());
+			manager.addServiceFactory(new SimpleTableJDynFormSetFactory());
+		}
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/BasicDynFormFieldsLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/org/gvsig/tools/dynform/services/dynform-table-add.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/org/gvsig/tools/dynform/services/dynform-table-add.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/org/gvsig/tools/dynform/services/dynform-table-delete.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/org/gvsig/tools/dynform/services/dynform-table-delete.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.dynform.services.BasicDynFormFieldsLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/pom.xml	(revision 1235)
@@ -0,0 +1,38 @@
+<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>
+  <parent>
+    <groupId>org.gvsig</groupId>
+    <artifactId>org.gvsig.tools.dynform</artifactId>
+    <version>3.0.57</version>
+  </parent>
+  <artifactId>org.gvsig.tools.dynform.services</artifactId>
+  <name>org.gvsig.tools.dynform.services</name>
+  <description>DynFormFields for basic types</description>
+   <packaging>jar</packaging>
+  <dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.swing.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.spi</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+	        <groupId>net.sf</groupId>
+	        <artifactId>flib-jcalendar</artifactId>
+	    </dependency>
+	</dependencies>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services
___________________________________________________________________
Added: svn:ignore
   + .settings

.classpath

target

.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.dynform.DynFormLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormDefinition.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormDefinition.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormDefinition.java	(revision 1235)
@@ -0,0 +1,77 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.Tags;
+
+@SuppressWarnings("rawtypes")
+public interface DynFormDefinition {
+
+	public String getName();
+	
+        /**
+         * Return the list of groups names ordered,
+         * 
+         * @return list of groups names
+         */
+	public List getGroups();
+	
+	public List getSubgroups(String group);
+	
+	public List getDefinitions();
+
+	public List getDefinitions(String group);
+	
+	public List getDefinitions(String group, String subgroup);
+	
+	public int getGroupOrder(String group);
+	
+	public void setGroupOrder(String group, int order);
+	
+	public void add(DynStruct definition);
+	
+	public DynFormFieldDefinition add(DynField definition);
+	
+	public DynFormFieldDefinition get(String name);
+	
+	public DynFormFieldDefinition get(int index);
+	
+	public void remove(String name);
+	
+	public int size();
+	
+	public Tags getTags();
+
+	public DynObject createElement();
+	
+	public void setElementsType(DynStruct struct);
+
+	public DynStruct getElementsType();
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormDefinition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynForm.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynForm.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynForm.java	(revision 1235)
@@ -0,0 +1,99 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.Action;
+
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.swing.api.Component;
+
+public interface JDynForm extends Component {
+
+	public interface JDynFormListener {
+		public void message(String message);
+                /**
+                 * This event is fired when a field of the form is changed by the user.
+                 * 
+                 * Now this is not yet implemented.
+                 * 
+                 * @param field 
+                 */
+		public void fieldChanged(JDynFormField field);
+	}
+	
+	public static final int USE_PLAIN = 0;
+	public static final int USE_TABS = 1;
+	public static final int USE_SEPARATORS = 2;
+	public static final int USE_TREE = 3;
+	
+	public void setLayoutMode(int layoutMode);
+	public int getLayoutMode();
+	
+	public int getFormWidth();
+	public int getFormHeight();
+	public void setFormSize(int width, int height);
+	
+	public JDynFormField getField(String fieldName);
+        
+        public Collection getShowFields();
+	
+	public DynFormDefinition getDefinition();
+	
+	public void setValues(DynObject values);
+	public void getValues(DynObject values);
+	
+	public Object getValue(String fieldName);
+	public void setValue(String fieldName, Object value);
+	
+	public boolean hasValidValues();
+	public boolean hasValidValues(List<String> fieldsName);
+	
+	public void message();
+	
+	public void message(String msg);
+
+	public void setReadOnly(boolean readOnly);
+	public boolean isReadOnly();
+	
+	public void setShowMessageStatus(boolean showMessageStatus);
+	
+	public boolean isShowMessageStatus();
+	
+	public void setUseScrollBars(boolean usesScrolls);
+	public boolean getUseScrollBars();
+	
+	public boolean isModified();
+	
+	public void addListener(JDynFormListener listener);
+	public void removeListener(JDynFormListener listener);
+	
+	public void addActionToPopupMenu(DataType tipo, String name, Action action);
+	public void addSeparatorToPopupMenu(DataType tipo);
+        
+        public void clear();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynForm.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormManager.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.ServiceException;
+
+public interface DynFormManager extends Manager {
+
+	public DynFormDefinition getDefinition(String name);
+	public DynFormDefinition getDefinition(DynStruct definition);
+	public DynFormDefinition getDefinition(DynObject obj);
+	
+	public JDynForm createJDynForm(DynFormDefinition definition) throws ServiceException;
+	public JDynForm createJDynForm(DynStruct struct) throws ServiceException;
+	public JDynForm createJDynForm(DynObject obj) throws ServiceException;
+	
+        public String getDefaultJDynFormSetName();
+        public void setDefaultJDynFormSetName(String name);
+        
+	public JDynFormSet createJDynFormSet(DynFormDefinition definition) throws ServiceException;
+	public JDynFormSet createJDynFormSet(DynStruct struct) throws ServiceException;
+	public JDynFormSet createJDynFormSet(List data) throws ServiceException;
+	public JDynFormSet createJDynFormSet(DynObjectSet data) throws ServiceException;	
+        
+        public JDynFormSet createJDynFormSet(String type, DynFormDefinition definition) throws ServiceException;
+	public JDynFormSet createJDynFormSet(String type, DynStruct struct) throws ServiceException;
+	public JDynFormSet createJDynFormSet(String type, List data) throws ServiceException;
+	public JDynFormSet createJDynFormSet(String type, DynObjectSet data) throws ServiceException;
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormFieldDefinition.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormFieldDefinition.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormFieldDefinition.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+
+public interface DynFormFieldDefinition extends DynField_v2 {
+
+	public String getGroup();
+	public String getSubgroup();
+	
+	public String getGroups();
+	public String getLabel();
+	
+	public DynField setLabel(String label);
+	public void setGroups(String groups);
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormFieldDefinition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormField.java	(revision 1235)
@@ -0,0 +1,82 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.swing.api.Component;
+
+public interface JDynFormField extends Component, Service {
+	
+	public interface JDynFormFieldListener {
+		public void fieldEnter(JDynFormField field);
+		public void fieldExit(JDynFormField field);
+		public void fieldChanged(JDynFormField field);
+		public void message(JDynFormField field, String message);
+	}
+	
+	public DynFormFieldDefinition getDefinition();
+	
+	public String getName();
+	
+	public String getLabel();
+	
+	public JComponent getJLabel();
+
+	public boolean hasValidValue();
+	
+	public void setValue(Object value);
+	
+	public boolean isModified();
+	
+	/**
+	 * Get the value of field from the form.
+	 * 
+	 * Throw an exception if the value of form is not valid
+	 * for this field.
+	 * 
+	 * @return value of field 
+	 */
+	public Object getValue();
+	
+	public void addListener(JDynFormFieldListener listener);
+	
+	public void removeListener(JDynFormFieldListener listener);
+	
+	public void setReadOnly(boolean readonly);
+	
+	public boolean isReadOnly();
+	
+	public void addActionToPopupMenu(String name, Action action);
+
+	public void addSeparatorToPopupMenu();
+
+	public void fireMessageEvent(String message);
+        
+        public void clear();
+        
+        public JDynForm getForm();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLocator.java	(revision 1235)
@@ -0,0 +1,91 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import org.gvsig.tools.locator.AbstractLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+@SuppressWarnings("rawtypes")
+public class DynFormLocator extends AbstractLocator {
+
+	private static final String LOCATOR_NAME = "DynFormsLocator";
+	
+	public static final String DYNFORM_MANAGER_NAME =
+			"org.gvsig.tools.dynform.manager";
+
+	private static final String DYNFORM_MANAGER_DESCRIPTION =
+			"Persistence Manager of gvSIG";
+	
+	private static final DynFormLocator instance = new DynFormLocator();
+
+	private DynFormLocator() {
+
+	}
+
+	/**
+	 * Return the singleton instance.
+	 * 
+	 * @return the singleton instance
+	 */
+	public static DynFormLocator getInstance() {
+		return instance;
+	}
+
+	public String getLocatorName() {
+		return LOCATOR_NAME;
+	}
+
+	/**
+	 * Return a reference to DynFormManager.
+	 * 
+	 * @return a reference to DynFormManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DynFormManager getDynFormManager()
+			throws LocatorException {
+		return (DynFormManager) getInstance().get(DYNFORM_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the DynFormManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the DynFormManager interface
+	 */
+	public static void registerDynFormManager(Class clazz) {
+		getInstance().register(DYNFORM_MANAGER_NAME,
+				DYNFORM_MANAGER_DESCRIPTION, clazz);
+	}
+
+	public static void registerDefaultDynFormManager(Class clazz) {
+		getInstance().registerDefault(DYNFORM_MANAGER_NAME,
+				DYNFORM_MANAGER_DESCRIPTION, clazz);
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLibrary.java	(revision 1235)
@@ -0,0 +1,54 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+
+public class DynFormLibrary extends AbstractLibrary {
+
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsAPI(DynFormLibrary.class);
+		this.require(ToolsLibrary.class);
+	}
+	
+	protected void doInitialize() throws LibraryException {
+		
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		  // Validate there is any implementation registered.
+        DynFormManager manager = DynFormLocator.getDynFormManager();
+        if (manager == null) {
+            throw new ReferenceNotRegisteredException(
+            		DynFormLocator.DYNFORM_MANAGER_NAME, DynFormLocator
+                    .getInstance());
+        }
+        
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/AbortActionException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/AbortActionException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/AbortActionException.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import org.gvsig.tools.exception.BaseException;
+
+public class AbortActionException extends BaseException {
+
+	/**
+	 * 
+	 */ 
+	private static final long serialVersionUID = 3461167266495124406L;
+
+        protected AbortActionException(String message, String key, long code){
+            super(message, key, code);
+        }
+        
+        protected AbortActionException(String message, Throwable cause, String key, long code) {
+            super(message, cause, key, code);
+        }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/AbortActionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSet.java	(revision 1235)
@@ -0,0 +1,109 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform;
+
+import java.util.List;
+
+import javax.swing.Action;
+
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.Component;
+
+public interface JDynFormSet  extends Component {
+
+	public static final int USE_PLAIN = 0;
+	public static final int USE_TABS = 1;
+	public static final int USE_SEPARATORS = 2;
+
+	public interface JDynFormSetListener {
+		public void formMessage(String message);
+		public void formClose();
+		public void formMovedTo(int currentPosition) throws AbortActionException;
+
+		public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException;
+		public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException;
+		public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException;
+		public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException;
+
+		public void formAfterSave(JDynFormSet dynformSet) throws AbortActionException;
+		public void formAfterNew(JDynFormSet dynformSet) throws AbortActionException;
+		public void formAfterDelete(JDynFormSet dynformSet) throws AbortActionException;
+		public void formAfterSearch(JDynFormSet dynformSet) throws AbortActionException;
+	}
+
+	public void setLayoutMode(int layoutMode);
+	public int getLayoutMode();
+
+	public boolean hasValidValues();
+	public boolean hasValidValues(List<String> fieldsName);
+
+	public void setValues(DynObjectSet values) throws ServiceException;
+	public void setValues(List values) throws ServiceException;
+
+        public List getValues();
+
+	public void message();
+	public void message(String msg);
+
+	public void setReadOnly(boolean readOnly);
+	public boolean isReadOnly();
+
+	public void addListener(JDynFormSetListener listener);
+	public void removeListener(JDynFormSetListener listener);
+
+	public boolean isAutosave();
+	public void setAutosave(boolean autosave);
+
+	public boolean allowUpdate();
+	public boolean allowDelete();
+	public boolean allowNew();
+	public boolean allowSearch();
+	public boolean allowClose();
+
+	public void setAllowUpdate(boolean allowUpdate);
+	public void setAllowDelete(boolean allowDelete);
+	public void setAllowNew(boolean allowNew);
+	public void setAllowSearch(boolean allowSearch);
+	public void setAllowClose(boolean allowClose);
+
+	public void setFormSize(int width, int height);
+
+	public DynObject get(int position);
+	public int getCurrentIndex();
+	public int countValues();
+	public void setCurrentIndex(int index);
+
+	public void addActionToPopupMenu(DataType tipo, String name, Action action);
+	public void addSeparatorToPopupMenu(DataType tipo);
+
+	public void setUseScrollBars(boolean usesScrolls);
+	public boolean getUseScrollBars();
+
+	public void getFormValues(DynObject values);
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/pom.xml	(revision 1235)
@@ -0,0 +1,22 @@
+<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>
+  <packaging>jar</packaging>
+  <artifactId>org.gvsig.tools.dynform.api</artifactId>
+  <name>org.gvsig.tools.dynform.api</name>
+  <description>DynForms API</description>
+  <parent>
+    <groupId>org.gvsig</groupId>
+    <artifactId>org.gvsig.tools.dynform</artifactId>
+    <version>3.0.57</version>
+  </parent>
+  <dependencies>
+  	<dependency>
+  		<groupId>org.gvsig</groupId>
+  		<artifactId>org.gvsig.tools.lib</artifactId>
+  	</dependency>
+  	<dependency>
+  		<groupId>org.gvsig</groupId>
+  		<artifactId>org.gvsig.tools.swing.api</artifactId>
+  	</dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api
___________________________________________________________________
Added: svn:ignore
   + .settings

target

.classpath

.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/pom.xml	(revision 1235)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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.tools.dynform</artifactId>
+	<packaging>pom</packaging>
+	<name>org.gvsig.tools.dynform</name>
+	<description>Add support to DynForms</description>
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>org.gvsig.tools</artifactId>
+		<version>3.0.57</version>
+	</parent>
+
+	<modules>
+		<module>org.gvsig.tools.dynform.api</module>
+		<module>org.gvsig.tools.dynform.spi</module>
+		<module>org.gvsig.tools.dynform.services</module>
+		<module>org.gvsig.tools.dynform.impl</module>
+	</modules>
+</project>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/pom.xml	(revision 1235)
@@ -0,0 +1,35 @@
+<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>
+   <packaging>jar</packaging>
+  <parent>
+    <groupId>org.gvsig</groupId>
+    <artifactId>org.gvsig.tools.dynform</artifactId>
+    <version>3.0.57</version>
+  </parent>
+  <artifactId>org.gvsig.tools.dynform.spi</artifactId>
+  <name>org.gvsig.tools.dynform.spi</name>
+  <description>DynForms SPI</description>
+  
+	<dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.swing.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+                <dependency>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-lang3</artifactId>
+			<scope>compile</scope>
+                </dependency>                
+	</dependencies>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILibrary.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import org.gvsig.tools.dynform.DynFormLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DynFormSPILibrary extends AbstractLibrary {
+
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsServiceOf(DynFormLibrary.class);
+	}
+	
+	protected void doInitialize() throws LibraryException {
+		
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java	(revision 1235)
@@ -0,0 +1,457 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.JViewport;
+import javax.swing.text.JTextComponent;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypes;
+
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"rawtypes", "unchecked"})
+public abstract class AbstractJDynFormField implements JDynFormField{
+
+	protected static final Logger logger = LoggerFactory
+			.getLogger(AbstractJDynFormField.class);
+	
+	private DynFormSPIManager manager = null;
+	private DynFormFieldDefinition definition = null;
+	private JLabel jlabel = null;
+	private JPanel jlabelpanel = null;
+	private Set listeners = null;
+	private JProblemIndicator problemIndicator = null;
+
+	protected DynObject parameters = null;
+	protected JComponent contents = null;
+
+	private boolean readOnly = false;
+	private List customActions;
+	protected boolean emptyToNull = false;
+    private JDynForm form;
+
+
+	public AbstractJDynFormField(DynObject parameters,
+			ServiceManager serviceManager) {
+		this.parameters = parameters;
+		this.manager = (DynFormSPIManager) serviceManager;
+		this.definition = this.getDefinition();
+		this.listeners = new HashSet();
+		this.readOnly = this.definition.isReadOnly();
+		this.problemIndicator = this.manager.createProblemIndicator(this);
+		this.customActions = new ArrayList<Action>();
+	}
+
+	public abstract void initComponent();
+	public abstract Object getAssignedValue();
+
+	public Object getParameterValue() {
+		return this.parameters.getDynValue(DynFormSPIManager.FIELD_VALUE);
+	}
+
+	public JComponent asJComponent() {
+		if (this.contents == null) {
+			this.initComponent();
+			if(!this.customActions.isEmpty()){
+				addPopupComponents();
+			}
+			if( this.readOnly ) {
+				this.setReadOnly(readOnly);
+			}
+		}
+		return this.contents;
+	}
+
+	public String getName() {
+		return this.definition.getName();
+	}
+
+	public String getLabel() {
+		if(definition.getLabel() != null)
+			return definition.getLabel();
+		else
+			return this.getName();
+	}
+
+	public JComponent getJLabel() {
+		if (this.jlabel == null) {
+                        if( getTagValueAsBoolean("dynform.label.empty", false) ) {
+                            this.jlabel = new JLabel("");
+                        } else {
+                            this.jlabel = new JLabel(this.getLabel());
+                        }
+			this.jlabel.setLabelFor(this.contents);
+			if( this.getDefinition().isMandatory() ) {
+				this.jlabel.setForeground(Color.red.darker());
+			}
+			this.jlabelpanel = new JPanel();
+			this.jlabelpanel.setLayout(new BorderLayout());
+			this.jlabelpanel.add(jlabel,BorderLayout.CENTER);
+			this.jlabelpanel.add(problemIndicator.asJComponent(), BorderLayout.LINE_END);
+		}
+		return this.jlabelpanel;
+	}
+
+	public DynFormFieldDefinition getDefinition() {
+		return (DynFormFieldDefinition) this.parameters
+				.getDynValue(DynFormSPIManager.FIELD_FIELDDEFINITION);
+	}
+
+	public Manager getManager() {
+		return this.manager;
+	}
+	
+	public DynFormSPIManager getServiceManager(){
+		return this.manager;
+	}
+
+	public void addListener(JDynFormFieldListener listener) {
+		this.listeners.add(listener);
+	}
+
+	public void removeListener(JDynFormFieldListener listener) {
+		this.listeners.remove(listener);
+	}
+	
+	protected void fireFieldChangedEvent() {
+		Iterator it = this.listeners.iterator();
+		while (it.hasNext()) {
+			JDynFormFieldListener listener = (JDynFormFieldListener) it.next();
+			try {
+				listener.fieldChanged(this);
+			} catch (Exception ex) {
+				logger.info("Error calling listener " + listener.toString()
+						+ "(" + listener.getClass().getName() + ") from "
+						+ this.toString() + "(" + this.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+
+	protected void fireFieldEnterEvent() {
+		Iterator it = this.listeners.iterator();
+		while (it.hasNext()) {
+			JDynFormFieldListener listener = (JDynFormFieldListener) it.next();
+			try {
+				listener.fieldEnter(this);
+			} catch (Exception ex) {
+				logger.info("Error calling listener " + listener.toString()
+						+ "(" + listener.getClass().getName() + ") from "
+						+ this.toString() + "(" + this.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+
+	protected void fireFieldExitEvent() {
+		Iterator it = this.listeners.iterator();
+		while (it.hasNext()) {
+			JDynFormFieldListener listener = (JDynFormFieldListener) it.next();
+			try {
+				listener.fieldExit(this);
+			} catch (Exception ex) {
+				logger.info("Error calling listener " + listener.toString()
+						+ "(" + listener.getClass().getName() + ") from "
+						+ this.toString() + "(" + this.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+	
+	public void fireMessageEvent(String message) {
+		Iterator it = this.listeners.iterator();
+		while (it.hasNext()) {
+			JDynFormFieldListener listener = (JDynFormFieldListener) it.next();
+			try {
+				listener.message(this, message);
+			} catch (Exception ex) {
+				logger.info("Error calling listener " + listener.toString()
+						+ "(" + listener.getClass().getName() + ") from "
+						+ this.toString() + "(" + this.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+
+	public boolean isReadOnly() {
+		return this.readOnly ;
+	}
+	
+	public void setReadOnly(boolean readonly) {
+		// FIXME: Implememtacion por defecto, sobreescribirla en las subclases
+		// segun convenga para cada componente.
+		JTextComponent x = null;
+				
+		this.readOnly = readonly;
+		if(jlabel != null){
+			this.jlabel.setEnabled(!readonly);
+		}
+		if( this.contents != null ) {
+			if( this.contents instanceof JTextComponent ) {
+				x = (JTextComponent) this.contents;
+				x.setEditable(!readonly);
+			} else if( this.contents instanceof JScrollPane ) {
+				try {
+					JViewport port = ((JScrollPane)this.contents).getViewport();
+					x = (JTextComponent)  port.getView();
+					x.setEditable(!readonly);
+				} catch(Exception ex) {
+					this.contents.setEnabled(!readOnly);
+				}
+			} else {
+				this.contents.setEnabled(!readOnly);
+			}
+		}
+	}
+
+	public JProblemIndicator problemIndicator() {
+		return this.problemIndicator;
+	}
+
+	public class IllegalFieldValue extends RuntimeException {
+		
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = -4409236610055983438L;
+
+		public IllegalFieldValue(JDynFormField field, String message) {
+			super("The value of field '"+field.getLabel()+"' is not valid. " + message);
+		}
+	}
+	
+	public String toString() {
+		return super.toString() + "{" + this.getName() + "}";
+	}
+	
+	public boolean isModified() {
+		boolean modified = false;
+		try {
+			if( !this.isReadOnly() ) {
+				Object value = this.getValue();
+				if( value == null ) {
+					if( value != this.getAssignedValue() ) {
+						modified = true;
+					}
+				} else {
+					if( ! value.equals(this.getAssignedValue()) ) {
+						modified = true;
+					}
+				}
+			}
+		} catch(IllegalFieldValue ex) {
+			// Si es incorrecto el valor del campo decimos a capom que esta modificado.
+			modified = true;
+		}
+		return modified;
+	}
+	
+	private void addPopupComponents(){
+		Iterator it = this.customActions.iterator();
+		while(it.hasNext()){
+			Object obj = it.next();
+			if(obj!=null){
+				Action act = (Action) obj;
+				if(contents instanceof SupportPopupMenu) {
+					DynFormFieldAction sact = new DynFormFieldAction(this, act);
+					((SupportPopupMenu) this.contents).addActionToPopupMenu(
+						sact.getName(), 
+						sact);
+				}
+			}else{
+				if(contents instanceof SupportPopupMenu) {
+					((SupportPopupMenu) this.contents).addSeparatorToPopupMenu();
+				}	
+			}
+			
+		}
+	}
+
+	public void addActionToPopupMenu(String name, Action action) {
+		if(contents != null){
+			if(contents instanceof SupportPopupMenu ) {
+				DynFormFieldAction sact = new DynFormFieldAction(this,action);
+				((SupportPopupMenu) this.contents).addActionToPopupMenu(
+						sact.getName(), 
+						sact);
+			}
+		}else{
+			this.customActions.add(action);
+		}
+	}
+
+	public void addSeparatorToPopupMenu() {
+		if(contents != null){
+			if( contents instanceof SupportPopupMenu ) {
+				((SupportPopupMenu) this.contents).addSeparatorToPopupMenu();
+			}
+		}else{
+			this.customActions.add(null);
+		}
+	}
+	
+	public void setTranslateEmptyToNull(boolean emptyToNull) {
+	  this.emptyToNull = emptyToNull;
+	}
+	
+	public boolean translateEmptyToNull() {
+	  return this.emptyToNull;
+	}
+
+    public void clear() {
+        if( this.contents == null ) {
+            return;
+        }
+        if( this.contents instanceof JTextField ) {
+            Object value = this.getDefinition().getDefaultValue();
+            if( value != null ) {
+                value = value.toString();
+            } else {
+                value = "";
+            }
+            ((JTextField)this.contents).setText((String)value);
+            return;
+        }
+        if( this.contents instanceof JSpinner ) {
+            Object value = this.getDefinition().getDefaultValue();
+            if( value != null ) {
+                value = value.toString();
+            }
+            ((JSpinner)this.contents).setValue(value);
+            return;
+        }
+        if( this.contents instanceof JList ) {
+            ((JList)this.contents).setSelectedIndex(-1);
+            return;
+        }
+        if( this.contents instanceof JComboBox ) {
+            ((JComboBox)this.contents).setSelectedIndex(-1);
+            return;
+        }
+    }
+
+    public void setForm(JDynForm form) {
+        this.form = form;
+    }
+    
+    public JDynForm getForm() {
+        return this.form;
+    }
+
+    protected int getTagValueAsInt(String tagname, int defaultVaue) {
+        return getTagValueAsInt(tagname, null, defaultVaue);
+    }
+
+    protected int getTagValueAsInt(String tagname1, String tagname2, int defaultVaue) {
+        DynField_v2 fielddef = (DynField_v2)this.getDefinition();                
+        String tagname = null;
+        if( fielddef.getTags().has(tagname1) ) {
+            tagname = tagname1;
+        } else if( fielddef.getTags().has(tagname2) ) {
+            tagname = tagname2;
+        } else {
+            return defaultVaue;
+        }
+        try {
+            int value = fielddef.getTags().getInt(tagname);
+            return value;
+        } catch (CoercionException ex) {
+            logger.warn("Can't parse tag '"+tagname+"' as int for field '"+fielddef.getName()+"'.",ex);
+        }
+        return defaultVaue;
+    }
+    
+    protected boolean getTagValueAsBoolean(String tagname, boolean defaultVaue) {
+        return getTagValueAsBoolean(tagname, null, defaultVaue);
+    }
+    
+    protected boolean getTagValueAsBoolean(String tagname1, String tagname2, boolean defaultVaue) {
+        DynField_v2 fielddef = (DynField_v2)this.getDefinition();                
+        String tagname = null;
+        if( fielddef.getTags().has(tagname1) ) {
+            tagname = tagname1;
+        } else if( fielddef.getTags().has(tagname2) ) {
+            tagname = tagname2;
+        } else {
+            return defaultVaue;
+        }
+        try {
+            boolean value = fielddef.getTags().getBoolean(tagname);
+            return value;
+        } catch (CoercionException ex) {
+            logger.warn("Can't parse tag '"+tagname+"' as boolean for field '"+fielddef.getName()+"'.",ex);
+        }
+        return defaultVaue;
+    }
+    
+    protected String getTagValueAsString(String tagname, String defaultVaue) {
+        return getTagValueAsString(tagname, null, defaultVaue);
+    }
+    
+    protected String getTagValueAsString(String tagname1, String tagname2, String defaultVaue) {
+        DynField_v2 fielddef = (DynField_v2)this.getDefinition();                
+        String tagname = null;
+        if( fielddef.getTags().has(tagname1) ) {
+            tagname = tagname1;
+        } else if( fielddef.getTags().has(tagname2) ) {
+            tagname = tagname2;
+        } else {
+            return defaultVaue;
+        }
+        try {
+            String value = (String) fielddef.getTags().get(tagname,DataTypes.STRING);
+            return value;
+        } catch (CoercionException ex) {
+            logger.warn("Can't parse tag '"+tagname+"' as string for field '"+fielddef.getName()+"'.",ex);
+        }
+        return defaultVaue;
+    }
+    
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/DynFormFieldAction.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/DynFormFieldAction.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/DynFormFieldAction.java	(revision 1235)
@@ -0,0 +1,59 @@
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.Action;
+
+import org.gvsig.tools.dynform.JDynFormField;
+
+class DynFormFieldAction implements Action{
+
+	private JDynFormField field;
+	private Action action;
+	
+	public DynFormFieldAction(JDynFormField field, Action act){
+		this.field = field;
+		this.action = act;
+	}
+
+	public Action getAction() {
+		return this.action;
+	}
+
+	public void actionPerformed(ActionEvent arg0) {
+		if(this.field != null)
+			arg0.setSource(this.field);
+		this.getAction().actionPerformed(arg0);
+	}
+
+	public String getName() {
+		return (String) this.getAction().getValue(Action.NAME);
+	}
+
+	public void addPropertyChangeListener(PropertyChangeListener arg0) {
+		this.action.addPropertyChangeListener(arg0);
+	}
+
+	public Object getValue(String arg0) {
+		return this.action.getValue(arg0);
+	}
+
+	public boolean isEnabled() {
+		return this.action.isEnabled();
+	}
+
+	public void putValue(String arg0, Object arg1) {
+		this.action.putValue(arg0,arg1);
+	}
+
+	public void removePropertyChangeListener(PropertyChangeListener arg0) {
+		this.action.removePropertyChangeListener(arg0);
+	}
+
+	public void setEnabled(boolean arg0) {
+		this.action.setEnabled(arg0);
+	}
+
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/DynFormFieldAction.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextArea.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextArea.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextArea.java	(revision 1235)
@@ -0,0 +1,117 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+
+public class JCustomTextArea extends JTextArea implements  SupportPopupMenu {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6180702611660178166L;
+	private JPopupMenu popupMenu = null;
+	private boolean hasEditor = true;
+	private static Color backgroundColor = null; 
+	private String title = null;
+	
+	public JCustomTextArea(String title){
+		this(title, true);
+	}
+	
+	public JCustomTextArea(String title, boolean withEditor){
+		super();
+		this.title = title;
+		this.hasEditor  = withEditor;
+		if( backgroundColor == null ) {
+			backgroundColor = UIManager.getLookAndFeel().getDefaults().getColor("TextField.background");
+		}
+		initComponent();
+	}
+
+	private void initComponent() {
+		this.add(getJPopupMenu());
+		this.setComponentPopupMenu(getJPopupMenu());
+		this.addSeparatorToPopupMenu();
+		DynFormFieldAction sact = new DynFormFieldAction(null, new AbstractAction() {
+			public void actionPerformed(ActionEvent arg0) {
+				toggleWrapMode();
+			}
+		});
+		this.addActionToPopupMenu("Toggle wrap mode", sact);
+	}
+	
+	private void toggleWrapMode() {
+		this.setLineWrap(!this.getLineWrap() );
+	}
+	
+	private void setActionEnabled(String name, boolean enabled) {
+		Action action = this.getActionMap().get(name);
+		if( action != null ) {
+			action.setEnabled(enabled);
+		}
+	}
+	
+	public void setEnabled(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		super.setEnabled(enabled);
+	}
+
+	
+	public void setEditable(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		super.setEditable(enabled);
+		this.setBackground(backgroundColor);
+	}
+	
+	public JPopupMenu getJPopupMenu(){
+		if(this.popupMenu == null){
+			this.popupMenu = DynFormSPILocator.getDynFormSPIManager().createTextFieldPopupMenu(title, this, hasEditor);
+		}
+		return this.popupMenu;
+	}
+	
+	public void addActionToPopupMenu(String name, Action action){
+		if(name != null && !name.isEmpty()){
+			action.putValue(Action.NAME, name);
+		}
+		getJPopupMenu().add(action);
+	}
+	
+	public void addSeparatorToPopupMenu(){
+		getJPopupMenu().addSeparator();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextArea.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomSpinner.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomSpinner.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomSpinner.java	(revision 1235)
@@ -0,0 +1,159 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import javax.swing.JSpinner;
+import javax.swing.text.JTextComponent;
+
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+
+public class JCustomSpinner extends JSpinner{
+
+	/**
+	 *  First approximation to a JSpinner that allows null values.
+	 */
+	private static final long serialVersionUID = -3949965102298015698L;
+	private boolean allowNull = false;
+	private JPopupMenu popupMenu = null;
+	private JTextComponent jtext = null;
+	private String title = null;
+	
+	public JCustomSpinner(String title){
+        super(new CustomSpinnerDateModel());
+        this.title = title;
+        this.allowNull  = false;
+        initComponents();
+    }
+	 
+	public JCustomSpinner(String title, boolean allowNull){
+        super();
+        this.allowNull  = allowNull;
+    }
+	 
+	public void setAllowNull(boolean allow){
+		this.allowNull = allow;
+	}
+	 
+	public boolean allowNull(){
+		return this.allowNull;
+	}
+	private void setActionEnabled(String name, boolean enabled) {
+		Action action = this.getActionMap().get(name);
+		if( action != null ) {
+			action.setEnabled(enabled);
+		}
+	}
+		
+	public void setEnabled(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		super.setEnabled(enabled);
+	}
+	
+	public void setEditable(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		if( this.jtext != null ) {
+			this.jtext.setEditable(enabled); // Parece que esto no funciona
+				// Asi que nos limitaremos a usar setEnabled.
+		}
+		super.setEnabled(enabled);
+	}
+	
+	private void initComponents() {
+        try {
+        	DefaultEditor x = (DefaultEditor) this.getEditor();
+        	this.jtext = x.getTextField();
+        } catch(Exception ex) {
+        	// Do norhing
+        }
+        if( this.jtext != null ) { // Parece que esto no funciona, los menus no se a�aden.
+        	this.add(getJPopupMenu());
+        	this.setComponentPopupMenu(getJPopupMenu());
+        }
+	}
+	
+	public JPopupMenu getJPopupMenu(){
+		if(this.popupMenu == null){
+			this.popupMenu = DynFormSPILocator.getDynFormSPIManager().createTextFieldPopupMenu(title, this.jtext, false);
+		}
+		return this.popupMenu;
+	}
+	
+	public void addActionToPopupMenu(String name, Action action){
+		if(name != null && !name.isEmpty()){
+			action.putValue(Action.NAME, name);
+		}
+		getJPopupMenu().add(action);
+	}
+	
+	public void addSeparatorToPopupMenu(){
+		getJPopupMenu().addSeparator();
+	}			 
+//	 
+//	 private boolean valid = true;
+//
+//		@Override
+//		public void setValue(Object val){
+//			 if (val != null){
+//	            try{
+//	                valid = true;
+//	                super.setValue(val);
+//	                return;
+//	            }
+//	            catch (Exception e){}
+//	        }
+//	        valid = false;
+//		 }
+//		 
+//		@Override
+//		 public Object getValue(){
+//			 if (valid){
+//	            return super.getValue();
+//	        }else{
+//	        	this.setValue(null);
+//	            return null;
+//	        }
+//		 }
+//		 
+//		@Override
+//		 public Object getPreviousValue(){
+//			 if(getValue()==null){
+//				 return null;
+//			 }else{
+//				 return super.getPreviousValue();
+//			 }
+//		 }
+//		 
+//		@Override
+//		 public Object getNextValue(){
+//			 if(getValue()==null){
+//				 return null;
+//			 }else{
+//				 return super.getNextValue();
+//			 }
+//		 }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomSpinner.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldWithValueList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldWithValueList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldWithValueList.java	(revision 1235)
@@ -0,0 +1,214 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+import javax.swing.text.JTextComponent;
+import org.apache.commons.lang3.StringUtils;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField.IllegalFieldValue;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public abstract class AbstractJDynFormFieldWithValueList extends AbstractJDynFormField implements JDynFormField, FocusListener {
+	
+	protected Object assignedValue  = null;
+	
+	public AbstractJDynFormFieldWithValueList(DynObject parameters,
+			ServiceManager serviceManager) {
+		super(parameters, serviceManager);
+		this.assignedValue = this.getParameterValue();
+	}
+
+	public Object getAssignedValue() {
+		return this.assignedValue;
+	}
+
+	protected JTextField getJTextField() {
+		return (JTextField) this.contents;
+	}
+	
+	protected JComboBox getJComboBox() {
+		return (JComboBox) this.contents;
+	}
+		
+	public void initComponent() {
+		DynObjectValueItem[] availableValues = this.getDefinition().getAvailableValues();
+		if( availableValues==null ) {
+			this.contents = new JCustomTextField(this.getLabel());
+			//this.contents.addKeyListener(new KeyAdapterRegEx());
+			this.contents.addFocusListener(this);
+			if( this.getDefinition().isReadOnly() ) {
+				this.getJTextField().setEditable(false);;
+			}
+		} else {
+			this.contents = new JComboBox(availableValues);
+			if( availableValues.length>0 ) {
+				this.getJComboBox().setSelectedIndex(0);
+			}
+			this.contents.addFocusListener(this);
+			if( this.getDefinition().isReadOnly() ) {
+				this.getJComboBox().setEditable(false);
+			}
+		}
+		this.setValue(this.assignedValue);
+	}
+	
+	protected String getValueFromJComponent() {
+		String s = null;
+		if( this.contents instanceof JTextField ) {
+			s = this.getJTextField().getText();
+		} else {
+			int selected =  this.getJComboBox().getSelectedIndex();
+			if( selected <0 ) {
+				s = null;
+			} else {
+				DynObjectValueItem value = (DynObjectValueItem) this.getJComboBox().getModel().getElementAt(selected);
+				s = value.getValue().toString();
+			}
+		}
+                if( StringUtils.isEmpty(s) && this.translateEmptyToNull() ) {
+                    return null;
+                }
+		return s;
+	}
+	
+	public void setValue(Object value) {
+		String s = null;
+		if( value == null ) {
+		  this.setTranslateEmptyToNull(true);
+			value = this.getDefinition().getDefaultValue();
+			if( value == null ) {
+				s = this.getDefaultValue();
+			} else {
+				s = value.toString();
+			}
+		} else {
+		  this.setTranslateEmptyToNull(false);
+			s = value.toString();
+			try {
+				this.getDefinition().validate(value);
+				this.problemIndicator().clear();
+			} catch (DynFieldValidateException e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		if( this.contents instanceof JTextField ) {
+			this.getJTextField().setText(s);
+		} else {
+			DynObjectValueItem item = null; 
+			for(int i = 0; i< this.getJComboBox().getModel().getSize(); i++){
+				item = (DynObjectValueItem) this.getJComboBox().getModel().getElementAt(i);
+				if( item.getValue().equals(value)){
+					break;
+				}
+			}
+			if(item!=null) {
+				this.getJComboBox().getModel().setSelectedItem(item);
+			}
+		}
+		this.assignedValue = value;
+	}
+	
+	/* 
+	 * M�todos espec�ficos de cada tipo de datos
+	 */
+	protected String getDefaultValue(){
+		return "";
+	}
+	
+	public Object getValue() {
+		Object value = null;
+		String s = this.getValueFromJComponent();
+                try {
+                        value = this.getDefinition().coerce(s);
+                } catch (CoercionException e) {
+                        throw new IllegalFieldValue(this,"Can't convert value '"+s+"' to '"+ this.getDefinition().getDataType().getName() + "'.");
+                }
+		this.problemIndicator().clear();
+		return value;
+	}
+	
+	@SuppressWarnings("unused")
+	public boolean hasValidValue() {
+		try {
+			Object value = this.getValue();
+		} catch(Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		fireFieldEnterEvent();
+		this.problemIndicator().restore();
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		if( this.hasValidValue() ) {
+			this.problemIndicator().clear();
+		} else {
+			try {
+				Object value = this.getValue();
+			} catch(Exception e) {
+				this.problemIndicator().set(e.getLocalizedMessage());
+			}
+		}
+		fireFieldExitEvent();
+	}
+	
+	/**
+	 * Este m�todo es por si se quiere a�adir una expresi�n regular al JTextField
+	 * Por defecto, se puede escribir cualquier cosa, pero se puede sobreescribir este
+	 * m�todo en la clase que lo requiera para a�adir restricciones (p.ej: en los num�ricos)
+	 * @return expresi�n regular que filtra el contenido del JTextField
+	 */
+	public String getJTextFieldRegex(){
+		return "[*]";
+	}
+
+	
+	public class KeyAdapterRegEx extends KeyAdapter {
+
+	    /**
+	     * Key released on field.
+	     */
+	    public void keyReleased(KeyEvent e) {
+	        String curText = ((JTextComponent) e.getSource()).getText();
+	        curText = curText.replaceAll(getJTextFieldRegex(), "");
+
+	        ((JTextComponent) e.getSource()).setText(curText);
+	    }
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldWithValueList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/SupportPopupMenu.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/SupportPopupMenu.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/SupportPopupMenu.java	(revision 1235)
@@ -0,0 +1,32 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import javax.swing.Action;
+
+
+public interface SupportPopupMenu {
+	public void addActionToPopupMenu(String name, Action action);
+	public void addSeparatorToPopupMenu();
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/SupportPopupMenu.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JProblemIndicator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JProblemIndicator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JProblemIndicator.java	(revision 1235)
@@ -0,0 +1,34 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import org.gvsig.tools.swing.api.Component;
+
+public interface JProblemIndicator extends Component {
+
+	public void clear() ;
+	public void set(String message) ;
+	public void restore();
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JProblemIndicator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldFactory.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public abstract class AbstractJDynFormFieldFactory implements JDynFormFieldFactory {
+
+	protected String name = null;
+	protected DynStruct parametersDefinition = null;
+	
+	public abstract String getName() ;
+
+	public abstract Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException ;
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
+	}
+
+	public void initialize() {
+		if( this.parametersDefinition == null ) {
+			String serviceName = this.getName();
+    		DynObjectManager manager = ToolsLocator.getDynObjectManager();
+    		this.parametersDefinition = manager.createDynClass(
+    				serviceName, "Parameters definition for file fields in dynamic forms");
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
+				.setClassOfValue(DynField.class).setMandatory(true);
+    		this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormFieldFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/CustomSpinnerDateModel.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/CustomSpinnerDateModel.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/CustomSpinnerDateModel.java	(revision 1235)
@@ -0,0 +1,35 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import javax.swing.SpinnerDateModel;
+
+public class CustomSpinnerDateModel extends SpinnerDateModel{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4389535440347616567L;
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/CustomSpinnerDateModel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextField.java	(revision 1235)
@@ -0,0 +1,107 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.Color;
+
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+
+public class JCustomTextField extends JTextField  implements SupportPopupMenu{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1575097883238348147L;
+	private JPopupMenu popupMenu = null;
+	private boolean hasEditor = true;
+	private String title = null;
+	
+	private static Color backgroundColor = null; 
+	
+	public JCustomTextField(String title){
+		super();
+		if( backgroundColor == null ) {
+			backgroundColor = UIManager.getLookAndFeel().getDefaults().getColor("TextField.background");
+		}
+		this.title = title;
+		initContextMenu();
+	}
+
+	public JCustomTextField(String title, boolean withEditor){
+		super();
+		this.title = title;
+		this.hasEditor   = withEditor;
+		initContextMenu();
+	}
+	
+	private void setActionEnabled(String name, boolean enabled) {
+		Action action = this.getActionMap().get(name);
+		if( action != null ) {
+			action.setEnabled(enabled);
+		}
+	}
+	
+	public void setEnabled(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		super.setEnabled(enabled);
+	}
+
+	
+	public void setEditable(boolean enabled){
+		setActionEnabled("Cut", enabled);
+		setActionEnabled("Paste", enabled);
+		super.setEditable(enabled);
+		this.setBackground(backgroundColor);
+	}
+	
+	private void initContextMenu() {
+		this.add(getJPopupMenu());
+		this.setComponentPopupMenu(getJPopupMenu());
+	}
+	
+	public JPopupMenu getJPopupMenu(){
+		if(this.popupMenu == null){
+			this.popupMenu = DynFormSPILocator.getDynFormSPIManager().createTextFieldPopupMenu(title, this, hasEditor);
+		}
+		return this.popupMenu;
+	}
+	
+	public void addActionToPopupMenu(String name, Action action){
+		if(name != null && !name.isEmpty()){
+			action.putValue(Action.NAME, name);
+		}
+		getJPopupMenu().add(action);
+	}
+	
+	public void addSeparatorToPopupMenu(){
+		getJPopupMenu().addSeparator();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JZoomDialog.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JZoomDialog.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JZoomDialog.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.awt.Dialog;
+
+import javax.swing.JDialog;
+
+public abstract class JZoomDialog extends JDialog {
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 8590635169959772532L;
+
+	public JZoomDialog(String title) {
+		super((Dialog)null, title, true);
+	}
+
+	public abstract String getText();
+	
+	public abstract void setEditable(boolean editable);
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JZoomDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/VisitableSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/VisitableSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/VisitableSet.java	(revision 1235)
@@ -0,0 +1,33 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi.dynformfield;
+
+import java.util.Set;
+
+import org.gvsig.tools.visitor.Visitable;
+
+@SuppressWarnings("rawtypes")
+public interface VisitableSet extends Set, Visitable {
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/VisitableSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DefaultVisitableSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DefaultVisitableSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DefaultVisitableSet.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultVisitableSet extends HashSet implements VisitableSet {
+
+	public static final Logger logger = LoggerFactory.getLogger(DefaultVisitableSet.class);
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5771630108958038764L;
+
+	public void accept(Visitor visitor) throws BaseException {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Object value = it.next();
+			try {
+				visitor.visit(value);
+			} catch (AbortActionException ex) {
+				throw ex;
+			} catch (Exception ex) {
+				logger.info("Error visiting " + value.toString()
+						+ "(" + value.getClass().getName() + ") with "
+						+ visitor.toString() + "(" + visitor.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DefaultVisitableSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormFieldFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormFieldFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormFieldFactory.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import org.gvsig.tools.service.spi.ServiceFactory;
+
+public interface JDynFormFieldFactory extends ServiceFactory {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormFieldFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import javax.swing.JPopupMenu;
+import javax.swing.text.JTextComponent;
+
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.DynFormManager;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator;
+import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public interface DynFormSPIManager extends Manager, ServiceManager {
+
+	public static final String FIELD_FORMSETDEFINITION = "definition";
+	public static final String FIELD_FIELDDEFINITION = "fieldDefinition";
+	public static final String FIELD_VALUE = "value";
+
+	public static final String SERVICE_NAME_PREFIX = "org.gvsig.tools.dynform.field.";
+	
+	public String makeServiceName(int dataType, String className, String subtype);
+	public String makeServiceName(int dataType, String subtype);
+	public String makeServiceName(DataType dataType, String subtype);
+	public String makeServiceName(DataType dataType, String className, String subtype);
+
+	public DynFormManager getDynFormManager();
+	
+	public JZoomDialog createJZoomDialog(String title, String message, String text);
+	public JProblemIndicator createProblemIndicator(JDynFormField field);
+	
+    public JDynFormField createJDynFormField(DynFormFieldDefinition definition,Object value) throws ServiceException  ;
+
+    public JPopupMenu createTextFieldPopupMenu(String title, JTextComponent component, boolean zoom);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynFormSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynFormSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynFormSet.java	(revision 1235)
@@ -0,0 +1,298 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.JDynFormSet;
+import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractJDynFormSet implements JDynFormSet, Service {
+
+    private static final Logger logger = LoggerFactory.getLogger(AbstractJDynFormSet.class);
+
+    protected DynFormSPIManager manager = null;
+    protected DynFormDefinition definition = null;
+
+    protected JComponent contents = null;
+
+    protected List<DynObject> values = null;
+    protected VisitableSet listeners = null;
+    protected boolean readOnly = false;
+
+    protected boolean autosave = true;
+
+    protected int layoutMode = USE_PLAIN;
+
+    protected int formWidth = -1;
+    protected int formHeight = -1;
+
+    protected List<ActionStore> actionsBuffer = new ArrayList<ActionStore>();
+
+    private boolean useScrollBars = true;
+    private boolean _allowUpdate;
+    private boolean _allowDelete;
+    private boolean _allowNew;
+    private boolean _allowSearch;
+    private boolean _allowClose;
+
+    public AbstractJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException {
+        this.manager = (DynFormSPIManager) manager;
+        this.definition = definition;
+        this.listeners = new DefaultVisitableSet();
+    }
+
+    public void addListener(JDynFormSetListener listener) {
+        this.listeners.add(listener);
+    }
+
+    public void removeListener(JDynFormSetListener listener) {
+        this.listeners.remove(listener);
+    }
+
+    protected void fireMessageEvent(final String message) {
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formMessage(message);
+                }
+            });
+
+        } catch (Exception e) {
+            logger.info("Error calling to the form message event.", e);
+        }
+    }
+
+    protected void fireCloseEvent() {
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formClose();
+                }
+            });
+        } catch (Exception e) {
+            logger.info("Error calling to the form close event.", e);
+        }
+    }
+
+    protected void fireFormMovedToEvent(final int position) {
+        try {
+            this.listeners.accept(new Visitor() {
+                public void visit(Object listener) throws VisitCanceledException, BaseException {
+                    ((JDynFormSetListener) listener).formMovedTo(position);
+                }
+            });
+        } catch (Exception e) {
+            logger.info("Error calling to the form moved to event.", e);
+        }
+    }
+
+    public int getLayoutMode() {
+        return this.layoutMode;
+    }
+
+    public void setLayoutMode(int layoutMode) {
+        if ( layoutMode < 0 || layoutMode > USE_SEPARATORS ) {
+            throw new IllegalArgumentException("layoutMode (" + layoutMode + ") out of range. Valid values are 0 .. " + USE_SEPARATORS + ".");
+        }
+        this.layoutMode = layoutMode;
+    }
+
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
+    public boolean isAutosave() {
+        return this.autosave;
+    }
+
+    public void setAutosave(boolean autosave) {
+        this.autosave = autosave;
+    }
+
+    protected int confirmDialog(final String message, final String title, final int optionType,
+            final int messageType) {
+        return JOptionPane.showConfirmDialog(
+                this.contents, message, title, optionType, messageType);
+    }
+
+    public void setFormSize(int width, int height) {
+        this.formHeight = height;
+        this.formWidth = width;
+    }
+
+    public int countValues() {
+        return this.values.size();
+    }
+
+    public void setValues(DynObjectSet values) throws ServiceException {
+        List x = new ArrayList();
+        DisposableIterator it;
+        try {
+            it = values.iterator();
+        } catch (BaseException e) {
+            logger.info("Uf! o se que hacer con este error, lo relanzo sin mas.", e);
+            throw new RuntimeException(e);
+        }
+        while ( it.hasNext() ) {
+            DynObject obj = (DynObject) it.next();
+            if ( obj instanceof org.gvsig.tools.lang.Cloneable ) {
+                try {
+                    obj = (DynObject) ((org.gvsig.tools.lang.Cloneable) obj).clone();
+                } catch (CloneNotSupportedException e) {
+                    // Do nothing
+                }
+            }
+            x.add(obj);
+        }
+        this.values = x;
+    }
+
+    public void setValues(List values) throws ServiceException {
+//        this.values = new ArrayList<DynObject>();
+//        this.values.addAll(values);
+        this.values = values;
+    }
+
+    public DynObject get(int position) {
+        return (DynObject) this.values.get(position);
+    }
+
+    public void addActionToPopupMenu(DataType tipo, String name, Action action) {
+        try {
+            this.actionsBuffer.add(new ActionStore(tipo, name, action));
+        } catch (Exception ex) {
+            String s = (tipo == null) ? "(null)" : tipo.getName();
+            logger.warn("Can't add popup menu '" + name + "' to the fields of type '" + s + "' of the form.", ex);
+        }
+    }
+
+    public void addSeparatorToPopupMenu(DataType tipo) {
+        try {
+            this.actionsBuffer.add(new ActionStore(tipo));
+        } catch (Exception ex) {
+            String s = (tipo == null) ? "(null)" : tipo.getName();
+            logger.warn("Can't add separator to the popup menu to the fields of type '" + s + "' of the form.", ex);
+        }
+
+    }
+
+    public void setUseScrollBars(boolean usesScrolls) {
+        this.useScrollBars = usesScrolls;
+    }
+
+    public boolean getUseScrollBars() {
+        return useScrollBars;
+    }
+
+    public Manager getManager() {
+        return this.manager;
+    }
+
+    public DynFormSPIManager getServiceManager() {
+        return this.manager;
+    }
+
+    public void message() {
+        // Do nothing, ignore message handling
+    }
+
+    public void message(String msg) {
+        // Do nothing, ignore message handling
+    }
+
+    public boolean allowUpdate() {
+        return this._allowUpdate;
+    }
+
+    public boolean allowClose() {
+        return this._allowClose;
+    }
+
+    public boolean allowDelete() {
+        return this._allowDelete;
+    }
+
+    public boolean allowNew() {
+        return this._allowNew ;
+    }
+
+    public boolean allowSearch() {
+        return this._allowSearch;
+    }
+
+    public void setAllowUpdate(boolean allowUpdate) {
+        this._allowUpdate = allowUpdate;
+    }
+
+    public void setAllowDelete(boolean allowDelete) {
+        this._allowDelete = allowDelete;
+    }
+
+    public void setAllowNew(boolean allowNew) {
+        this._allowNew = allowNew;
+    }
+
+    public void setAllowSearch(boolean allowSearch) {
+        this._allowSearch = allowSearch;
+    }
+
+    public void setAllowClose(boolean allowClose) {
+        this._allowClose = allowClose;
+    }
+
+    public void getFormValues(DynObject values) {
+        throw new UnsupportedOperationException();
+    }
+
+    protected int getTagValueAsInt(String tagname, int defaultVaue) {
+        if( definition.getTags().has(tagname) ) {
+            try {
+                int value = definition.getTags().getInt(tagname);
+                return value;
+            } catch (CoercionException ex) {
+                logger.warn("Can't parse tag '"+tagname+"' as int for text field '"+definition.getName()+"'.",ex);
+            }
+        }
+        return defaultVaue;
+    }
+
+    protected boolean getTagValueAsBoolean(String tagname, boolean defaultVaue) {
+        if( definition.getTags().has(tagname) ) {
+            try {
+                boolean value = definition.getTags().getBoolean(tagname);
+                return value;
+            } catch (CoercionException ex) {
+                logger.warn("Can't parse tag '"+tagname+"' as boolean for text field '"+definition.getName()+"'.",ex);
+            }
+        }
+        return defaultVaue;
+    }
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/ActionStore.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/ActionStore.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/ActionStore.java	(revision 1235)
@@ -0,0 +1,39 @@
+package org.gvsig.tools.dynform.spi;
+
+import javax.swing.Action;
+
+import org.gvsig.tools.dataTypes.DataType;
+
+public class ActionStore{
+	private DataType tipo;
+	private String name;
+	private Action action;
+	private boolean isSeparator = false;
+	
+	public ActionStore(DataType tipo,String name, Action action){
+		this.tipo = tipo;
+		this.name = name;
+		this.action = action;
+	}
+	
+	public ActionStore(DataType tipo){
+		this.tipo = tipo;
+		this.isSeparator = true;
+	}
+	
+	public DataType getDataType(){
+		return tipo;
+	}
+	
+	public String getActionName(){
+		return name;
+	}
+	
+	public Action getAction(){
+		return action;
+	}
+	
+	public boolean isSeparator(){
+		return isSeparator;
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/ActionStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormSetFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormSetFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormSetFactory.java	(revision 1235)
@@ -0,0 +1,9 @@
+
+package org.gvsig.tools.dynform.spi;
+
+import org.gvsig.tools.service.spi.ServiceFactory;
+
+
+public interface JDynFormSetFactory extends ServiceFactory {
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILocator.java	(revision 1235)
@@ -0,0 +1,91 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.spi;
+
+import org.gvsig.tools.locator.AbstractLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+@SuppressWarnings("rawtypes")
+public class DynFormSPILocator extends AbstractLocator {
+
+	private static final String LOCATOR_NAME = "DynFormsSPILocator";
+	
+	public static final String DYNFORM_SPI_MANAGER_NAME =
+			"org.gvsig.tools.dynform.spi.manager";
+
+	private static final String DYNFORM_SPI_MANAGER_DESCRIPTION =
+			"SPI manager for gvSIG's DynForms";
+	
+	private static final DynFormSPILocator instance = new DynFormSPILocator();
+
+	private DynFormSPILocator() {
+
+	}
+
+	/**
+	 * Return the singleton instance.
+	 * 
+	 * @return the singleton instance
+	 */
+	public static DynFormSPILocator getInstance() {
+		return instance;
+	}
+
+	public String getLocatorName() {
+		return LOCATOR_NAME;
+	}
+
+	/**
+	 * Return a reference to DynFormManager.
+	 * 
+	 * @return a reference to DynFormManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DynFormSPIManager getDynFormSPIManager()
+			throws LocatorException {
+		return (DynFormSPIManager) getInstance().get(DYNFORM_SPI_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the DynFormManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the DynFormManager interface
+	 */
+	public static void registerDynFormSPIManager(Class clazz) {
+		getInstance().register(DYNFORM_SPI_MANAGER_NAME,
+				DYNFORM_SPI_MANAGER_DESCRIPTION, clazz);
+	}
+
+	public static void registerDefaultDynFormSPIManager(Class clazz) {
+		getInstance().registerDefault(DYNFORM_SPI_MANAGER_NAME,
+				DYNFORM_SPI_MANAGER_DESCRIPTION, clazz);
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.dynform.spi.DynFormSPILibrary
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi
___________________________________________________________________
Added: svn:ignore
   + target

.classpath

.settings

.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Test.java	(revision 1235)
@@ -0,0 +1,261 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.main;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+
+import org.apache.log4j.PropertyConfigurator;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.DynFormLibrary;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.DynFormManager;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynFormSet;
+import org.gvsig.tools.dynform.JDynFormSet.JDynFormSetListener;
+import org.gvsig.tools.dynform.impl.DefaultDynFormLibrary;
+import org.gvsig.tools.dynform.services.BasicDynFormFieldsLibrary;
+import org.gvsig.tools.dynform.spi.DynFormSPILibrary;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.ServiceException;
+
+import com.jgoodies.looks.plastic.PlasticLookAndFeel;
+import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
+
+@SuppressWarnings("rawtypes")
+public class Test {
+
+	Map definitions = null;
+	DynFormManager manager = null;
+	DynObjectManager dynObjectManager = null;
+	
+	public int contador = 1;
+	private JDynFormSet form;
+	
+	public static void main(String[] args) throws Exception {
+		URL config = Test.class.getClassLoader().getResource("org/gvsig/tools/dynform/main/log4j.properties");
+		PropertyConfigurator.configure(config);
+		Test t = new Test();
+		t.doMain(args);
+	}
+
+	private DynStruct loadStruct() throws Exception {
+		dynObjectManager = ToolsLocator.getDynObjectManager();
+		InputStream resource = this.getClass().getClassLoader().getResourceAsStream("org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm2.xml");
+		definitions = dynObjectManager.importDynClassDefinitions(resource, this.getClass().getClassLoader());
+		return (DynStruct) definitions.get("MapserverLayerPropertiesForm");
+	}
+	
+	public void doMain(String[] args) throws Exception {
+		PlasticLookAndFeel laf = new PlasticXPLookAndFeel();
+		UIManager.setLookAndFeel(laf);
+		
+		new ToolsLibrary().initialize();
+		new DynFormLibrary().initialize();
+		new DefaultDynFormLibrary().initialize();
+		new DynFormSPILibrary().initialize();
+		new BasicDynFormFieldsLibrary().initialize();
+		
+		new ToolsLibrary().postInitialize();
+		new DynFormLibrary().postInitialize();
+		new DefaultDynFormLibrary().postInitialize();
+		new DynFormSPILibrary().postInitialize();
+		new BasicDynFormFieldsLibrary().postInitialize();
+		
+		DynStruct struct = loadStruct();
+		manager = DynFormLocator.getDynFormManager();
+
+		List data = this.createSet(struct);
+		//showForm("DynForms1", data, false, JDynForm.USE_TABS);
+                showForm("DynForms2", data, false, JDynForm.USE_TABS);
+		//showForm("DynForms2-readonly", data, true, JDynForm.USE_SEPARATORS);
+		//showFormPackageInfo();
+
+	}
+	
+	private void showForm(String title, List data, boolean readonly, int layoutMode) throws ServiceException {
+		final JFrame frame = new JFrame(title);
+		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+		form = manager.createJDynFormSet(data);
+		
+
+		Action helloWorld = new AbstractAction("Hi World!") {
+			public void actionPerformed(ActionEvent e) {
+				JOptionPane.showMessageDialog(null, "Hola mundo!");
+			}
+		};
+		Action byeWorld = new AbstractAction("Bye World!") {
+			public void actionPerformed(ActionEvent e) {
+				JOptionPane.showMessageDialog(null, "Adeu mundo!");
+			}
+		};
+		form.addSeparatorToPopupMenu(ToolsLocator.getDataTypesManager().getDataType(String.class));
+		form.addActionToPopupMenu(
+				ToolsLocator.getDataTypesManager().getDataType(String.class), 
+				"Hola Mundo!", 
+				helloWorld);
+		form.addActionToPopupMenu(
+				ToolsLocator.getDataTypesManager().getDataType(String.class), 
+				"Adi�s Mundo!", 
+				byeWorld);
+	
+		
+                form.setAllowClose(true);
+		
+		form.setLayoutMode(layoutMode);
+		form.setReadOnly(readonly);
+		form.addListener(new JDynFormSetListener() {
+			public void formMessage(String message) {
+				System.out.println("formMessage "+message);
+			}
+			public void formClose(){
+				frame.setVisible(false);
+                                System.out.println("Closing form...");
+                                List values = form.getValues();
+                                DynObject data = (DynObject) values.get(form.getCurrentIndex());
+                                List metadata2s = (List) data.getDynValue("Metadata2");
+                                if( metadata2s.isEmpty() ) {
+                                    System.out.println("metadatas is empty");
+                                } else {
+                                    DynObject matadata = (DynObject) metadata2s.get(0);
+                                    System.out.println("key="+matadata.getDynValue("key"));
+                                    System.out.println("value="+matadata.getDynValue("value"));
+                                }
+				System.out.println("formClose");
+			}
+			public void formMovedTo(int currentPosition){
+				System.out.println("formMovedTo "+currentPosition);
+			}
+			public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException {
+				System.out.println("formBeforeSave");
+			}
+			public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException {
+				System.out.println("formBeforeNew");
+			}
+			public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException {
+				System.out.println("formBeforeDelete");
+			}
+			public void formAfterSave(JDynFormSet dynformSet) {
+				System.out.println("formAfterSave");
+			}
+			public void formAfterNew(JDynFormSet dynformSet) {
+				System.out.println("formAfterNew");
+			}
+			public void formAfterDelete(JDynFormSet dynformSet) {
+				System.out.println("formAfterDelete");
+			}
+			public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException {
+				System.out.println("formBeforeSearch");
+			}
+			public void formAfterSearch(JDynFormSet dynformSet) {
+				System.out.println("forformAfterSearchmClose");
+			}
+		});
+		form.setAllowDelete(true);
+		form.setAllowNew(true);
+		form.setAllowSearch(false);
+		form.setAllowUpdate(true);
+
+		frame.setContentPane(form.asJComponent());
+		
+		
+		form.addSeparatorToPopupMenu(ToolsLocator.getDataTypesManager().getDataType(String.class));
+		Action addMore = new AbstractAction("add_more") {
+			public void actionPerformed(ActionEvent e) {
+				JOptionPane.showMessageDialog(null, "Una entrada m�s a�adida satisfactoriamente!");
+				if(form!=null){
+					Action customAction = new AbstractAction("custom_action") {
+						public void actionPerformed(ActionEvent e) {
+							JOptionPane.showMessageDialog(null, "Hola! Soy la entrada n�" + contador);
+							contador++;
+						}
+					};
+					
+					form.addActionToPopupMenu(
+							ToolsLocator.getDataTypesManager().getDataType(String.class), 
+							"Entrada din�mica n�" + contador, 
+							customAction);
+				}
+			}
+		};
+		form.addActionToPopupMenu(
+				ToolsLocator.getDataTypesManager().getDataType(String.class), 
+				"A�adir m�s...", 
+				addMore);
+		form.addSeparatorToPopupMenu(ToolsLocator.getDataTypesManager().getDataType(String.class));
+
+		form.setFormSize(600, 300);
+		
+		form.setCurrentIndex(1);
+		
+		frame.pack();
+		frame.setVisible(true);
+	}
+	
+	private void showFormPackageInfo() throws ServiceException {
+		final JFrame frame = new JFrame("Package info");
+		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+		JDynForm form = manager.createJDynForm((DynStruct)definitions.get("FormPackageinfo"));
+		form.setLayoutMode(JDynForm.USE_SEPARATORS);
+		form.setReadOnly(false);
+		frame.setContentPane(form.asJComponent());
+
+		form.setFormSize(600, 300);
+		
+		frame.pack();
+		frame.setVisible(true);
+	}
+	
+	public List createSet(DynStruct struct) {
+		List values = new ArrayList();
+		for( int i=1; i<4; i++ ) {
+			DynObject value = dynObjectManager.createDynObject(struct);
+//			value.setDynValue("ProviderName", "proveedor-" + i);
+//			value.setDynValue("Entero", i*10);
+//			value.setDynValue("Encoding", "UTF-8");
+			values.add(value);
+		}
+		return values;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/dynobjectmetadata.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/dynobjectmetadata.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/dynobjectmetadata.java	(revision 1235)
@@ -0,0 +1,28 @@
+
+
+package org.gvsig.tools.dynform.main;
+
+ 
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+ 
+@Documented
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface dynobjectmetadata{
+    String type() default "";
+    String subtype() default "";
+    String description() default "";
+    String label() default "";
+    boolean mandatory() default false;
+    String defaultValue() default "";
+    boolean readonly() default false;
+    int order() default -1;
+    String group() default "";
+//    String name() default "";
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynObjectProxy.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynObjectProxy.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynObjectProxy.java	(revision 1235)
@@ -0,0 +1,221 @@
+package org.gvsig.tools.dynform.main;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+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.dynobject.impl.DefaultDynObject;
+
+public class DynObjectProxy implements DynObject {
+
+    private DynClass dynClass;
+    private Object obj;
+    private Class<? extends Object> theClass;
+    private Map fields = null;
+    private Map getters = null;
+    private Map setters = null;
+    private Map coercions = null;
+
+    public DynObjectProxy(DynClass dynClass, Object obj) {
+        this.dynClass = dynClass;
+        this.theClass = obj.getClass();
+        this.obj = obj;
+        this.fields = new HashMap();
+        this.getters = new HashMap();
+        this.setters = new HashMap();
+        this.coercions = new HashMap();
+    }
+
+    public DynClass getDynClass() {
+        return this.dynClass;
+    }
+
+    private DynObjectManager getManager() {
+        return ToolsLocator.getDynObjectManager();
+    }
+    
+    private DataTypesManager getDataTypesManager() {
+        return ToolsLocator.getDataTypesManager();
+    }
+    
+    private Object coerce(Object value, Class type) {
+        
+        Coercion coercion = (Coercion) this.coercions.get(type);
+        if( coercion == null ) {
+            DataType dataType = getDataTypesManager().getDataType(type);
+            if( dataType != null ) {
+                coercion = dataType.getCoercion();
+                this.coercions.put(type, coercion);
+            }
+        }
+        if( coercion != null ) {
+            try {
+                value = coercion.coerce(value);
+            } catch (CoercionException ex) {
+                // Do nothing
+            }
+        }
+        return value;
+    }
+    
+    private Field getField(String name) {
+        Field field = (Field) this.fields.get(name);
+        if ( field == null ) {
+            Field[] fields = this.theClass.getFields();
+            for ( int i = 0; i < fields.length; i++ ) {
+                if ( fields[i].getName().equals(name) ) {
+                    field = fields[i];
+                    this.fields.put(name, field);
+                    break;
+                }
+            }
+        }
+        return field;
+    }
+
+    private Method getGetter(String name) {
+        Method method = (Method) this.getters.get(name);
+        if ( method == null ) {
+            String gettername = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
+            Method[] methods = this.theClass.getMethods();
+            for ( int i = 0; i < methods.length; i++ ) {
+                if ( methods[i].getName().equals(gettername) ) {
+                    method = methods[i];
+                    this.getters.put(name, method);
+                    break;
+                }
+            }
+        }
+        return method;
+    }
+
+    private Method getSetter(String name) {
+        Method method = (Method) this.setters.get(name);
+        if ( method == null ) {
+            String settername = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
+            Method[] methods = this.theClass.getMethods();
+            for ( int i = 0; i < methods.length; i++ ) {
+                if ( methods[i].getName().equals(settername) ) {
+                    method = methods[i];
+                    this.setters.put(name, method);
+                    break;
+                }
+            }
+        }
+        return method;
+    }
+
+    public void implement(DynClass dynClass) {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    public void delegate(DynObject dynObject) {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        Object r = null;
+        Field field = this.getField(name);
+        if ( field != null ) {
+            try {
+                r = field.get(this.obj);
+            } catch (IllegalArgumentException ex) {
+                throw new RuntimeException("Can't get value to field '"+name+"'.",ex);
+            } catch (IllegalAccessException ex) {
+                throw new RuntimeException("Can't get value to field '"+name+"'.",ex);
+            }
+        }
+        if ( r == null ) {
+            Method getter = this.getGetter(name);
+            if ( getter != null ) {
+                try {
+                    r = getter.invoke(this.obj);
+                } catch (IllegalAccessException ex) {
+                throw new RuntimeException("Can't get value to field '"+name+"'.",ex);
+                } catch (IllegalArgumentException ex) {
+                throw new RuntimeException("Can't get value to field '"+name+"'.",ex);
+                } catch (InvocationTargetException ex) {
+                    throw new RuntimeException();
+                }
+            }
+        }
+        if ( r != null ) {
+            DynClass dynClass = getManager().get(r.getClass().getName());
+            if( dynClass!=null ) {
+                r = new DynObjectProxy(dynClass, r);
+            }
+        }
+        return r;
+    }
+
+    public void setDynValue(String name, Object value) throws DynFieldNotFoundException {
+        Field field = this.getField(name);
+        if ( field != null ) {
+            try {
+                Class<?> type = field.getType();
+                field.set(this.obj, coerce(value,type));
+            } catch (IllegalArgumentException ex) {
+                throw new RuntimeException("Can't set value to field '"+name+"'.",ex);
+            } catch (IllegalAccessException ex) {
+                throw new RuntimeException("Can't set value to field '"+name+"'.",ex);
+            }
+        }
+        Method setter = this.getSetter(name);
+        if ( setter != null ) {
+            try {
+                Class<?> type = setter.getParameterTypes()[0];
+                setter.invoke(this.obj, coerce(value,type));
+            } catch (IllegalAccessException ex) {
+                throw new RuntimeException("Can't set value to field '"+name+"'.",ex);
+            } catch (IllegalArgumentException ex) {
+                throw new RuntimeException("Can't set value to field '"+name+"'.",ex);
+            } catch (InvocationTargetException ex) {
+                throw new RuntimeException("Can't set value to field '"+name+"'.",ex);
+            }
+        }
+    }
+
+    public boolean hasDynValue(String name) {
+        Field field = this.getField(name);
+        if ( field != null ) {
+            return true;
+        }
+        Method setter = this.getSetter(name);
+        if ( setter != null ) {
+            return true;
+        }
+        return false;
+    }
+
+    public Object invokeDynMethod(String name, DynObject context) throws DynMethodException {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    public Object invokeDynMethod(int code, DynObject context) throws DynMethodException {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    public void clear() {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    @Override
+    public String toString() {
+        return DefaultDynObject.toString(this);
+    }
+    
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynObjectProxy.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynObjectProxy.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynObjectProxy.java	(revision 1235)
@@ -0,0 +1,37 @@
+package org.gvsig.tools.dynform.main;
+
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class TestDynObjectProxy  {
+
+    public static void main(String[] args) {
+        new ToolsLibrary().initialize();
+        new ToolsLibrary().postInitialize();
+
+        DynClassBuilder builder = new DynClassBuilder();
+
+        Person person = new Person("Joaquin");
+        DynClass dynClass = builder.createDynClass(person);
+        builder.addAllClasses();
+        
+        System.out.println(dynClass);
+        
+        DynObject person2 = new DynObjectProxy(dynClass, person);
+        
+        System.out.println("name:"+person2.getDynValue("name"));
+        System.out.println("address:"+person2.getDynValue("address"));
+        System.out.println("phone:"+person2.getDynValue("phone"));
+        
+        person2.setDynValue("phone", "nuevo1234");
+        DynObject address = (DynObject)person2.getDynValue("address");
+        address.setDynValue("streetName", "nuevoCalle del pez");
+        address.setDynValue("policyNumber", 123);
+        
+        System.out.println("name:"+person.getName());
+        System.out.println("address:"+person.address);
+        System.out.println("phone:"+person.getPhone());
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Person.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Person.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Person.java	(revision 1235)
@@ -0,0 +1,64 @@
+package org.gvsig.tools.dynform.main;
+
+import java.net.URL;
+
+class Person {
+
+    static class Address {
+        @dynobjectmetadata(label="Street")
+        public String streetName;
+        @dynobjectmetadata(label="Policy number")
+        public String policyNumber;
+
+        @Override
+        public String toString() {
+            return streetName + " " + policyNumber;
+        }
+        
+        
+    }
+    
+    private String name;
+    private String phone;
+    protected URL web; 
+
+    @dynobjectmetadata(label="Address", group="Address")
+    public Address address = new Address();
+
+    Person(String name) {
+        this.name = name;
+        this.phone = "1234567890";
+    }
+
+    @dynobjectmetadata(
+            description = "Name",
+            label = "Name",
+            readonly = true,
+            order = 1
+    )
+    public String getName() {
+        return this.name;
+    }
+
+    @dynobjectmetadata(
+            description = "Phone number",
+            label = "Phone number",
+            order = 2
+    )
+    public String getPhone() {
+        return this.phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    @dynobjectmetadata(label="Web URL")
+    public URL getUrl() {
+        return this.web;
+    }
+    
+    public void setUrl(URL url) {
+        this.web = web;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynClassBuilder.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynClassBuilder.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynClassBuilder.java	(revision 1235)
@@ -0,0 +1,204 @@
+package org.gvsig.tools.dynform.main;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.impl.DefaultDynClass;
+import org.gvsig.tools.dynobject.impl.DefaultDynField;
+
+public class DynClassBuilder {
+
+    private Class theClass;
+
+    private DefaultDynClass struct = null;
+    private Map dynClasses = null;
+
+    public DynClassBuilder() {
+        this.dynClasses = new HashMap();
+    }
+
+    private DynObjectManager getManager() {
+        return ToolsLocator.getDynObjectManager();
+    }
+
+    private DefaultDynField getOrCreateDynField(String name) {
+        DefaultDynField dynfield = (DefaultDynField) this.struct.getDynField(name);
+        if ( dynfield == null ) {
+            dynfield = new DefaultDynField(name, DataTypes.UNKNOWN);
+            dynfield = (DefaultDynField) this.struct.addDynField(dynfield);
+        }
+        return dynfield;
+    }
+
+    private dynobjectmetadata getDynobjectMetadata(Annotation[] annotations) {
+        for ( int i = 0; i < annotations.length; i++ ) {
+            Annotation annotation = annotations[i];
+            if ( annotation instanceof dynobjectmetadata ) {
+                return (dynobjectmetadata) annotation;
+            }
+        }
+        return null;
+    }
+
+    private DynField createOrUpdateDynField(String name, Class declaringClass, Annotation[] annotations) {
+        DataType type = null;
+        try {
+            DataTypesManager dataManager = ToolsLocator.getDataTypesManager();
+            type = dataManager.getDataType(declaringClass);
+        } catch (IllegalArgumentException ex) {
+        } catch (Exception ex) {
+
+        }
+        DefaultDynField dynfield = getOrCreateDynField(name);
+
+        if ( dynfield.getType() == DataTypes.UNKNOWN ) {
+            dynfield.setType(type);
+            DynClass declaringDynClass = null;
+            if ( type.getType() == DataTypes.OBJECT ) {
+                declaringDynClass = getManager().get(declaringClass.getName());
+                if ( declaringDynClass == null ) {
+                    declaringDynClass = (DynClass) this.dynClasses.get(declaringClass.getName());
+                }
+                if ( declaringDynClass == null ) {
+                    DynClassBuilder builder = new DynClassBuilder();
+                    declaringDynClass = builder.createDynClass(declaringClass);
+                    this.dynClasses.put(declaringDynClass.getName(), declaringDynClass);
+                }
+                if ( declaringDynClass != null ) {
+                    dynfield.setType(DataTypes.DYNOBJECT);
+                    dynfield.setClassOfValue(declaringDynClass);
+                }
+            }
+        }
+        dynobjectmetadata metadata = this.getDynobjectMetadata(annotations);
+        if ( metadata != null ) {
+            dynfield.setReadOnly(metadata.readonly());
+            dynfield.setMandatory(metadata.mandatory());
+            if ( !StringUtils.isBlank(metadata.label()) ) {
+                dynfield.setLabel(metadata.label());
+            }
+            if ( !StringUtils.isBlank(metadata.description()) ) {
+                dynfield.setDescription(metadata.description());
+            }
+            if ( !StringUtils.isBlank(metadata.subtype()) ) {
+                dynfield.setSubtype(metadata.subtype());
+            }
+            if ( !StringUtils.isBlank(metadata.defaultValue()) ) {
+                dynfield.setDefaultDynValue(metadata.defaultValue());
+            }
+            if ( !StringUtils.isBlank(metadata.group()) ) {
+                dynfield.setGroup(metadata.group());
+            }
+//            if ( !StringUtils.isBlank(metadata.name()) ) {
+//                this.struct.renameField(dynfield.getName(),metadata.name());
+//            }
+            if ( metadata.order() >= 0 ) {
+                dynfield.setOrder(metadata.order());
+            }
+        }
+        return dynfield;
+    }
+
+    private boolean isGetter(Method method) {
+        String name = method.getName();
+        return name.startsWith("get") && Character.isUpperCase(name.charAt(3));
+    }
+
+    private String getAttributeName(Method method) {
+        if ( !isGetter(method) ) {
+            return null;
+        }
+        String name = method.getName();
+        return name.substring(3, 4).toLowerCase() + name.substring(4);
+    }
+
+    private Method getSetter(Method getter) {
+        Method[] methods = this.theClass.getMethods();
+        String setterName = "set" + getter.getName().substring(3);
+        for ( int i = 0; i < methods.length; i++ ) {
+            Method method = methods[i];
+            if ( method.getName().equals(setterName) ) {
+                return method;
+            }
+        }
+        return null;
+    }
+
+    private void createAttributesfOfFields() {
+
+        Field[] fields = theClass.getFields();
+        for ( int i = 0; i < fields.length; i++ ) {
+            Field field = fields[i];
+            DynField dynfield = createOrUpdateDynField(
+                    field.getName(),
+                    field.getType(),
+                    field.getAnnotations()
+            );
+        }
+
+    }
+
+    private void createAttributesOfMethods() {
+        Method[] methods = theClass.getMethods();
+        for ( int i = 0; i < methods.length; i++ ) {
+            Method method = methods[i];
+            if ( isGetter(method) ) {
+                Method setter = getSetter(method);
+                if ( setter != null ) {
+                    createOrUpdateDynField(
+                            getAttributeName(method),
+                            method.getReturnType(),
+                            method.getAnnotations()
+                    );
+                } else {
+                    dynobjectmetadata metadata = this.getDynobjectMetadata(method.getAnnotations());
+                    if ( metadata != null && metadata.readonly() ) {
+                        createOrUpdateDynField(
+                                getAttributeName(method),
+                                method.getReturnType(),
+                                method.getAnnotations()
+                        );
+                    }
+                }
+            }
+        }
+
+    }
+
+    public DynClass createDynClass(Object obj) {
+        return this.createDynClass(obj.getClass());
+    }
+
+    public DynClass createDynClass(Class theClass) {
+        this.theClass = theClass;
+        this.struct = new DefaultDynClass(theClass.getName());
+        this.struct.setLabel(theClass.getCanonicalName());
+        this.dynClasses.put(this.struct.getName(), this.struct);
+
+        this.createAttributesfOfFields();
+        this.createAttributesOfMethods();
+
+        return this.struct;
+    }
+
+    public void addAllClasses() {
+        DynClass dynClass = null;
+        DynObjectManager manager = this.getManager();
+        Iterator it = this.dynClasses.values().iterator();
+        while( it.hasNext() ) {
+            dynClass = (DynClass) it.next();
+            manager.add(dynClass);
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynClassBuilder.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynClassBuilder.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/TestDynClassBuilder.java	(revision 1235)
@@ -0,0 +1,58 @@
+package org.gvsig.tools.dynform.main;
+
+import com.jgoodies.looks.plastic.PlasticLookAndFeel;
+import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
+import javax.swing.JFrame;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.dynform.DynFormLibrary;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.DynFormManager;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.impl.DefaultDynFormLibrary;
+import org.gvsig.tools.dynform.services.BasicDynFormFieldsLibrary;
+import org.gvsig.tools.dynform.spi.DynFormSPILibrary;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynClass_v2;
+import org.gvsig.tools.service.ServiceException;
+
+public class TestDynClassBuilder {
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) throws ServiceException, UnsupportedLookAndFeelException {
+        PlasticLookAndFeel laf = new PlasticXPLookAndFeel();
+        UIManager.setLookAndFeel(laf);
+
+        new ToolsLibrary().initialize();
+        new DynFormLibrary().initialize();
+        new DefaultDynFormLibrary().initialize();
+        new DynFormSPILibrary().initialize();
+        new BasicDynFormFieldsLibrary().initialize();
+
+        new ToolsLibrary().postInitialize();
+        new DynFormLibrary().postInitialize();
+        new DefaultDynFormLibrary().postInitialize();
+        new DynFormSPILibrary().postInitialize();
+        new BasicDynFormFieldsLibrary().postInitialize();
+
+        DynClassBuilder builder = new DynClassBuilder();
+
+        DynClass_v2 dynClass = (DynClass_v2) builder.createDynClass(Person.class);
+        System.out.println(dynClass);
+        
+        DynFormManager manager = DynFormLocator.getDynFormManager();
+        final JFrame frame = new JFrame(dynClass.getLabel());
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        JDynForm form = manager.createJDynForm(dynClass);
+        form.setLayoutMode(JDynForm.USE_SEPARATORS);
+        form.setReadOnly(false);
+        frame.setContentPane(form.asJComponent());
+        form.setFormSize(600, 300);
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java	(revision 1235)
@@ -0,0 +1,263 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.Tags;
+import org.gvsig.tools.dynobject.impl.DefaultTags;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class DefaultDynFormDefinition implements DynFormDefinition {
+
+	private DefaultDynFormManager manager = null;
+	private List fieldsDefinitions = null;
+	private String name = null;
+	private Map groupsOrder = null;
+	private Tags tags = new DefaultTags();
+	private DynStruct elementsType;
+	
+	public DefaultDynFormDefinition(String name, DefaultDynFormManager manager) {
+		this.name  = name; 
+		this.manager = manager;
+		this.fieldsDefinitions = new ArrayList();
+		this.groupsOrder = new HashMap();
+	}
+	
+	public int getGroupOrder(String group) {
+		return ((Integer)this.groupsOrder.get(group)).intValue();
+	}
+	
+	public void setGroupOrder(String group, int order) {
+		this.groupsOrder.put(group, new Integer(order));
+	}
+	
+	public DynFormFieldDefinition add(DynField definition) {
+		DynFormFieldDefinition x = new DefaultDynFormFieldDefinition(this.manager, definition);
+		this.fieldsDefinitions.add(x);
+		Collections.sort(this.fieldsDefinitions, new Comparator<DynField>() {
+			public int compare(DynField o1, DynField o2) {
+				return o1.getOder() - o2.getOder();
+			}
+		});
+		return x;
+	}
+	
+	public String getName() {
+		return this.name;
+	}
+	
+	public void add(DynStruct definition) {
+		DynField[] fields = definition.getDynFields();
+		for( int i=0; i<fields.length; i++ ) {
+			this.add(fields[i]);
+		}
+	}
+	
+	public DynFormFieldDefinition get(String name) {
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			if( def.getName().equalsIgnoreCase(name)) {
+				return def;
+			}
+		}
+		return null;
+	}
+	
+	public DynFormFieldDefinition get(int index) {
+		return (DynFormFieldDefinition) this.fieldsDefinitions.get(index);
+	}
+	
+	public int size() {
+		return this.fieldsDefinitions.size();
+	}
+	
+	public void remove(String name) {
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			if(def.getName().equalsIgnoreCase(name)) {
+				this.fieldsDefinitions.remove(def);
+			}
+		}
+	}
+	
+	public List getGroups() {
+		Set groups = new HashSet();
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			String group = def.getGroup();
+			groups.add(group);
+			if( ! this.groupsOrder.containsKey(group) ) {
+                                if( StringUtils.isEmpty(group) ) {
+                                    this.setGroupOrder(group, -1);
+                                } else {
+                                    this.setGroupOrder(group, def.getOder());
+                                }
+			}
+		}
+		List r = new ArrayList();
+		r.addAll(groups);
+		Collections.sort(r, new Comparator() {
+			public int compare(Object o1, Object o2) {
+				Integer order1 = (Integer) groupsOrder.get(o1);
+				Integer order2 = (Integer) groupsOrder.get(o2);
+				return order1.compareTo(order2);
+			}
+		});
+		return r;
+	}
+
+
+	public List getSubgroups(String group) {
+		if( group == null ) {
+			return Collections.EMPTY_LIST;
+		}
+		Set subgroups = new HashSet();
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			if( group.equalsIgnoreCase(def.getGroup())) {
+				subgroups.add(def.getSubgroup());
+			}
+		}
+		List r = new ArrayList();
+		r.addAll(subgroups);
+		Collections.sort(r);
+		return r;
+	}
+
+	public List getDefinitions() {
+		List r = new ArrayList();
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			r.add(def);
+		}
+		Collections.sort(r, new Comparator() {
+			public int compare(Object o1, Object o2) {
+				DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1;
+				DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2;
+				if( def1.getOder() == def2.getOder() ) {
+					if(def1.getLabel() != null && def2.getLabel() != null)
+						return def1.getLabel().compareToIgnoreCase(def2.getLabel());
+					else{
+						return 0;
+					}
+                } else {
+                    return def1.getOder() > def2.getOder() ? 1 : -1;
+                }
+			};
+		});
+		return r;
+	}
+
+	public List getDefinitions(String group) {
+		List r = new ArrayList();
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			if( group == null ) {
+				if( def.getGroup() == null ) {
+					r.add(def);
+				}
+			} else {
+				if( group.equalsIgnoreCase(def.getGroup())) {
+					r.add(def);
+				}
+			}
+		}
+		Collections.sort(r, new Comparator() {
+			public int compare(Object o1, Object o2) {
+				DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1;
+				DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2;
+				if( def1.getOder() == def2.getOder() ) {
+					return ObjectUtils.compare(def1.getLabel(),def2.getLabel());
+				} else {
+				    return def1.getOder() > def2.getOder() ? 1 : -1;
+				}
+			};
+		});
+		return r;
+	}
+
+	public List getDefinitions(String group, String subgroup) {
+		List r = new ArrayList();
+		Iterator it = this.fieldsDefinitions.iterator();
+		while(it.hasNext()) {
+			DynFormFieldDefinition def = (DynFormFieldDefinition) it.next();
+			if( group.equalsIgnoreCase(def.getGroup()) && subgroup.equalsIgnoreCase(def.getSubgroup())) {
+				r.add(def);
+			}
+		}
+		Collections.sort(r, new Comparator() {
+			public int compare(Object o1, Object o2) {
+				DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1;
+				DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2;
+				if( def1.getOder() == def2.getOder() ) {
+					return def1.getLabel().compareToIgnoreCase(def2.getLabel());
+                } else {
+                    return def1.getOder() > def2.getOder() ? 1 : -1;
+                }
+			};
+		});
+		return r;
+	}
+	
+	public Tags getTags() {
+		return this.tags;
+	}
+
+	public DynObject createElement() {
+		return ToolsLocator.getDynObjectManager().createDynObject(this.elementsType);
+	}
+
+	public void setElementsType(DynStruct struct) {
+		this.elementsType = struct;
+	}
+
+	public DynStruct getElementsType() {
+		return this.elementsType;
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJProblemIndicator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJProblemIndicator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJProblemIndicator.java	(revision 1235)
@@ -0,0 +1,103 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.awt.Cursor;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator;
+import org.gvsig.tools.swing.api.Component;
+
+public class DefaultJProblemIndicator implements Component, JProblemIndicator {
+	private String message = null;
+	private JLabel indicator = null;
+	private ImageIcon okIcon = null;
+	private ImageIcon errorIcon = null;
+	private Cursor defaultCursor = null;
+	private Cursor handCursor = null;
+	private JDynFormField field = null;
+	
+	public DefaultJProblemIndicator(JDynFormField field) {
+		this.field = field;
+	}
+	
+	public JComponent asJComponent() {
+		if( this.indicator == null ) {
+			this.indicator = new JLabel();
+			URL resource = null;
+			resource = this.getClass().getClassLoader().getResource("org/gvsig/tools/dynform/impl/problem.png");
+			if( resource!=null ) {
+				this.errorIcon = new ImageIcon(resource);
+			}
+			resource = this.getClass().getClassLoader().getResource("org/gvsig/tools/dynform/impl/transparent.png");
+			if( resource!=null ) {
+				this.okIcon = new ImageIcon(resource);
+			}
+			this.indicator.setIcon(this.okIcon);
+			
+			this.indicator.addMouseListener(new MouseAdapter()  {
+	            public void mouseClicked(MouseEvent evt) {
+	            	if( message == null ) {
+	            		return;
+	            	}
+		                int count = evt.getClickCount();
+	                if (count == 1) {
+	                    JOptionPane.showMessageDialog(field.asJComponent() ,message,"Status",JOptionPane.INFORMATION_MESSAGE);
+	                }
+	            }
+	        });
+			this.defaultCursor = this.indicator.getCursor();
+			this.handCursor = new Cursor(Cursor.HAND_CURSOR); 
+		}
+		return this.indicator;
+	}
+
+	public void clear() {
+		this.message = null;
+		this.indicator.setToolTipText("");
+		this.indicator.setIcon(this.okIcon);
+		this.indicator.setCursor(this.defaultCursor);
+	}
+	public void set(String message) {
+		this.message = message;
+		this.indicator.setToolTipText(message);
+		this.indicator.setIcon(this.errorIcon);
+		this.indicator.setCursor(this.handCursor);
+		field.fireMessageEvent(this.message);
+	}
+	public void restore() {
+		if( message != null ) {
+			set(message);
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJProblemIndicator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java	(revision 1235)
@@ -0,0 +1,681 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JViewport;
+
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.JDynFormField.JDynFormFieldListener;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.dynformfield.SupportPopupMenu;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.layout.FormLayout;
+import com.jgoodies.forms.layout.RowSpec;
+import java.util.Collection;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
+
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class DefaultJDynForm implements JDynForm, JDynFormFieldListener {
+
+    protected static final Logger logger = LoggerFactory
+            .getLogger(DefaultJDynForm.class);
+
+    private int formWidth = 320;
+    private int formHeight = 540;
+
+    private DefaultDynFormManager manager = null;
+    private DynFormDefinition definition = null;
+    private int layoutMode = USE_PLAIN;
+    private JComponent contents = null;
+    private Map components = null;
+    private JLabel jlabel_messages = null;
+    private boolean readOnly = false;
+    private Set listeners = null;
+    private DynObject values = null;
+    private boolean useScrollBars = true;
+
+    private Map customActions;
+
+    public DefaultJDynForm(DefaultDynFormManager manager, DynFormDefinition definition) throws ServiceException {
+        this.manager = manager;
+        this.definition = definition;
+        this.components = new HashMap();
+        this.listeners = new HashSet();
+        this.customActions = new HashMap<String, List<Action>>();
+        if (definition.getTags().has("LayoutMode")) {
+            try {
+                this.layoutMode = definition.getTags().getInt("LayoutMode");
+            } catch (CoercionException e) {
+                // Ignorada
+            }
+        }
+    }
+
+    public DynFormSPIManager getServiceManager() {
+        return this.manager.getServiceManager();
+    }
+
+    public JComponent asJComponent() {
+        if (this.contents == null) {
+            try {
+                this.initComponents();
+            } catch (ServiceException e) {
+                throw new RuntimeException(e.getLocalizedMessage(), e);
+            }
+        }
+        return this.contents;
+    }
+
+    public void addListener(JDynFormListener listener) {
+        this.listeners.add(listener);
+    }
+
+    public void removeListener(JDynFormListener listener) {
+        this.listeners.remove(listener);
+    }
+
+    protected void fireMessageEvent(String message) {
+        Iterator it = this.listeners.iterator();
+        while (it.hasNext()) {
+            JDynFormListener listener = (JDynFormListener) it.next();
+            try {
+                listener.message(message);
+            } catch (Exception ex) {
+                logger.info("Error calling listener " + listener.toString()
+                        + "(" + listener.getClass().getName() + ") from "
+                        + this.toString() + "(" + this.getClass().getName()
+                        + ").", ex);
+            }
+        }
+    }
+
+    protected void fireFieldChangeEvent(JDynFormField field) {
+        Iterator it = this.listeners.iterator();
+        while (it.hasNext()) {
+            JDynFormListener listener = (JDynFormListener) it.next();
+            try {
+                listener.fieldChanged(field);
+            } catch (Exception ex) {
+                logger.info("Error calling listener " + listener.toString()
+                        + "(" + listener.getClass().getName() + ") from "
+                        + this.toString() + "(" + this.getClass().getName()
+                        + ").", ex);
+            }
+        }
+    }
+
+    public JLabel getMessagesJLabel() {
+        if (this.jlabel_messages == null) {
+            this.jlabel_messages = new JLabel();
+            this.jlabel_messages.addMouseListener(new MouseAdapter() {
+                public void mouseClicked(MouseEvent evt) {
+                    int count = evt.getClickCount();
+                    if (count == 2) {
+                        JOptionPane.showMessageDialog(contents, jlabel_messages.getText(), "Status", JOptionPane.INFORMATION_MESSAGE);
+                    }
+                }
+            });
+        }
+        return this.jlabel_messages;
+    }
+
+    public void setShowMessageStatus(boolean showMessageStatus) {
+        this.getMessagesJLabel().setVisible(showMessageStatus);
+    }
+
+    public boolean isShowMessageStatus() {
+        return this.getMessagesJLabel().isVisible();
+    }
+
+    public void message() {
+        this.getMessagesJLabel().setText(" ");
+    }
+
+    public void message(String msg) {
+        this.getMessagesJLabel().setText(msg);
+        fireMessageEvent(msg);
+    }
+
+    private void initComponents() throws ServiceException {
+        switch (this.layoutMode) {
+            case USE_PLAIN:
+            case USE_TREE:
+            default:
+                initComponentsPlain();
+                break;
+            case USE_TABS:
+                initComponentsUseTabs();
+                break;
+            case USE_SEPARATORS:
+                initComponentsUseSeparators();
+                break;
+        }
+        if (this.values != null) {
+            this.setValues(values);
+        }
+        message();
+    }
+
+    private void initComponentsPlain() throws ServiceException {
+        FormLayout layout = new FormLayout(
+                "left:pref,  8px,  fill:80dlu:grow", "pref");
+
+        DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+        builder.setDefaultRowSpec(new RowSpec(
+                RowSpec.TOP,
+                builder.getLayout().getRowSpec(1).getSize(),
+                builder.getLayout().getRowSpec(1).getResizeWeight()));
+
+        List fields = this.definition.getDefinitions();
+        Iterator it = fields.iterator();
+        while (it.hasNext()) {
+            DynFormFieldDefinition fieldDefinition = (DynFormFieldDefinition) it.next();
+            if (fieldDefinition.isHidden()) {
+                continue;
+            }
+            JDynFormField jfield = getServiceManager().createJDynFormField(fieldDefinition, null);
+            if( jfield instanceof AbstractJDynFormField ) {
+                ((AbstractJDynFormField)jfield).setForm(this);
+            }
+            jfield.setReadOnly(this.readOnly);
+            jfield.addListener(this);
+            if (this.readOnly) {
+                jfield.setReadOnly(readOnly);
+            }
+            builder.append(jfield.getJLabel(), jfield.asJComponent());
+
+            this.components.put(jfield.getName(), jfield);
+        }
+        this.contents = addScrollsAndMessageBar(builder.getPanel());
+    }
+
+    private void initComponentsUseSeparators() throws ServiceException {
+        List groups = this.definition.getGroups();
+
+        FormLayout layout = new FormLayout(
+                "left:pref,  8px,  fill:80dlu:grow", "pref");
+
+        DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+        builder.setDefaultRowSpec(new RowSpec(
+                RowSpec.TOP,
+                builder.getLayout().getRowSpec(1).getSize(),
+                builder.getLayout().getRowSpec(1).getResizeWeight()));
+
+        for (int i = 0; i < groups.size(); i++) {
+            String group = (String) groups.get(i);
+            builder.appendSeparator(group);
+            List fields = this.definition.getDefinitions(group);
+            Iterator it = fields.iterator();
+            while (it.hasNext()) {
+                DynFormFieldDefinition fieldDefinition = (DynFormFieldDefinition) it.next();
+                if (fieldDefinition.isHidden()) {
+                    continue;
+                }
+                JDynFormField jfield = getServiceManager().createJDynFormField(fieldDefinition, null);
+                if( jfield instanceof AbstractJDynFormField ) {
+                    ((AbstractJDynFormField)jfield).setForm(this);
+                }
+                jfield.addListener(this);
+                if (this.readOnly) {
+                    jfield.setReadOnly(readOnly);
+                }
+
+                List<Action> customActions = getCustomFields(fieldDefinition.getDataType());
+
+                if (customActions != null && !customActions.isEmpty()) {
+                    Iterator it2 = customActions.iterator();
+                    while (it2.hasNext()) {
+                        Object obj = it2.next();
+                        if (obj != null) {
+                            Action act = (Action) obj;
+                            jfield.addActionToPopupMenu((String) act.getValue(Action.NAME), act);
+                        } else {
+                            jfield.addSeparatorToPopupMenu();
+                        }
+                    }
+                }
+
+                builder.append(jfield.getJLabel(), jfield.asJComponent());
+
+                this.components.put(jfield.getName(), jfield);
+            }
+        }
+        this.contents = addScrollsAndMessageBar(builder.getPanel());
+    }
+
+    private void initComponentsUseTabs() throws ServiceException {
+
+        JTabbedPane tabbedPane = new JTabbedPane();
+        if (definition.getTags().has("TabPlacement")) {
+            try {
+                tabbedPane.setTabPlacement(definition.getTags().getInt("TabPlacement"));
+            } catch (Exception e) {
+                // Ignorada
+            }
+        }
+        List groups = this.definition.getGroups();
+
+        for (int i = 0; i < groups.size(); i++) {
+            String group = (String) groups.get(i);
+
+            FormLayout layout = new FormLayout(
+                    "left:pref,  8px,  fill:80dlu:grow", "pref");
+
+            DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+            builder.setDefaultRowSpec(new RowSpec(
+                    RowSpec.TOP,
+                    builder.getLayout().getRowSpec(1).getSize(),
+                    builder.getLayout().getRowSpec(1).getResizeWeight()));
+
+            List fields = this.definition.getDefinitions(group);
+            Iterator it = fields.iterator();
+            while (it.hasNext()) {
+                DynFormFieldDefinition fieldDefinition = (DynFormFieldDefinition) it.next();
+                if (fieldDefinition.isHidden()) {
+                    continue;
+                }
+                JDynFormField jfield = getServiceManager().createJDynFormField(fieldDefinition, null);
+                if( jfield instanceof AbstractJDynFormField ) {
+                    ((AbstractJDynFormField)jfield).setForm(this);
+                }
+                jfield.setReadOnly(this.readOnly);
+                jfield.addListener(this);
+                if (this.readOnly) {
+                    jfield.setReadOnly(readOnly);
+                }
+
+                builder.append(jfield.getJLabel(), jfield.asJComponent());
+
+                this.components.put(jfield.getName(), jfield);
+            }
+            String tablabel = group;
+            if (StringUtils.isEmpty(tablabel)) {
+                tablabel = ToolsLocator.getI18nManager().getTranslation("General");
+            }
+            tabbedPane.addTab(tablabel, builder.getPanel());
+        }
+        
+        try {
+            String defaultGroupName = (String) this.definition.getTags().get("defaultGroup", DataTypes.STRING);
+            List<String> groupsNames = this.definition.getGroups();
+            int groupIndex = groupsNames.indexOf(defaultGroupName);
+            if( groupIndex>=0 ) {
+                tabbedPane.setSelectedIndex(groupIndex);
+            }
+        } catch (Exception ex) {
+            // Ignore errors and don't set a tab by default
+        }
+        
+        this.contents = addScrollsAndMessageBar(tabbedPane);
+    }
+
+    private List<Action> getCustomFields(DataType dataType) {
+        return (List<Action>) customActions.get(dataType.getName());
+    }
+
+    private JPanel addScrollsAndMessageBar(JComponent formPanel) {
+        formPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+        JScrollPane scroll = new JScrollPane(formPanel);
+        if (useScrollBars) {
+            scroll.setPreferredSize(new Dimension(formWidth, formHeight));
+        } else {
+            scroll.setPreferredSize(formPanel.getPreferredSize());
+        }
+        scroll.setBorder(BorderFactory.createEmptyBorder());
+
+        JPanel jpanel = new JPanel();
+        jpanel.setLayout(new BorderLayout());
+        jpanel.add(scroll, BorderLayout.CENTER);
+        jpanel.add(getMessagesJLabel(), BorderLayout.PAGE_END);
+
+        return jpanel;
+    }
+
+    public int getLayoutMode() {
+        return this.layoutMode;
+    }
+
+    public void setLayoutMode(int layoutMode) {
+        if (layoutMode < 0 || layoutMode > USE_SEPARATORS) {
+            throw new IllegalArgumentException("layoutMode (" + layoutMode + ") out of range. Valid values are 0 .. " + USE_SEPARATORS + ".");
+        }
+        this.layoutMode = layoutMode;
+    }
+
+    public void setValues(DynObject values) {
+        /*
+         * TODO: Probablemente fuese mas acertado recorrer los controles de
+         * components y a partir de ellos acceder a los valores del DynObject
+         * recivido. Eso permitiria trabajar mejor con herencia de DynObject.
+         * Habria que hacer lo mismo con el getValues. 
+         */
+        if (this.contents == null) {
+            this.values = values;
+            return;
+        }
+        DynClass def = values.getDynClass();
+        DynField[] fields = def.getDynFields();
+        for (int i = 0; i < fields.length; i++) {
+            String name = fields[i].getName();
+            if (name == null || name.isEmpty()) {
+                logger.warn("Field name " + i + " of '" + def.getFullName() + "' is null or empty ");
+                continue;
+            }
+            JDynFormField jfield = (JDynFormField) this.getField(name);
+            if (jfield == null) {
+                logger.warn("Can't retrieve form field asociated to the field '" + name + "' of class '" + def.getFullName() + "'.");
+                continue;
+            }
+            if (values.getDynValue(name) == null) {
+                if (fields[i].getDataType().getType() == DataTypes.LIST) {
+                    try {
+                        if (((DynField_v2) fields[i]).getDynClassOfItems() != null) {
+                            values.setDynValue(name, new ArrayList<DynObject>());
+                        }
+                    } catch (Exception e) {
+                        logger.warn("Problems initializing the DynObject List", e);
+                    }
+                }
+            }
+            jfield.setValue(values.getDynValue(name));
+        }
+    }
+
+    public void getValues(DynObject values) {
+        if (values == null) {
+            return;
+        }
+        DynField[] fields = values.getDynClass().getDynFields();
+        for (int i = 0; i < fields.length; i++) {
+            String name = fields[i].getName();
+            JDynFormField jfield = (JDynFormField) this.getField(name);
+            if (jfield != null) {
+                try {
+                    Object value = jfield.getValue();
+                    values.setDynValue(name, value);
+
+                } catch (Exception ex) {
+                    logger.warn("Can't get value of field '" + name + "'.", ex);
+                }
+            }
+        }
+    }
+
+    public boolean hasValidValues() {
+        Iterator it = this.getFieldsIterator();
+        while (it.hasNext()) {
+            JDynFormField jfield = (JDynFormField) it.next();
+            if (!jfield.hasValidValue()) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    public boolean hasValidValues(List<String> fieldsName) {
+        if (fieldsName == null) {
+            fieldsName = new ArrayList<String>();
+        }
+
+        Iterator it = this.getFieldsIterator();
+        while (it.hasNext()) {
+            JDynFormField jfield = (JDynFormField) it.next();
+            if (!jfield.hasValidValue()) {
+                fieldsName.add(jfield.getName());
+            }
+        }
+
+        if (!fieldsName.isEmpty()) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    public boolean isModified() {
+        Iterator it = this.getFieldsIterator();
+        while (it.hasNext()) {
+            JDynFormField jfield = (JDynFormField) it.next();
+            if (jfield.isModified()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void fieldEnter(JDynFormField field) {
+        message(field.getDefinition().getDescription());
+    }
+
+    public void fieldExit(JDynFormField field) {
+        message();
+    }
+
+    public void message(JDynFormField field, String message) {
+        message(message);
+    }
+
+    public void fieldChanged(JDynFormField field) {
+        fireFieldChangeEvent(field);
+    }
+
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+        if (this.contents != null) {
+            Iterator it = this.getFieldsIterator();
+            while (it.hasNext()) {
+                JDynFormField field = (JDynFormField) it.next();
+                field.setReadOnly(readOnly);
+            }
+        }
+    }
+
+    public int getFormWidth() {
+        if (this.contents == null) {
+            return this.formWidth;
+        } else {
+            JViewport port = ((JScrollPane) this.asJComponent()).getViewport();
+            Component comp = (Component) port.getView();
+            return comp.getWidth();
+        }
+    }
+
+    public int getFormHeight() {
+        if (this.contents == null) {
+            return this.formHeight;
+        } else {
+            JViewport port = ((JScrollPane) this.asJComponent()).getViewport();
+            Component comp = (Component) port.getView();
+            return comp.getHeight();
+        }
+    }
+
+    public void setFormSize(int width, int height) {
+        this.formHeight = height;
+        this.formWidth = width;
+        if (this.contents != null) {
+            this.asJComponent().setPreferredSize(new Dimension(width, height));
+        }
+    }
+
+    public void addActionToPopupMenu(DataType tipo, String name, Action action) {
+        if (this.contents == null) {
+            List<Action> acts = this.getCustomFields(tipo);
+            action.putValue(Action.NAME, name);
+            if (acts == null) {
+                List aux = new ArrayList<Action>();
+                aux.add(action);
+                customActions.put(tipo.getName(), aux);
+            } else {
+                acts.add(action);
+            }
+        } else {
+            Iterator it = this.components.keySet().iterator();
+            while (it.hasNext()) {
+                String key = (String) it.next();
+                Object obj = this.components.get(key);
+                if (obj instanceof JDynFormField) {
+                    JDynFormField field = (JDynFormField) obj;
+                    if (tipo == field.getDefinition().getDataType()) {
+                        if (field.asJComponent() instanceof SupportPopupMenu) {
+                            field.addActionToPopupMenu(
+                                    name,
+                                    action);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public void addSeparatorToPopupMenu(DataType tipo) {
+        if (this.contents == null) {
+            List<Action> acts = this.getCustomFields(tipo);
+            if (acts == null) {
+                List aux = new ArrayList<Action>();
+                aux.add(null);
+                customActions.put(tipo.getName(), aux);
+            } else {
+                acts.add(null);
+            }
+        } else {
+            Iterator it = this.components.keySet().iterator();
+            while (it.hasNext()) {
+                String key = (String) it.next();
+                Object obj = this.components.get(key);
+                if (obj instanceof JDynFormField) {
+                    JDynFormField field = (JDynFormField) obj;
+                    if (tipo == field.getDefinition().getDataType()) {
+                        if (field.asJComponent() instanceof SupportPopupMenu) {
+                            ((SupportPopupMenu) field.asJComponent()).addSeparatorToPopupMenu();
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public Object getValue(String fieldName) {
+        JDynFormField field = (JDynFormField) this.getField(fieldName);
+        return field.getValue();
+    }
+
+    public void setValue(String fieldName, Object value) {
+        JDynFormField field = (JDynFormField) this.getField(fieldName);
+        try {
+            value = field.getDefinition().getDataType().coerce(value);
+        } catch (CoercionException e) {
+            String msg = "Invalid value '" + ((value == null) ? "(null)" : value.toString()) + "' for field '" + fieldName + "'.";
+            logger.warn(msg, e);
+            throw new RuntimeException(msg, e);
+        }
+        field.setValue(value);
+    }
+
+    public JDynFormField getField(String fieldName) {
+        JDynFormField field = (JDynFormField) this.components.get(fieldName);
+        return field;
+    }
+
+    public Iterator getFieldsIterator() {
+        if (this.contents == null) {
+            try {
+                this.initComponents();
+            } catch (ServiceException e) {
+                throw new RuntimeException(e.getLocalizedMessage(), e);
+            }
+        }
+        return this.components.values().iterator();
+    }
+
+    public DynFormDefinition getDefinition() {
+        return this.definition;
+    }
+
+    public void setUseScrollBars(boolean usesScrolls) {
+        this.useScrollBars = usesScrolls;
+    }
+
+    public boolean getUseScrollBars() {
+        return useScrollBars;
+    }
+
+    public void clear() {
+        Iterator it = this.components.entrySet().iterator();
+        while( it.hasNext() ) {
+            Entry entry = (Entry)it.next();
+            ((JDynFormField)(entry.getValue())).clear();
+        }
+    }
+
+    public Collection getShowFields() {
+        return this.components.values();
+    }
+
+    
+    
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormManager.java	(revision 1235)
@@ -0,0 +1,203 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynform.DynFormDefinition;
+import org.gvsig.tools.dynform.DynFormManager;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynform.JDynFormSet;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.DynStruct_v2;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class DefaultDynFormManager implements DynFormManager {
+
+    DynFormSPIManager serviceManager = null;
+
+    private Map definitions = null;
+    private String defaultJDynFormSetname = "Subform";
+            
+    public DefaultDynFormManager() {
+    }
+
+    public DynFormSPIManager getServiceManager() {
+        if ( serviceManager == null ) {
+            serviceManager = DynFormSPILocator.getDynFormSPIManager();
+        }
+        return serviceManager;
+    }
+
+    public Map getDefinitions() {
+        if ( this.definitions == null ) {
+            this.definitions = new HashMap();
+        }
+        return this.definitions;
+    }
+
+    public Service getService(DynObject parameters) throws ServiceException {
+        Service service = this.serviceManager.createService(parameters);
+        return service;
+    }
+
+    public DynFormDefinition getDefinition(String name) {
+        DefaultDynFormDefinition x = null;
+        x = (DefaultDynFormDefinition) this.getDefinitions().get(name);
+        if ( x == null ) {
+            x = new DefaultDynFormDefinition(name, this);
+            this.getDefinitions().put(x.getName(), x);
+        }
+        return x;
+    }
+
+    public DynFormDefinition getDefinition(DynStruct definition) {
+        String name = definition.getName();
+        DefaultDynFormDefinition x = null;
+        x = (DefaultDynFormDefinition) this.getDefinitions().get(name);
+        if ( x == null ) {
+            x = new DefaultDynFormDefinition(name, this);
+            this.getDefinitions().put(x.getName(), x);
+            DynField[] fields = definition.getDynFields();
+            for ( int i = 0; i < fields.length; i++ ) {
+                x.add(fields[i]);
+            }
+        }
+        if ( definition instanceof DynStruct_v2 ) {
+            x.getTags().add(((DynStruct_v2) definition).getTags());
+        }
+        x.setElementsType(definition);
+        return x;
+    }
+
+    public DynFormDefinition getDefinition(DynObject obj) {
+        return this.getDefinition(obj.getDynClass());
+    }
+
+    public JDynForm createJDynForm(DynFormDefinition definition) throws ServiceException {
+        JDynForm x = new DefaultJDynForm(this, definition);
+        return x;
+    }
+
+    public JDynForm createJDynForm(DynStruct struct) throws ServiceException {
+        DynFormDefinition definition = this.getDefinition(struct);
+        JDynForm x = new DefaultJDynForm(this, definition);
+        return x;
+    }
+
+    public JDynForm createJDynForm(DynObject obj) throws ServiceException {
+        DynFormDefinition definition = this.getDefinition(obj);
+        JDynForm x = new DefaultJDynForm(this, definition);
+        x.setValues(obj);
+        return x;
+    }
+
+    public JDynFormSet createJDynFormSet(DynFormDefinition definition)
+            throws ServiceException {
+        return this.createJDynFormSet(this.defaultJDynFormSetname, definition);
+    }
+
+    public JDynFormSet createJDynFormSet(DynStruct struct) throws ServiceException {
+        return this.createJDynFormSet(this.defaultJDynFormSetname, struct);
+    }
+
+    public JDynFormSet createJDynFormSet(DynObjectSet data)
+            throws ServiceException {
+        return this.createJDynFormSet(this.defaultJDynFormSetname, data);
+    }
+
+    public JDynFormSet createJDynFormSet(List data)
+            throws ServiceException {
+        return this.createJDynFormSet(this.defaultJDynFormSetname, data);
+    }
+
+    public DynObject createServiceParameters(String name)
+            throws ServiceException {
+        DynObject params = this.getServiceManager().createServiceParameters(name);
+        return params;
+    }
+
+    public JDynFormSet createJDynFormSet(String name, DynFormDefinition definition) throws ServiceException {
+        DynObject params = this.createServiceParameters(name);
+        params.setDynValue("definition", definition);
+        JDynFormSet formset = (JDynFormSet) this.getServiceManager().getService(params);
+        return formset;
+    }
+
+    public JDynFormSet createJDynFormSet(String name, DynStruct struct) throws ServiceException {
+        DynFormDefinition definition = this.getDefinition(struct);
+        return this.createJDynFormSet(name, definition);
+    }
+
+    public JDynFormSet createJDynFormSet(String name, List data) throws ServiceException {
+        if ( data.size() < 1 ) {
+            throw new IllegalArgumentException("The DynObjectSet not has elements.");
+        }
+        DynObject obj = (DynObject) data.get(0);
+        JDynFormSet formset = this.createJDynFormSet(name, obj.getDynClass());
+        formset.setValues(data);
+        return formset;
+    }
+
+    public JDynFormSet createJDynFormSet(String name, DynObjectSet data) throws ServiceException {
+        DynObject obj = null;
+        DisposableIterator it = null;
+        try {
+            if ( data.getSize() < 1 ) {
+                throw new IllegalArgumentException("The DynObjectSet not has elements.");
+            }
+            it = data.iterator();
+            obj = (DynObject) it.next();
+        } catch (Exception e) {
+            throw new RuntimeException(e.getLocalizedMessage(), e);
+        } finally {
+            if ( it != null ) {
+                it.dispose();
+            }
+        }
+        JDynFormSet formset = this.createJDynFormSet(name, obj.getDynClass());
+        formset.setValues(data);
+        return formset;
+    }
+
+    public String getDefaultJDynFormSetName() {
+        return this.defaultJDynFormSetname;
+    }
+
+    public void setDefaultJDynFormSetName(String name) {
+        this.defaultJDynFormSetname = name;
+    }
+    
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormFieldDefinition.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormFieldDefinition.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormFieldDefinition.java	(revision 1235)
@@ -0,0 +1,113 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.util.Iterator;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.impl.DefaultDynField;
+import org.gvsig.tools.service.Manager;
+
+public class DefaultDynFormFieldDefinition extends DefaultDynField implements DynFormFieldDefinition {
+
+	private DefaultDynFormManager manager = null;
+	private String label = null;
+	private String groups = null;
+	
+	public DefaultDynFormFieldDefinition(DefaultDynFormManager manager, DynField definition) {
+		super(definition.getName(), 
+			definition.getType(), 
+			definition.getDefaultValue(),
+			definition.isPersistent(),
+			definition.isMandatory());
+		this.setHidden(definition.isHidden());
+		this.setReadOnly(definition.isReadOnly());
+		this.setGroups(definition.getGroup());
+		this.setDescription(definition.getDescription());
+		this.setMaxValue(definition.getMaxValue());
+		this.setMinValue(definition.getMinValue());
+		this.setOrder(definition.getOder());
+                this.setSubtype(definition.getSubtype());
+		
+		this.setAvailableValues(definition.getAvailableValues());
+		
+		this.manager = manager;
+		DynObjectManager dynManager = ToolsLocator.getDynObjectManager(); 
+		this.label = (String) dynManager.getAttributeValue(definition, "label");
+		if(definition instanceof DynField_v2){
+			this.setClassOfValue(((DynField_v2)definition).getDynClassOfValue());
+			this.setClassOfValue(((DynField_v2)definition).getClassOfValue());
+                        if( definition.isContainer() ) {
+                            this.setClassOfItems(((DynField_v2)definition).getDynClassOfItems());
+                            this.setClassOfItems(((DynField_v2)definition).getClassOfItems());
+                            this.setTypeOfItems(((DynField_v2)definition).getTypeOfItems());
+                        }
+			this.getTags().add(((DynField_v2)definition).getTags());
+
+		}else{
+			this.setSubtype(definition.getSubtype());
+		}
+	}
+
+	public Manager getManager() {
+		return this.manager;
+	}
+
+	public String getLabel() {
+		return this.label;
+	}
+
+	public DynField setLabel(String label) {
+		this.label = label;
+		return this;
+	}
+	
+	public String getGroup() {
+		if( this.groups==null ) {
+			return null;
+		}
+		String parts[] = this.groups.split("/");
+		return parts[0];
+	}
+
+	public String getSubgroup() {
+		String parts[] = this.groups.split("/");
+		if( parts.length<=1 ) {
+			return null;
+		}
+		return parts[1];
+	}
+
+	public String getGroups() {
+		return this.groups;
+	}
+
+	public void setGroups(String groups) {
+		this.groups = groups;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormFieldDefinition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultVisitableSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultVisitableSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultVisitableSet.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.gvsig.tools.dynform.AbortActionException;
+import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultVisitableSet extends HashSet implements VisitableSet {
+
+	public static final Logger logger = LoggerFactory.getLogger(DefaultVisitableSet.class);
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5771630108958038764L;
+
+	public void accept(Visitor visitor) throws BaseException {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Object value = it.next();
+			try {
+				visitor.visit(value);
+			} catch (AbortActionException ex) {
+				throw ex;
+			} catch (Exception ex) {
+				logger.info("Error visiting " + value.toString()
+						+ "(" + value.getClass().getName() + ") with "
+						+ visitor.toString() + "(" + visitor.getClass().getName()
+						+ ").", ex);
+			}
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultVisitableSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormLibrary.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+
+import org.gvsig.tools.dynform.DynFormLibrary;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DefaultDynFormLibrary extends AbstractLibrary {
+
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsImplementationOf(DynFormLibrary.class);
+	}
+	
+	protected void doInitialize() throws LibraryException {
+		DynFormLocator.registerDefaultDynFormManager(DefaultDynFormManager.class);
+		DynFormSPILocator.registerDefaultDynFormSPIManager(DefaultDynFormSPIManager.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DynObjectEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DynObjectEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DynObjectEditor.java	(revision 1235)
@@ -0,0 +1,211 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.JDynForm;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Editor for a store parameters.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DynObjectEditor extends JPanel implements ActionListener {
+
+    private static final long serialVersionUID = 23898787077741411L;
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DynObjectEditor.class);
+
+    private String title;
+
+    private JButton botAcept;
+    private JButton botCancel;
+    private JButton botRestoreDefaults;
+    private JPanel panButtons;
+    private I18nManager i18nManager;
+
+//    private boolean modal;
+
+    private JDynForm form = null;
+    private DynObject data = null;
+
+    public DynObjectEditor(DynObject parameters, boolean showDefaultsButton)
+        throws ServiceException {
+    	this.i18nManager = ToolsLocator.getI18nManager();
+    	this.data = parameters;
+    	this.form = DynFormLocator.getDynFormManager().createJDynForm(this.data);
+    	this.form.setLayoutMode(this.form.USE_TABS);
+    	this.setLayout(new BorderLayout());
+        this.add(this.form.asJComponent(), BorderLayout.CENTER);
+        this.add(getButtonsPanel(showDefaultsButton), BorderLayout.SOUTH);
+        this.setPreferredSize(new Dimension(500,250));
+        String s = this.data.getDynClass().getDescription();
+        if( s==null || s.length()==0 ) {
+        	s = this.data.getDynClass().getName();
+        }
+        this.setTitle(s);
+    }
+    
+    public DynObjectEditor(DynObject parameters) throws ServiceException {
+        this(parameters, false);
+    }
+
+    private JPanel getButtonsPanel(boolean add_defaults_button) {
+        if (this.panButtons == null) {
+            this.panButtons = new JPanel();
+            this.panButtons.setLayout(new GridBagLayout());
+            GridBagConstraints constr = new GridBagConstraints();
+            constr.anchor = GridBagConstraints.LAST_LINE_END;
+            constr.fill = GridBagConstraints.HORIZONTAL;
+            constr.weightx = 1;
+            constr.weighty = 0;
+            this.panButtons.add(new JLabel(), constr);
+
+            constr = this.getDefaultParametersConstraints();
+            constr.fill = GridBagConstraints.NONE;
+            constr.weightx = 0;
+            constr.weighty = 0;
+
+            this.panButtons.add(this.getAcceptButton(), constr);
+            this.panButtons.add(this.getCancelButton(), constr);
+            if (add_defaults_button) {
+                this.panButtons.add(this.getRestoreDefaults(), constr);
+            }
+        }
+        return this.panButtons;
+    }
+
+    private GridBagConstraints getDefaultParametersConstraints() {
+        GridBagConstraints constr = new GridBagConstraints();
+        constr.insets = new Insets(2, 2, 2, 2);
+        constr.ipadx = 2;
+        constr.ipady = 2;
+        constr.anchor = GridBagConstraints.PAGE_START;
+        return constr;
+
+    }
+
+    private JButton getRestoreDefaults() {
+        if (this.botRestoreDefaults == null) {
+            this.botRestoreDefaults =
+                ToolsSwingLocator.getUsabilitySwingManager().createJButton(
+                    i18nManager.getTranslation("restoreDefaults"));
+            this.botRestoreDefaults.addActionListener(this);
+        }
+        return this.botRestoreDefaults;
+    }
+
+    private JButton getCancelButton() {
+        if (this.botCancel == null) {
+            this.botCancel =
+                ToolsSwingLocator.getUsabilitySwingManager().createJButton(
+                		i18nManager.getTranslation("cancel"));
+            this.botCancel.addActionListener(this);
+        }
+        return this.botCancel;
+    }
+
+    private JButton getAcceptButton() {
+        if (this.botAcept == null) {
+            this.botAcept =
+                ToolsSwingLocator.getUsabilitySwingManager().createJButton(
+                		i18nManager.getTranslation("accept"));
+            this.botAcept.addActionListener(this);
+        }
+        return this.botAcept;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        Component source = (Component) e.getSource();
+        if (source == this.botAcept) {
+        	this.form.getValues(this.data);
+            this.closeWindow();
+        } else if (source == this.botCancel) {
+        	this.closeWindow();
+        } else if (source == this.botRestoreDefaults) {
+        	this.form.setValues(this.data);
+        }
+    }
+
+    protected void closeWindow() {
+        LOG.debug("Closing window, values edited: ", this.data);
+        this.setVisible(false);       
+    }
+
+    public void editObject(boolean modal) {
+//        this.modal = modal;
+        
+        WindowManager wmanager = ToolsSwingLocator.getWindowManager();
+        
+        wmanager.showWindow(this,title,WindowManager.MODE.DIALOG);
+
+//        wmanager.showWindow(this, 
+//                Messages.getText("explorer_parameters"), 
+//                WindowManager.MODE.DIALOG);
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+  
+    public DynObject getParameters() {
+    	this.form.getValues(this.data);
+        return this.data;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DynObjectEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultZoomDialog.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultZoomDialog.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultZoomDialog.java	(revision 1235)
@@ -0,0 +1,107 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextArea;
+import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog;
+
+public class DefaultZoomDialog extends JZoomDialog {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 7913363575200612492L;
+	
+	private String value = null;
+	private JCustomTextArea text = null; 
+
+	public DefaultZoomDialog(String title, String value) {
+		super(title);
+		this.value = value;
+		initComponents();
+		
+	}
+	
+	public void setEditable(boolean editable) {
+		this.text.setEditable(editable);
+	}
+	
+	private void initComponents() {
+
+		JPanel panel = new JPanel();
+		panel.setLayout(new BorderLayout()); 
+
+		text = new JCustomTextArea(null, false); 
+		text.setText(value);
+		text.setLineWrap(true);
+		JScrollPane scroll = new JScrollPane(text); 
+		panel.add(scroll, BorderLayout.CENTER); 
+		panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+		
+		JPanel p = new JPanel();
+		
+		JButton close = new JButton("Close");
+		close.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				value = text.getText();
+				setVisible(false);
+			}
+		});
+		
+		p.setLayout(new BorderLayout());
+		p.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+		p.add(close,BorderLayout.LINE_END);
+
+		panel.add(p, BorderLayout.PAGE_END);
+		
+		panel.setPreferredSize(new Dimension(600, 250));
+		
+	    this.setContentPane(panel);
+
+	    this.center();
+		this.pack();
+	}
+	
+	public void center() {
+	    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
+	    Dimension size = this.getPreferredSize();
+	    int x = (int) ((dimension.getWidth() - size.getWidth()) / 2);
+	    int y = (int) ((dimension.getHeight() - size.getHeight()) / 2);
+	    this.setLocation(x, y);
+	}
+	public String getText() {
+		return this.value;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultZoomDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/ActionStore.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/ActionStore.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/ActionStore.java	(revision 1235)
@@ -0,0 +1,39 @@
+package org.gvsig.tools.dynform.impl;
+
+import javax.swing.Action;
+
+import org.gvsig.tools.dataTypes.DataType;
+
+public class ActionStore{
+	private DataType tipo;
+	private String name;
+	private Action action;
+	private boolean isSeparator = false;
+	
+	public ActionStore(DataType tipo,String name, Action action){
+		this.tipo = tipo;
+		this.name = name;
+		this.action = action;
+	}
+	
+	public ActionStore(DataType tipo){
+		this.tipo = tipo;
+		this.isSeparator = true;
+	}
+	
+	public DataType getDataType(){
+		return tipo;
+	}
+	
+	public String getActionName(){
+		return name;
+	}
+	
+	public Action getAction(){
+		return action;
+	}
+	
+	public boolean isSeparator(){
+		return isSeparator;
+	}
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/ActionStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormSPIManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormSPIManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormSPIManager.java	(revision 1235)
@@ -0,0 +1,204 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynform.impl;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.JTextComponent;
+
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynform.DynFormFieldDefinition;
+import org.gvsig.tools.dynform.DynFormLocator;
+import org.gvsig.tools.dynform.DynFormManager;
+import org.gvsig.tools.dynform.JDynFormField;
+import org.gvsig.tools.dynform.spi.DynFormSPILocator;
+import org.gvsig.tools.dynform.spi.DynFormSPIManager;
+import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator;
+import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.AbstractServiceManager;
+import org.gvsig.tools.service.spi.NotRegisteredException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultDynFormSPIManager extends AbstractServiceManager implements DynFormSPIManager {
+
+    private static final Logger logger = LoggerFactory.getLogger(DefaultDynFormSPIManager.class);
+
+    DynFormManager manager = null;
+
+    public DynFormManager getDynFormManager() {
+        if ( manager == null ) {
+            manager = DynFormLocator.getDynFormManager();
+        }
+        return manager;
+    }
+
+    public Service getService(DynObject parameters) throws ServiceException {
+        Service service = this.createService(parameters);
+        return service;
+    }
+
+    protected String getRegistryKey() {
+        return "DefaultDynFormSPIManager";
+    }
+
+    protected String getRegistryDescription() {
+        return "Dynamics forms default SPI manager";
+    }
+
+    public JZoomDialog createJZoomDialog(String title, String message, String text) {
+        return new DefaultZoomDialog(title, text);
+    }
+
+    public JProblemIndicator createProblemIndicator(JDynFormField field) {
+        return new DefaultJProblemIndicator(field);
+    }
+
+    public String makeServiceName(DataType dataType, String subtype) {
+        return makeServiceName(dataType, null, subtype);
+    }
+
+    public String makeServiceName(DataType dataType, String className, String subtype) {
+        String name;
+        if( StringUtils.isBlank(className) ) {
+            name = DynFormSPIManager.SERVICE_NAME_PREFIX
+                    + dataType.getName()+".any";
+        } else {
+            name = DynFormSPIManager.SERVICE_NAME_PREFIX
+                    + dataType.getName()+"."+ className.trim().toLowerCase();
+        }
+        if( !StringUtils.isBlank(subtype) ) {
+            name += "." + subtype.trim().toLowerCase();
+        }
+        return name;
+    }
+
+    public String makeServiceName(int dataType, String subtype) {
+        if ( dataType == DataTypes.UNKNOWN ) {
+            return DynFormSPIManager.SERVICE_NAME_PREFIX + "unknown";
+        }
+        return makeServiceName(ToolsLocator.getDataTypesManager().get(dataType), subtype);
+    }
+
+    public String makeServiceName(int dataType, String className, String subtype) {
+        if ( dataType == DataTypes.UNKNOWN ) {
+            return DynFormSPIManager.SERVICE_NAME_PREFIX + "unknown";
+        }
+        return makeServiceName(ToolsLocator.getDataTypesManager().get(dataType), className, subtype);
+    }
+
+    public JDynFormField createJDynFormField(DynFormFieldDefinition definition, Object value) throws ServiceException {
+        JDynFormField formfield = null;
+        String serviceName = makeServiceName(definition.getDataType(), definition.getSubtype());
+
+        DynObject params = null;
+        try {
+            params = this.createServiceParameters(serviceName);
+        } catch (NotRegisteredException e) {
+            if ( definition.getSubtype() == null ) {
+                serviceName = makeServiceName(DataTypes.UNKNOWN, null);
+                params = this.createServiceParameters(serviceName);
+            } else {
+                serviceName = makeServiceName(definition.getDataType(), null);
+                try {
+                    params = this.createServiceParameters(serviceName);
+                } catch (NotRegisteredException ex) {
+                    serviceName = makeServiceName(DataTypes.UNKNOWN, null);
+                    params = this.createServiceParameters(serviceName);
+                }
+            }
+        }
+        params.setDynValue(FIELD_FIELDDEFINITION, definition);
+        params.setDynValue(FIELD_VALUE, value);
+        formfield = (JDynFormField) this.createService(params);
+        return formfield;
+    }
+
+    public JPopupMenu createTextFieldPopupMenu(final String title, final JTextComponent component, boolean zoom) {
+        JPopupMenu popupMenu = new JPopupMenu();
+        I18nManager i18nManager = ToolsLocator.getI18nManager();
+
+//		JMenuItem textEditorAction = new JMenuItem("Text Editor");
+//		textEditorAction.addActionListener(new ActionListener() {
+//			public void actionPerformed(ActionEvent arg0) {
+//				JZoomDialog dialog = DynFormSPILocator.getDynFormSPIManager().createJZoomDialog("Edit the field", null, component.getText());
+//				dialog.setAlwaysOnTop(true);
+//				dialog.setVisible(true);
+//				component.setText(dialog.getText());
+//			}
+//		});
+        Action textEditorAction = new AbstractAction(i18nManager.getTranslation("text_editor")) {
+            public void actionPerformed(ActionEvent e) {
+                JZoomDialog dialog = DynFormSPILocator.getDynFormSPIManager().createJZoomDialog(title, null, component.getText());
+                dialog.setEditable(component.isEditable());
+                dialog.setAlwaysOnTop(true);
+                dialog.setVisible(true);
+                if ( component.isEditable() && component.isEnabled() ) {
+                    component.setText(dialog.getText());
+                }
+            }
+        };
+        Action copyAction = component.getActionMap().get(DefaultEditorKit.copyAction);
+        Action cutAction = component.getActionMap().get(DefaultEditorKit.cutAction);
+        Action pasteAction = component.getActionMap().get(DefaultEditorKit.pasteAction);
+        Action selectAllAction = component.getActionMap().get(DefaultEditorKit.selectAllAction);
+
+        if ( copyAction == null
+                && cutAction == null
+                && pasteAction == null
+                && selectAllAction == null ) {
+            copyAction = component.getActionMap().get( i18nManager.getTranslation("copy"));
+            cutAction = component.getActionMap().get( i18nManager.getTranslation("cut"));
+            pasteAction = component.getActionMap().get( i18nManager.getTranslation("paste"));
+            selectAllAction = component.getActionMap().get( i18nManager.getTranslation("SelectAll"));
+        } else {
+            copyAction.putValue(Action.NAME, i18nManager.getTranslation("copy"));
+            cutAction.putValue(Action.NAME, i18nManager.getTranslation("cut"));
+            pasteAction.putValue(Action.NAME, i18nManager.getTranslation("paste"));
+            selectAllAction.putValue(Action.NAME, i18nManager.getTranslation("SelectAll"));
+        }
+
+        if ( zoom ) {
+            popupMenu.add(textEditorAction);
+            popupMenu.addSeparator();
+        }
+        popupMenu.add(cutAction);
+        popupMenu.add(copyAction);
+        popupMenu.add(pasteAction);
+        popupMenu.add(selectAllAction);
+
+        return popupMenu;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormSPIManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm1.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm1.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm1.xml	(revision 1235)
@@ -0,0 +1,445 @@
+<?xml version= "1.0"?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+  	<class name="FloatForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="value" type="float" mandatory="false" group="Layer">
+          <description>Extent Min X coordinate</description>
+        </field>
+      </fields>
+    </class> 
+      <class name="MapserverLayerOffsetForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="x" type="integer" mandatory="false" group="Layer">
+          <description>Extent Min X coordinate</description>
+        </field>
+        <field name="y" type="integer" mandatory="false" group="Layer">
+          <description>Extent Min Y coordinate</description>
+        </field>
+      </fields>
+    </class> 
+     <class name="MapserverLayerPointForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="x" type="float" mandatory="false" group="Layer">
+          <description>Extent Min X coordinate</description>
+        </field>
+        <field name="y" type="float" mandatory="false" group="Layer">
+          <description>Extent Min Y coordinate</description>
+        </field>
+      </fields>
+    </class>
+    <class name="MapserverLayerPatternForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="x" type="double" mandatory="false" group="Pattern">
+          <description>Extent Min X coordinate</description>
+        </field>
+        <field name="y" type="double" mandatory="false" group="Pattern">
+          <description>Extent Min Y coordinate</description>
+        </field>
+      </fields>
+    </class> 
+  <class name="MapserverLayerSymbolForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="Name" type="string" mandatory="false" group="Symbol">
+          <description>Extent Min X coordinate</description>
+        </field>
+        <field name="Type" type="string" mandatory="false" defaultValue="VECTOR" group="Symbol Options">
+          <description>Enables debugging of a layer in the current map.</description>
+  	  	  <availableValues>
+            <value label="Ellipse">ellipse</value>
+            <value label="Vector">vector</value>
+            <value label="PixMap">pixmap</value>
+            <value label="SVG">svg</value>
+            <value label="TrueType">truetype</value>
+            <value label="Hatch">hatch</value>
+          </availableValues>          
+        </field>
+        <field name="Image" type="file" mandatory="false" group="Symbol Options">
+          <description>Class symbol</description>
+        </field>
+        <field name="AnchorPoint" type="DynObject" classOfValue="MapserverLayerPointForm" mandatory="false" defaultValue="" group="Symbol Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="Font" type="string" mandatory="false" group="Symbol Options">
+          <description>Class symbol</description>
+        </field>
+        <field name="Filled" type="boolean" mandatory="false" group="Symbol Options">
+          <description>Class symbol</description>
+        </field>
+        <field name="AntiAlias" type="boolean" mandatory="false" group="Symbol Options">
+          <description>Class symbol</description>
+        </field>
+        <field name="Points" type="List" typeOfItems="DynObject" classOfItems="MapserverLayerPatternForm" mandatory="false" defaultValue="" group="Drawn Options">
+          <description>This keyword allows for arbitrary data to be stored as name value pairs.</description>
+        </field>
+      </fields>
+    </class> 
+    <class name="MapserverLayerExtentForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="minx" type="double" mandatory="false" group="Layer">
+          <description>Extent Min X coordinate</description>
+        </field>
+        <field name="miny" type="double" mandatory="false" group="Layer">
+          <description>Extent Min Y coordinate</description>
+        </field>
+        <field name="maxx" type="double" mandatory="false" group="Layer">
+          <description>Extent Max X coordinate</description>
+        </field>
+        <field name="maxy" type="double" mandatory="false" group="Layer">
+          <description>Extent Max Y coordinate</description>
+        </field>
+      </fields>
+    </class>  
+    <class name="MapserverColorForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="0"/>
+     </tags>
+      <fields>
+       <field name="red" type="integer" mandatory="false" group="Layer">
+          <description>Red component</description>
+        </field>
+        <field name="blue" type="integer" mandatory="false" group="Layer">
+          <description>Blue component</description>
+        </field>
+        <field name="green" type="integer" mandatory="false" group="Layer">
+          <description>Green component</description>
+        </field>
+      </fields>
+    </class>  
+  	<class name="MapserverLayerClusterForm">
+      <description>The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers.</description>
+      <tags>
+     	<value name="layoutMode" value="2"/>
+     </tags>
+      <fields>
+       
+      </fields>
+    </class> 
+     <class name="MapserverLayerClassLabelForm">
+      <description>Graphic style of the Class</description>
+      <tags>
+     	<value name="layoutMode" value="2"/>
+     </tags>
+      <fields>
+      	<field name="Text" type="string" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Type" type="string" mandatory="false" defaultValue="TRUETYPE" group="Text Options">
+          <description>Enables debugging of a layer in the current map.</description>
+  	  	  <availableValues>
+            <value label="BitMap">BITMAP</value>
+            <value label="TrueType">TRUETYPE</value>
+          </availableValues>          
+        </field>
+        <field name="Font" type="string" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Size" type="string" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Encoding" type="string" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Priority" type="string" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="MaxLength" type="integer" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Force" type="boolean" mandatory="false" defaultValue="" group="Text Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Color" type="DynObject" classOfValue="MapserverColorForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="OutlineColor" type="DynObject" classOfValue="MapserverColorForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="OutlineWidth" type="integer" mandatory="false" defaultValue="" group="Color Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="ShadowColor" type="DynObject" classOfValue="MapserverColorForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="ShadowSize" type="DynObject" classOfValue="MapserverLayerOffsetForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        
+		<field name="Align" type="string" mandatory="false" defaultValue="CENTER" group="Position Options">
+          <description>Enables debugging of a layer in the current map.</description>
+  	  	  <availableValues>
+            <value label="Left">LEFT</value>
+            <value label="Center">CENTER</value>
+            <value label="Right">RIGHT</value>
+          </availableValues>          
+        </field>
+        <field name="Position" type="string" mandatory="false" defaultValue="AUTO" group="Position Options">
+          <description>Tells MapServer whether or not a particular layer needs to be transformed from some coordinate system to image coordinates.</description>
+  	  	  <availableValues>
+            <value label="auto">AUTO</value>
+            <value label="UL">UL</value>
+            <value label="UC">UC</value>
+            <value label="UR">UR</value>
+            <value label="CL">CL</value>
+            <value label="CC">CC</value>
+            <value label="CR">CR</value>
+            <value label="LR">LR</value>
+            <value label="LL">LL</value>
+            <value label="LC">LC</value>
+          </availableValues>          
+        </field>
+        <field name="MinSize" type="double" mandatory="false" defaultValue="" group="Position Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="MaxSize" type="double" mandatory="false" defaultValue="" group="Position Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+         <field name="MinFeatureSize" type="string" mandatory="false" defaultValue="" group="Position Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="Angle" type="string" mandatory="false" defaultValue="" group="Position Options">
+          <description>Layer status </description>
+        </field>
+        <field name="MaxOverlapAngle" type="float" mandatory="false" defaultValue="" group="Position Options">
+          <description>Layer status </description>
+        </field>
+        <field name="Buffer" type="integer" mandatory="false" defaultValue="" group="Position Options">
+          <description>Layer status </description>
+        </field>
+         <field name="MinDistance" type="integer" mandatory="false" defaultValue="" group="Position Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="RepeatDistance" type="integer" mandatory="false" defaultValue="" group="Position Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="Offset" type="DynObject" classOfValue="MapserverLayerOffsetForm" mandatory="false" defaultValue="" group="Drawn Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="Partials" type="boolean" mandatory="false" defaultValue="false" group="Drawn Options">
+          <description>Layer status </description>         
+        </field>
+        <field name="AntiAlias" type="boolean" mandatory="false" defaultValue="false" group="Drawn Options">
+          <description>Layer status </description>         
+        </field>
+        
+        </fields>
+    </class>
+  	<class name="MapserverLayerClassStyleForm">
+      <description>Graphic style of the Class</description>
+      <tags>
+     	<value name="layoutMode" value="2"/>
+     </tags>
+      <fields>
+        
+        <field name="SymbolName" type="string" mandatory="false" defaultValue="" group="Symbol Options">
+          <description>Layer status </description>
+        </field>
+        
+        <field name="Color" type="DynObject" classOfValue="MapserverColorForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="OutlineColor" type="DynObject" classOfValue="MapserverColorForm" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="OutlineColorAttribute" type="string" mandatory="false" group="Color Options">
+          <description>Class symbol</description>
+        </field>
+        <field name="Opacity" type="integer" mandatory="false" defaultValue="" group="Color Options">
+          <description>Sets the opacity level.</description>
+        </field>
+
+        <field name="Size" type="string" mandatory="false" defaultValue="" group="Size Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="Width" type="double" mandatory="false" defaultValue="" group="Size Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="MaxWidth" type="float" mandatory="false" defaultValue="" group="Size Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="MinSize" type="float" mandatory="false" defaultValue="" group="Size Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="MaxSize" type="float" mandatory="false" defaultValue="" group="Size Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="Offset" type="DynObject" classOfValue="MapserverLayerOffsetForm" mandatory="false" defaultValue="" group="Size Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        <field name="PolarOffset" type="string" mandatory="false" group="Size Options">
+          <description>Sets the color index to treat as transparent for raster layers.</description>
+        </field>
+        
+        <field name="Geotransform" type="string" mandatory="false" group="Geographical Options">
+          <description>Opacity of the image symbol</description>
+        </field>
+        
+         
+        <field name="Angle" type="string" mandatory="false" group="Drawn Options">
+          <description>Class color style</description>
+        </field>
+        <field name="Gap" type="double" mandatory="false" group="Drawn Options">
+          <description>File of the Symbol</description>
+        </field>
+        <field name="InitialGap" type="double" mandatory="false" group="Drawn Options">
+          <description>Opacity of the image symbol</description>
+        </field>
+        <field name="Pattern" type="List" typeOfItems="DynObject" classOfItems="FloatForm" mandatory="false" defaultValue="" group="Drawn Options">
+          <description>This keyword allows for arbitrary data to be stored as name value pairs.</description>
+        </field>
+        <field name="LineCap" type="string" mandatory="false" defaultValue="ROUND" group="Drawn Options">
+          <description>Layer status </description>
+  		  <availableValues>
+          	<value label="Round">ROUND</value>
+          	<value label="Butt">BUTT</value>
+          	<value label="Square">SQUARE</value>
+          </availableValues>          
+        </field>
+        <field name="LineJoin" type="string" mandatory="false" defaultValue="ROUND" group="Drawn Options">
+          <description>Layer status </description>
+  		  <availableValues>
+          	<value label="Round">ROUND</value>
+          	<value label="Miter">MITER</value>
+          	<value label="Bevel">BEVEL</value>
+          </availableValues>          
+        </field>
+         <field name="LineJoinMaxSize" type="integer" mandatory="false" defaultValue="" group="Drawn Options">
+          <description>Layer status </description>
+  		</field>
+        
+      </fields>
+    </class>  
+  	<class name="MapserverLayerClassForm">
+      <description>Store the parameters need to open a CSV file</description>
+      <fields>
+        <field name="Name" type="string" mandatory="false" group="General Class Properties">
+          <description>Class name</description>
+        </field>
+        <field name="Group" type="string" mandatory="false" group="General Class Properties">
+          <description>Name of a group that this layer belongs to.</description>
+        </field>
+        <field name="Expression" type="string" mandatory="false" group="General Class Properties">
+          <description>Class expression</description>
+        </field>
+        <field name="MinScaleDenom" type="double" mandatory="false" defaultValue="" group="Geographic Options">
+          <description>Maximum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="MaxScaleDenom" type="double" mandatory="false" defaultValue="" group="Geographic Options">
+          <description>Minimum scale at which this LAYER is shown.</description>
+        </field>
+        <field name="KeyImage" type="file" mandatory="false" group="Label Options">
+          <description>Class expression</description>
+        </field>
+        <field name="Text" type="string" mandatory="false" group="Label Options">
+          <description>Text to label features in this class</description>
+        </field>
+        <field name="Template" type="file" mandatory="false" defaultValue="" group="Label Options">
+          <description>Used as a global alternative to CLASS TEMPLATE.</description>
+        </field>
+        <field name="Status" type="string" mandatory="false" defaultValue="ON" group="MapServer Options">
+          <description>Class status </description>
+  		  <availableValues>
+          	<value label="ON">ON</value>
+          	<value label="OFF">OFF</value>
+          </availableValues>  
+        </field>
+        <field name="Debug" type="string" mandatory="false" defaultValue="OFF" group="MapServer Options">
+          <description>Enables debugging of a layer in the current map.</description>
+  	  	  <availableValues>
+            <value label="OFF">OFF</value>
+            <value label="ON">ON</value>
+            <value label="1">1</value>
+            <value label="2">2</value>
+            <value label="3">3</value>
+            <value label="4">4</value>
+            <value label="5">5</value>
+          </availableValues>          
+        </field>
+        
+      </fields>
+    </class>  
+    <class name="MapserverLayerProjectionForm">
+      <description>Store the parameters need to open a CSV file</description>
+      <fields>
+        <field name="Abrev" type="string" mandatory="false" group="Layer">
+          <description>Projection definition</description>
+        </field>
+      </fields>
+    </class>  
+    <class name="MapserverLayerMetadataForm">
+      <description>Store the parameters need to open a CSV file</description>
+      <fields>
+        <field name="key" type="string" mandatory="false"  order="1" group="Layer">
+          <description>Metadata key</description>
+        </field>
+        <field name="value" type="string" mandatory="false" order="2" group="Layer">
+          <description>Metadata value</description>
+        </field>
+        <field name="file" type="file" mandatory="false" order="3" group="Layer">
+          <description>Metadata value</description>
+        </field>
+      </fields>
+    </class>  
+    <class name="MapserverLayerPropertiesForm">
+      <description>Store the parameters need to open a CSV file</description>
+       <tags>
+          	<value name="layoutMode" value="1"/>
+          	<value name="TabPlacement" value="2"/>
+       </tags>
+      <fields>
+        <field name="Name" type="string" mandatory="false" group="General layer Properties">
+          <description>Layer name</description>
+        </field>
+        <field name="Metadata" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm" mandatory="false" defaultValue="" group="MapServer Options">
+          <description>This keyword allows for arbitrary data to be stored as name value pairs.</description>
+          <tags>
+	     	<value name="ViewMode" value="SimpleTable"/>
+	     </tags>
+        </field>
+        <field name="ConnectionType" type="string" mandatory="false" defaultValue="LOCAL" group="Connection Options">
+          <description>Units used by the Layer</description>
+  	  	  <availableValues>
+            <value label="Local">LOCAL</value>
+            <value label="Postgis">POSTGIS</value>
+            <value label="Raster">RASTER</value>
+            <value label="WMS">WMS</value>
+            <value label="WFS">WFS</value>
+            <value label="Oracle Spatial">ORACLESPATIAL</value>
+            <value label="Plugin">PLUGIN</value>
+            <value label="OGR">OGR</value>
+            <value label="Union">Union</value>
+            <value label="SDE">SDE</value>
+            <value label="Contour">CONTOUR</value>
+          </availableValues>          
+        </field>       
+      </fields>
+    </class>
+    
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm1.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm2.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm2.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm2.xml	(revision 1235)
@@ -0,0 +1,2223 @@
+<?xml version= "1.0"?>
+<definitions>
+	<version>1.0.0</version>
+	<classes>
+
+		<!-- General Definitions -->
+
+		<class name="FloatForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="1" />
+			</tags>
+			<fields>
+				<field name="value" type="float" mandatory="false" group="Layer">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		<class name="StringForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="value" type="string" mandatory="false" group="Layer">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerExtentForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="minx" type="double" mandatory="false" group="Layer">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="miny" type="double" mandatory="false" group="Layer">
+					<description>Extent Min Y coordinate</description>
+				</field>
+				<field name="maxx" type="double" mandatory="false" group="Layer">
+					<description>Extent Max X coordinate</description>
+				</field>
+				<field name="maxy" type="double" mandatory="false" group="Layer">
+					<description>Extent Max Y coordinate</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerMetadataForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<fields>
+				<field name="key" type="string" mandatory="false" order="1"
+					group="Layer">
+					<description>Metadata key</description>
+                                        <tags>
+                                                <value name="dynform.width" value="20" />
+                                        </tags>                                        
+				</field>
+				<field name="value" type="string" mandatory="false" order="2"
+					group="Layer">
+					<description>Metadata value</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerOffsetForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="x" type="integer" mandatory="false" group="Layer">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="y" type="integer" mandatory="false" group="Layer">
+					<description>Extent Min Y coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+
+		<!-- MapCache Definitions -->
+
+		<class name="MapCacheService">
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Type" type="String" mandatory="false" defaultValue="wms" group="Service">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="WMS">wms</value>
+						<value label="WMTS">wmts</value>
+						<value label="TMS">tms</value>
+						<value label="KML">kml</value>
+						<value label="Google Maps">gmaps</value>
+						<value label="VE">ve</value>
+						<value label="Demo">demo</value>
+					</availableValues>
+				</field>
+				<field name="Enabled" type="boolean" mandatory="false" group="Service">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ForwardingRuleName" type="String" mandatory="false"
+					group="Service">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ForwardingRuleUrl" type="String" mandatory="false"
+					group="Service">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="AppendPathInfo" type="boolean" defaultValue="true"
+					mandatory="false" group="Service">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="FullWMS" type="String" mandatory="false"
+					defaultValue="error" group="Service">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Error">error</value>
+						<value label="Assemble">assemble</value>
+						<value label="Forward">forward</value>
+					</availableValues>
+				</field>
+				<field name="ResampleMode" type="String" mandatory="false"
+					defaultValue="nearest" group="Service">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Nearest">nearest</value>
+						<value label="Bilinear">bilinear</value>
+						<value label="Forward">forward</value>
+					</availableValues>
+				</field>
+				<field name="format" type="string" mandatory="false" group="Service">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapCacheTilesetDimension">
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Dimension">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Type" type="String" mandatory="false" defaultValue="values" group="Dimension">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Predefined values">values</value>
+						<value label="Regular Expression">regex</value>
+						<value label="Interval values">intervals</value>
+					</availableValues>
+				</field>
+				<field name="Default" type="String" mandatory="false" group="Dimension">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Value" type="String" mandatory="false" group="Dimension">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapCacheTileset">
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Title" type="String" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Abstract" type="String" subtype="Text" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Source" type="String" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Cache" type="String" subtype="publish.mapcache.dyncombo" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+					<tags>
+						<value name="publish.mapcache.getclassname" value="Caches" />
+						<value name="publish.mapcache.getattrname" value="Name" />
+					</tags>
+				</field>
+				<field name="Grid" type="String" subtype="publish.mapcache.dyncombo" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+					<tags>
+						<value name="publish.mapcache.getclassname" value="Grids" />
+						<value name="publish.mapcache.getattrname" value="Name" />
+					</tags>
+				</field>
+				<field name="Format" type="String" subtype="publish.mapcache.dyncombo" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+					<tags>
+						<value name="publish.mapcache.getclassname" value="Formats" />
+						<value name="publish.mapcache.getattrname" value="Name" />
+					</tags>
+				</field>
+				<field name="MinZoom" type="integer" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MaxZoom" type="integer" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="RestrictedExtent" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Tileset">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Watermark" type="file" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MetaTile" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Tileset">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="MetaBuffer" type="integer" mandatory="false"
+					group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Expires" type="integer" mandatory="false" group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="AutoExpire" type="integer" mandatory="false"
+					group="Tileset">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Dimensions" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheTilesetDimension"
+					mandatory="false" defaultValue="" group="Tileset">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapCacheGrid">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Grid">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Title" type="String" mandatory="false" group="Grid">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="WellKnownScaleSet" type="String" mandatory="false"
+					group="Grid">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Size" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Grid">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Extent" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Grid">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Srs" type="String" mandatory="false" group="Grid">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="SrsAlias" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="StringForm"
+					mandatory="false" defaultValue="" group="Grid">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+				<field name="Resolutions" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="StringForm"
+					mandatory="false" defaultValue="" group="Grid">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+				<field name="Units" type="String" defaultValue="m" mandatory="false"
+					group="Grid">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Meters">m</value>
+						<value label="Decimal degrees">dd</value>
+						<value label="Feet">ft</value>
+					</availableValues>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheFormatPNG">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Compression" type="String" defaultValue="fast"
+					mandatory="false" group="Format">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Best">best</value>
+						<value label="Fast">fast</value>
+					</availableValues>
+				</field>
+				<field name="Colors" type="integer" mandatory="false" group="Format">
+					<description>Entre 2 y 256</description>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheFormatJPEG">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Quality" type="integer" mandatory="false" group="Format">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Photometric" type="String" defaultValue="ycbcr"
+					mandatory="false" group="Format">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="YCbCr">ycbcr</value>
+						<value label="RGB">rgb</value>
+					</availableValues>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheFormatMixed">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Transparent" type="String" mandatory="false"
+					group="Format">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Opaque" type="String" mandatory="false" group="Format">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheFormatType">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				
+				<field name="Type" type="String" subtype="publish.mapcache.dynform" mandatory="false" defaultValue="PNG" group="Cache">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="JPEG">JPEG</value>
+						<value label="PNG">PNG</value>
+						<value label="Mixed">MIXED</value>
+					</availableValues>
+					<tags>
+						<value name="publish.mapcache.definition" value="MapCacheFormatType" />
+						<value name="publish.mapcache.choicepanel.JPEG" value="JPEG" />
+						<value name="publish.mapcache.choicepanel.PNG" value="PNG" />
+						<value name="publish.mapcache.choicepanel.MIXED" value="MIXED" />
+					</tags>
+				</field>
+				<field name="JPEG" type="DynObject" classOfValue="MapCacheFormatJPEG"
+					mandatory="false" defaultValue="" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="PNG" type="DynObject"  classOfValue="MapCacheFormatPNG"
+					mandatory="false" defaultValue="" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="MIXED" type="DynObject" classOfValue="MapCacheFormatMixed"
+					mandatory="false" defaultValue="" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+			</fields>
+		</class>
+		
+
+		<class name="MapCacheFormat">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Format">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Type" type="DynObject" subtype="publish.mapcache.dynform" classOfValue="MapCacheFormatType" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheCacheDisk">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Base" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="SymlinkBlank" type="boolean" defaultValue="false"
+					mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		
+		<class name="MapCacheCacheDiskLayout">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Layout" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Template" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapCacheCacheMemcache">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Host" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Port" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheCacheSqlite3">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+			</fields>
+		</class>
+		
+		<class name="MapCacheCacheMbTiles">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="DBFile" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		
+		<class name="MapCacheCacheType">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				
+				<field name="TypeName" type="String" mandatory="false" defaultValue="disk" group="Cache">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Disk">disk</value>
+						<value label="Disk.Layout">disk</value>
+						<value label="MemCache">memcache</value>
+						<value label="Sqlite3">sqlite3</value>
+						<value label="MBTiles">mbtiles</value>
+					</availableValues>
+					<tags>
+						<value name="publish.mapcache.definition" value="MapCacheCacheType" />
+						<value name="publish.mapcache.choicepanel.Disk" value="Disk" />
+						<value name="publish.mapcache.choicepanel.Disk.Layout" value="Disk layout" />
+						<value name="publish.mapcache.choicepanel.MemCache" value="MemCache" />
+						<value name="publish.mapcache.choicepanel.Sqlite3" value="Sqlite3" />
+						<value name="publish.mapcache.choicepanel.MBTiles" value="MBTiles" />
+					</tags>
+				</field>
+				<field name="Disk" type="DynObject" classOfValue="MapCacheCacheDisk"
+					mandatory="false" defaultValue="" hidden="true" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="Disk.Layout" type="DynObject" classOfValue="MapCacheCacheDiskLayout"
+					mandatory="false" defaultValue="" hidden="true" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="MemCache" type="DynObject" classOfValue="MapCacheCacheMemcache"
+					mandatory="false" defaultValue="" hidden="true" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="Sqlite3" type="DynObject" classOfValue="MapCacheCacheSqlite3"
+					mandatory="false" defaultValue="" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="MBTiles" type="DynObject" classOfValue="MapCacheCacheMbTiles"
+					mandatory="false" defaultValue="" group="Cache">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+			</fields>
+		</class>
+		
+
+		<class name="MapCacheCache">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Type" type="DynObject" classOfValue="MapCacheCacheType" subtype="publish.mapcache.dynform" mandatory="false" group="Cache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				
+			</fields>
+		</class>
+
+		<class name="MapCacheSource">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Type" type="String" defaultValue="wms" mandatory="false"
+					group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Request" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Service" type="String" defaultValue="WMS"
+					mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Styles" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Url" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Format" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Map" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Layers" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Version" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="UserAgent" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Referer" type="String" mandatory="false" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Header" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm"
+					mandatory="false" defaultValue="" group="Source">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+				<field name="Timeout" type="integer" mandatory="false" defaultValue="30" group="Source">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+		
+		<class name="MapCacheLayer">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="1" />
+			</tags>
+			<fields>
+				<field name="Source" type="DynObject" classOfValue="MapCacheSource"
+					mandatory="false" defaultValue="" group="MapCache Source">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+				<field name="TileSet" type="DynObject" classOfValue="MapCacheTileset"
+					mandatory="false" defaultValue="" group="MapCache TileSet">
+					<description>Sets the projection of the Layer.</description>
+					<tags>
+						<value name="layoutMode" value="0" />
+					</tags>
+				</field>
+
+			</fields>
+		</class>
+
+		<class name="MapCache">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="defaultFormat" type="String" mandatory="false"
+					group="MapCache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="errors" type="String" defaultValue="report"
+					mandatory="false" group="MapCache">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Log">log</value>
+						<value label="Report">report</value>
+						<value label="Empty IMG">empty_img</value>
+						<value label="Report IMG">report_img</value>
+					</availableValues>
+				</field>
+				<field name="lockDir" type="String" mandatory="false" group="MapCache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="lockRetry" type="integer" mandatory="false"
+					group="MapCache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="logLevel" type="String" defaultValue="warn"
+					mandatory="false" group="MapCache">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="Debug">debug</value>
+						<value label="Info">info</value>
+						<value label="Notice">notice</value>
+						<value label="Warn">warn</value>
+						<value label="Error">error</value>
+						<value label="Critical">crit</value>
+						<value label="Alert">alert</value>
+						<value label="Emergency">emerg</value>
+					</availableValues>
+				</field>
+				<field name="autoReload" type="boolean" defaultValue="false"
+					mandatory="false" group="MapCache">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Sources" type="List" subtype="DynObject" typeOfItems="DynObject" classOfItems="MapCacheSource"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+				
+				<field name="Caches" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheCache"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+				
+				<field name="Formats" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheFormat"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+				
+				<field name="Grids" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheGrid"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+				<field name="Services" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheService"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+				<field name="Tilesets" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapCacheTileset"
+					mandatory="false" defaultValue="" group="MapCache">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+			</fields>
+		</class>
+
+		<!-- TinyOWS Definitions -->
+
+		<class name="MapserverOWSLayerForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="NsPrefix" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="NsUri" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Name" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Title" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Retrievable" type="boolean" mandatory="false"
+					group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Writable" type="boolean" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Schema" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Table" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Abstract" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Keywords" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Srid" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="GeoBBox" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Layers">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="IncludeItems" type="string" mandatory="false"
+					group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ExcludeItems" type="string" mandatory="false"
+					group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="GmlNs" type="string" mandatory="false" group="Layers">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+
+		<class name="MapserverOWSLimitsForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Features" type="integer" mandatory="false" group="Limits">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="GeoBBox" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Limits">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapserverOWSMetadataForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="string" mandatory="false" group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Title" type="string" mandatory="false" group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Abstract" type="string" mandatory="false" group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Keywords" type="string" mandatory="false" group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Fees" type="string" mandatory="false" group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="AccessConstraints" type="string" mandatory="false"
+					group="Metadata">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapserverOWSPgForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Host" type="string" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="User" type="string" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Password" type="string" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="DBName" type="string" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Port" type="Integer" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Encoding" type="string" mandatory="false" group="Pg">
+					<description>Extent Min X coordinate</description>
+				</field>
+			</fields>
+		</class>
+
+
+		<class name="MapserverTinyowsForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="OnlineResource" type="string" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="SchemaDir" type="string" mandatory="false" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Log" type="file" mandatory="false" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="LogLevel" type="integer" mandatory="false" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="DegreePrecision" type="integer" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MeterPrecision" type="integer" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="DisplayBBox" type="boolean" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="EstimatedExtent" type="boolean" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="CheckSchema" type="boolean" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="CheckValidGeom" type="boolean" mandatory="false"
+					group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Encoding" type="string" mandatory="false" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ExposePk" type="boolean" mandatory="false" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="WfsDefaultVersion" type="string" mandatory="false"
+					defaultValue="1.0.0" group="Tinyows">
+					<description>Extent Min X coordinate</description>
+					<availableValues>
+						<value label="1.0.0">1.0.0</value>
+						<value label="1.1.0">1.1.0</value>
+					</availableValues>
+				</field>
+				<field name="Metadata" type="DynObject" classOfValue="MapserverOWSMetadataForm"
+					mandatory="false" defaultValue="" group="Metadata">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Limits" type="DynObject" classOfValue="MapserverOWSLimitsForm"
+					mandatory="false" defaultValue="" group="Limits">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Pg" type="DynObject" classOfValue="MapserverOWSPgForm"
+					mandatory="false" defaultValue="" group="Pg">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+
+				<field name="Layers" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverOWSLayerForm"
+					mandatory="false" defaultValue="" group="Layers">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+
+			</fields>
+		</class>
+
+
+		<!-- MapServer 6.4.1 Definitions -->
+
+
+		<class name="MapserverLayerPointForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="x" type="float" mandatory="false" group="Layer">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="y" type="float" mandatory="false" group="Layer">
+					<description>Extent Min Y coordinate</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerPatternForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="x" type="double" mandatory="false" group="Pattern">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="y" type="double" mandatory="false" group="Pattern">
+					<description>Extent Min Y coordinate</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerSymbolForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="Name" type="string" mandatory="false" group="Symbol">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Type" type="string" mandatory="false"
+					defaultValue="VECTOR" group="Symbol Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="Ellipse">ellipse</value>
+						<value label="Vector">vector</value>
+						<value label="PixMap">pixmap</value>
+						<value label="SVG">svg</value>
+						<value label="TrueType">truetype</value>
+						<value label="Hatch">hatch</value>
+					</availableValues>
+				</field>
+				<field name="Image" type="file" mandatory="false" group="Symbol Options">
+					<description>Class symbol</description>
+				</field>
+				<field name="AnchorPoint" type="DynObject" classOfValue="MapserverLayerPointForm"
+					mandatory="false" defaultValue="" group="Symbol Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="Font" type="string" mandatory="false" group="Symbol Options">
+					<description>Class symbol</description>
+				</field>
+				<field name="Filled" type="boolean" mandatory="false" group="Symbol Options">
+					<description>Class symbol</description>
+				</field>
+				<field name="AntiAlias" type="boolean" mandatory="false"
+					group="Symbol Options">
+					<description>Class symbol</description>
+				</field>
+				<field name="Points" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerPatternForm"
+					mandatory="false" defaultValue="" group="Drawn Options">
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+                                                <value name="dynform.height" value="200" />
+					</tags>
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+				</field>
+			</fields>
+		</class>
+
+		<class name="MapserverColorForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="0" />
+			</tags>
+			<fields>
+				<field name="red" type="integer" mandatory="false" group="Layer">
+					<description>Red component</description>
+				</field>
+				<field name="blue" type="integer" mandatory="false" group="Layer">
+					<description>Blue component</description>
+				</field>
+				<field name="green" type="integer" mandatory="false" group="Layer">
+					<description>Green component</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerClusterForm">
+			<description>The CLUSTER configuration option provides to combine
+				multiple features from the layer into single (aggregated) features
+				based on their relative positions. Supported only for POINT layers.
+			</description>
+			<tags>
+				<value name="layoutMode" value="2" />
+			</tags>
+			<fields>
+
+			</fields>
+		</class>
+		<class name="MapserverLayerClassLabelForm">
+			<description>Graphic style of the Class</description>
+			<tags>
+				<value name="layoutMode" value="2" />
+			</tags>
+			<fields>
+				<field name="Text" type="string" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Type" type="string" mandatory="false"
+					defaultValue="TRUETYPE" group="Text Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="BitMap">BITMAP</value>
+						<value label="TrueType">TRUETYPE</value>
+					</availableValues>
+				</field>
+				<field name="Font" type="string" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Size" type="string" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Encoding" type="string" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Priority" type="string" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="MaxLength" type="integer" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Force" type="boolean" mandatory="false"
+					defaultValue="" group="Text Options">
+					<description>Layer status </description>
+				</field>
+
+				<field name="Color" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="OutlineColor" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="OutlineWidth" type="integer" mandatory="false"
+					defaultValue="" group="Color Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="ShadowColor" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="ShadowSize" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+
+				<field name="Align" type="string" mandatory="false"
+					defaultValue="CENTER" group="Position Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="Left">LEFT</value>
+						<value label="Center">CENTER</value>
+						<value label="Right">RIGHT</value>
+					</availableValues>
+				</field>
+				<field name="Position" type="string" mandatory="false"
+					defaultValue="AUTO" group="Position Options">
+					<description>Tells MapServer whether or not a particular layer
+						needs to be transformed from some coordinate system to image
+						coordinates.
+					</description>
+					<availableValues>
+						<value label="auto">AUTO</value>
+						<value label="UL">UL</value>
+						<value label="UC">UC</value>
+						<value label="UR">UR</value>
+						<value label="CL">CL</value>
+						<value label="CC">CC</value>
+						<value label="CR">CR</value>
+						<value label="LR">LR</value>
+						<value label="LL">LL</value>
+						<value label="LC">LC</value>
+					</availableValues>
+				</field>
+				<field name="MinSize" type="double" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxSize" type="double" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MinFeatureSize" type="string" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Angle" type="string" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Layer status </description>
+				</field>
+				<field name="MaxOverlapAngle" type="float" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Layer status </description>
+				</field>
+				<field name="Buffer" type="integer" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Layer status </description>
+				</field>
+				<field name="MinDistance" type="integer" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="RepeatDistance" type="integer" mandatory="false"
+					defaultValue="" group="Position Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Offset" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Drawn Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="Partials" type="boolean" mandatory="false"
+					defaultValue="false" group="Drawn Options">
+					<description>Layer status </description>
+				</field>
+				<field name="AntiAlias" type="boolean" mandatory="false"
+					defaultValue="false" group="Drawn Options">
+					<description>Layer status </description>
+				</field>
+
+			</fields>
+		</class>
+		<class name="MapserverLayerClassStyleForm">
+			<description>Graphic style of the Class</description>
+			<tags>
+				<value name="layoutMode" value="2" />
+			</tags>
+			<fields>
+
+				<field name="SymbolName" type="string" mandatory="false"
+					defaultValue="" group="Symbol Options">
+					<description>Layer status </description>
+				</field>
+
+				<field name="Color" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="OutlineColor" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="OutlineColorAttribute" type="string" mandatory="false"
+					group="Color Options">
+					<description>Class symbol</description>
+				</field>
+				<field name="Opacity" type="integer" mandatory="false"
+					defaultValue="" group="Color Options">
+					<description>Sets the opacity level.</description>
+				</field>
+
+				<field name="Size" type="string" mandatory="false"
+					defaultValue="" group="Size Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Width" type="double" mandatory="false"
+					defaultValue="" group="Size Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxWidth" type="float" mandatory="false"
+					defaultValue="" group="Size Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MinSize" type="float" mandatory="false"
+					defaultValue="" group="Size Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxSize" type="float" mandatory="false"
+					defaultValue="" group="Size Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Offset" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Size Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="PolarOffset" type="string" mandatory="false"
+					group="Size Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+
+				<field name="Geotransform" type="string" mandatory="false"
+					group="Geographical Options">
+					<description>Opacity of the image symbol</description>
+				</field>
+
+
+				<field name="Angle" type="string" mandatory="false" group="Drawn Options">
+					<description>Class color style</description>
+				</field>
+				<field name="Gap" type="double" mandatory="false" group="Drawn Options">
+					<description>File of the Symbol</description>
+				</field>
+				<field name="InitialGap" type="double" mandatory="false"
+					group="Drawn Options">
+					<description>Opacity of the image symbol</description>
+				</field>
+				<field name="Pattern" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="FloatForm"
+					mandatory="false" defaultValue="" group="Drawn Options">
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+				</field>
+				<field name="LineCap" type="string" mandatory="false"
+					defaultValue="ROUND" group="Drawn Options">
+					<description>Layer status </description>
+					<availableValues>
+						<value label="Round">ROUND</value>
+						<value label="Butt">BUTT</value>
+						<value label="Square">SQUARE</value>
+					</availableValues>
+				</field>
+				<field name="LineJoin" type="string" mandatory="false"
+					defaultValue="ROUND" group="Drawn Options">
+					<description>Layer status </description>
+					<availableValues>
+						<value label="Round">ROUND</value>
+						<value label="Miter">MITER</value>
+						<value label="Bevel">BEVEL</value>
+					</availableValues>
+				</field>
+				<field name="LineJoinMaxSize" type="integer" mandatory="false"
+					defaultValue="" group="Drawn Options">
+					<description>Layer status </description>
+				</field>
+
+			</fields>
+		</class>
+		<class name="MapserverLayerClassForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<fields>
+				<field name="Name" type="string" mandatory="false"
+					group="General Class Properties">
+					<description>Class name</description>
+				</field>
+				<field name="Group" type="string" mandatory="false"
+					group="General Class Properties">
+					<description>Name of a group that this layer belongs to.
+					</description>
+				</field>
+				<field name="Expression" type="string" mandatory="false"
+					group="General Class Properties">
+					<description>Class expression</description>
+				</field>
+				<field name="Status" type="string" mandatory="false"
+					defaultValue="ON" group="MapServer Options">
+					<description>Class status </description>
+					<availableValues>
+						<value label="ON">ON</value>
+						<value label="OFF">OFF</value>
+					</availableValues>
+				</field>
+				<field name="Debug" type="string" mandatory="false"
+					defaultValue="OFF" group="MapServer Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="OFF">OFF</value>
+						<value label="ON">ON</value>
+						<value label="1">1</value>
+						<value label="2">2</value>
+						<value label="3">3</value>
+						<value label="4">4</value>
+						<value label="5">5</value>
+					</availableValues>
+				</field>
+				<field name="MinScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Geographic Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Geographic Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="KeyImage" type="file" mandatory="false" group="Label Options">
+					<description>Class expression</description>
+				</field>
+				<field name="Text" type="string" mandatory="false" group="Label Options">
+					<description>Text to label features in this class</description>
+				</field>
+				<field name="Template" type="file" mandatory="false"
+					defaultValue="" group="Label Options">
+					<description>Used as a global alternative to CLASS TEMPLATE.
+					</description>
+				</field>
+				<field name="Styles" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerClassStyleForm" mandatory="false"
+					defaultValue="" group="Label Options">
+					<description></description>
+				</field>
+				<field name="Label" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerClassLabelForm" mandatory="false"
+					defaultValue="" group="Label Options">
+					<description></description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerProjectionForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<fields>
+				<field name="Abrev" type="string" mandatory="false" group="Layer">
+					<description>Projection definition</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverLayerPropertiesForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<tags>
+				<value name="layoutMode" value="1" />
+				<value name="TabPlacement" value="2" />
+			</tags>
+			<fields>
+				<field name="Name" type="string" subtype="text" mandatory="false"
+					group="General layer Properties">
+					<description>Layer name</description>
+                                        <tags>
+                                                <value name="rows" value="20" />
+                                        </tags>                                        
+				</field>
+				<field name="Group" type="string" mandatory="false"
+					group="General layer Properties">
+					<description>Name of a group that this layer belongs to.
+					</description>
+				</field>
+				<field name="Type" type="string" mandatory="false"
+					defaultValue="POINT" group="General layer Properties">
+					<description>Layer's types</description>
+					<availableValues>
+						<value label="Point">POINT</value>
+						<value label="Line">LINE</value>
+						<value label="Circle">CIRCLE</value>
+						<value label="Polygon">POLYGON</value>
+						<value label="Raster">RASTER</value>
+						<value label="Query">QUERY</value>
+						<value label="Chart">CHART</value>
+					</availableValues>
+				</field>
+				<field name="Status" type="string" mandatory="false"
+					defaultValue="DEFAULT" group="MapServer Options">
+					<description>Layer status </description>
+					<availableValues>
+						<value label="Default">DEFAULT</value>
+						<value label="ON">ON</value>
+						<value label="OFF">OFF</value>
+					</availableValues>
+				</field>
+				<field name="Debug" type="string" mandatory="false"
+					defaultValue="OFF" group="MapServer Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="OFF">OFF</value>
+						<value label="ON">ON</value>
+						<value label="1">1</value>
+						<value label="2">2</value>
+						<value label="3">3</value>
+						<value label="4">4</value>
+						<value label="5">5</value>
+					</availableValues>
+				</field>
+				<field name="Metadata" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm"
+					mandatory="false" defaultValue="" group="MapServer Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+                                                <value name="dynform.height" value="200" />
+					</tags>
+				</field>
+				<field name="Metadata2" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm"
+					mandatory="false" defaultValue="" group="MapServer Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowSearch" value="true" />
+						<value name="allowUpdate" value="true" />
+					</tags>
+				</field>
+				<field name="ConnectionType" type="string" mandatory="false"
+					defaultValue="LOCAL" group="Connection Options">
+					<description>Units used by the Layer</description>
+					<availableValues>
+						<value label="Local">LOCAL</value>
+						<value label="Postgis">POSTGIS</value>
+						<value label="Raster">RASTER</value>
+						<value label="WMS">WMS</value>
+						<value label="WFS">WFS</value>
+						<value label="Oracle Spatial">ORACLESPATIAL</value>
+						<value label="Plugin">PLUGIN</value>
+						<value label="OGR">OGR</value>
+						<value label="Union">Union</value>
+						<value label="SDE">SDE</value>
+						<value label="Contour">CONTOUR</value>
+					</availableValues>
+				</field>
+				<field name="Connection" type="string" mandatory="false"
+					defaultValue="" group="Connection Options">
+					<description>Database connection string to retrieve remote data.
+					</description>
+				</field>
+				<field name="Data" type="string" mandatory="false"
+					defaultValue="" group="Connection Options">
+					<description>Full filename of the spatial data to process. No file
+						extension is necessary for shapefiles. Can be specified relative
+						to the SHAPEPATH option from the Map Object.
+						If this is an SDE
+						layer, the parameter should include the name of
+						the layer as well
+						as the geometry column, i.e.
+						"mylayer,shape,myversion".
+						If this is a
+						PostGIS layer, the parameter should be in the form of
+						"columnname
+						from tablename", where "columnname" is the name of the
+						column
+						containing the geometry objects and “tablename" is the name
+						of the
+						table from which the geometry data will be read.
+						For Oracle, use
+						"shape FROM table" or "shape FROM (SELECT statement)"
+						or even more
+						complex Oracle compliant queries! Note that there are
+						important
+						performance impacts when using spatial subqueries
+						however. Try
+						using MapServer’s FILTER whenever possible instead.
+						You can also
+						see the SQL submitted by forcing an error, for
+						instance by
+						submitting a DATA parameter you know won’t work, using
+						for example
+						a bad column name.
+					</description>
+				</field>
+				<field name="Plugin" type="string" mandatory="false"
+					defaultValue="" group="Connection Options">
+					<description>Additional library to load by MapServer, for this
+						layer.
+					</description>
+				</field>
+				<field name="Projection" type="DynObject" classOfValue="MapserverLayerProjectionForm"
+					mandatory="false" defaultValue="" group="Geographic Options">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Filter" type="string" mandatory="false"
+					defaultValue="" group="Connection Options">
+					<description>This parameter allows for data specific attribute
+						filtering that is done at the same time spatial filtering is done
+					</description>
+				</field>
+				<field name="FilterItem" type="string" mandatory="false"
+					defaultValue="" group="Connection Options">
+					<description>Item to use with simple FILTER expressions. OGR and
+						shapefiles only.
+					</description>
+				</field>
+				<field name="Extent" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Geographic Options">
+					<description>The spatial extent of the data.</description>
+				</field>
+				<field name="MaxFeatures" type="integer" mandatory="false"
+					defaultValue="" group="Geographic Options">
+					<description>Specifies the number of features that should be drawn
+						for this layer in the CURRENT window
+					</description>
+				</field>
+				<field name="MinScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Geographic Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Geographic Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+
+				<field name="ClassItem" type="string" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Item name in attribute table to use for class lookups.
+					</description>
+				</field>
+				<field name="StyleItem" type="string" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Item to use for feature specific styling.
+					</description>
+				</field>
+
+				<field name="Units" type="string" mandatory="false"
+					defaultValue="METERS" group="Geographic Options">
+					<description>Units used by the Layer</description>
+					<availableValues>
+						<value label="Meters">METERS</value>
+						<value label="Kilometers">KILOMETERS</value>
+						<value label="Miles">MILES</value>
+						<value label="Inches">INCHES</value>
+						<value label="Feet">FEET</value>
+						<value label="Pixels">PIXELS</value>
+						<value label="Percentages">PERCENTAGES</value>
+						<value label="DD">DD</value>
+						<value label="Nautical miles">NAUTICALMILES</value>
+					</availableValues>
+				</field>
+
+
+				<field name="SymbolScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>The scale at which symbols and/or text appear full
+						size.
+					</description>
+				</field>
+				<field name="LabelItem" type="string" mandatory="false"
+					defaultValue="" group="Label Parameters">
+					<description>Item name in attribute table to use for class
+						annotation
+					</description>
+				</field>
+				<field name="LabelRequires" type="string" mandatory="false"
+					defaultValue="" group="Label Parameters">
+					<description>Item name in attribute table to use for class
+						annotation
+					</description>
+				</field>
+				<field name="LabelMinScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Label Parameters">
+					<description>Maximum scale at which this LAYER is labeled.
+					</description>
+				</field>
+				<field name="LabelMaxScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Label Parameters">
+					<description>Minimum scale at which this LAYER is labeled.
+					</description>
+				</field>
+				<field name="LabelCache" type="boolean" mandatory="false"
+					defaultValue="true" group="Label Parameters">
+					<description>Label overlap removal, auto placement etc... are only
+						available when the label cache is active.
+					</description>
+				</field>
+				<field name="PostLabelCache" type="boolean" mandatory="false"
+					defaultValue="true" group="Label Parameters">
+					<description>Tells MapServer to render this layer after all labels
+						in the cache have been drawn.
+					</description>
+				</field>
+				<field name="SizeUnits" type="string" mandatory="false"
+					defaultValue="PIXELS" group="Label Parameters">
+					<description>Sets the unit of CLASS object SIZE values
+					</description>
+					<availableValues>
+						<value label="Meters">METERS</value>
+						<value label="Kilometers">KILOMETERS</value>
+						<value label="Miles">MILES</value>
+						<value label="Inches">INCHES</value>
+						<value label="Feet">FEET</value>
+						<value label="Pixels">PIXELS</value>
+						<value label="Percentages">PERCENTAGES</value>
+						<value label="DD">DD</value>
+						<value label="Nautical miles">NAUTICALMILES</value>
+					</availableValues>
+				</field>
+
+				<field name="TileIndex" type="string" mandatory="false"
+					defaultValue="" group="Tile Options">
+					<description> The tileindex contains polygon features for each
+						tile.
+					</description>
+				</field>
+				<field name="TileItem" type="string" mandatory="false"
+					defaultValue="location" group="Tile Options">
+					<description> Item that contains the location of an individual
+						tile.
+					</description>
+				</field>
+
+				<field name="Template" type="file" mandatory="false"
+					defaultValue="" group="Templates">
+					<description>Used as a global alternative to CLASS TEMPLATE.
+					</description>
+				</field>
+				<field name="Header" type="string" mandatory="false"
+					defaultValue="" group="Templates">
+					<description>Template to use before a layer’s set of results have
+						been sent. Multiresult query modes only.
+					</description>
+				</field>
+				<field name="Footer" type="string" mandatory="false"
+					defaultValue="" group="Templates">
+					<description>Template to use after a layer’s set of results have
+						been sent. Multiresult query modes only.
+					</description>
+				</field>
+
+				<field name="Tolerance" type="double" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Sensitivity for point based queries (i.e. via mouse
+						and/or map coordinates). Given in TOLERANCEUNITS.
+					</description>
+				</field>
+				<field name="ToleranceUnits" type="string" mandatory="false"
+					defaultValue="PIXELS" group="Layer Parameters">
+					<description>Sets the unit of CLASS object SIZE values
+					</description>
+					<availableValues>
+						<value label="Meters">METERS</value>
+						<value label="Kilometers">KILOMETERS</value>
+						<value label="Miles">MILES</value>
+						<value label="Inches">INCHES</value>
+						<value label="Feet">FEET</value>
+						<value label="Pixels">PIXELS</value>
+						<value label="Percentages">PERCENTAGES</value>
+						<value label="DD">DD</value>
+						<value label="Nautical miles">NAUTICALMILES</value>
+					</availableValues>
+				</field>
+				<field name="Transform" type="string" mandatory="false"
+					defaultValue="TRUE" group="Layer Parameters">
+					<description>Tells MapServer whether or not a particular layer
+						needs to be transformed from some coordinate system to image
+						coordinates.
+					</description>
+					<availableValues>
+						<value label="True">TRUE</value>
+						<value label="False">FALSE</value>
+						<value label="UL">UL</value>
+						<value label="UC">UC</value>
+						<value label="UR">UR</value>
+						<value label="LC">LC</value>
+						<value label="CC">CC</value>
+						<value label="LR">LR</value>
+						<value label="LL">LL</value>
+						<value label="LC">LC</value>
+					</availableValues>
+				</field>
+
+				<field name="Mask" type="string" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>The data from the current layer will only be rendered
+						where it intersects features from the layer.
+					</description>
+				</field>
+
+				<field name="Offsite" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Layer Parameters">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="Opacity" type="integer" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Sets the opacity level.</description>
+				</field>
+
+				<field name="Processing" type="string" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Passes a processing directive to be used with this
+						layer.
+					</description>
+				</field>
+				<field name="Requires" type="string" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description>Sets context for displaying this layer.</description>
+				</field>
+				<field name="Classes" type="List" hidden="true"
+					subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerClassForm" mandatory="false"
+					defaultValue="" group="Layer Parameters">
+					<description></description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverOutputFormatForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<fields>
+				<field name="Name" type="string" mandatory="false"
+					group="OutputFormat Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MimeType" type="string" mandatory="false"
+					group="OutputFormat Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Driver" type="string" mandatory="false"
+					group="OutputFormat Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Extension" type="string" mandatory="false"
+					group="OutputFormat Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+
+				<field name="ImageMode" type="string" mandatory="false"
+					defaultValue="RGBA" group="OutputFormat Options">
+					<description>Units used by the Layer</description>
+					<availableValues>
+						<value label="PC256">PC256</value>
+						<value label="RGB">RGB</value>
+						<value label="RGBA">RGBA</value>
+						<value label="Byte">BYTE</value>
+						<value label="Int16">INT16</value>
+						<value label="Float32">FLOAT32</value>
+						<value label="Feature">FEATURE</value>
+					</availableValues>
+				</field>
+				<field name="FormatOption" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="StringForm"
+					mandatory="false" defaultValue="" group="OutputFormat Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+				<field name="Transparent" type="string" mandatory="false"
+					defaultValue="ON" group="OutputFormat Options">
+					<description>Class status </description>
+					<availableValues>
+						<value label="ON">ON</value>
+						<value label="OFF">OFF</value>
+					</availableValues>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverWebForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<tags>
+				<value name="layoutMode" value="2" />
+			</tags>
+			<fields>
+				<field name="Metadata" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm"
+					mandatory="false" defaultValue="" group="Web Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+
+				<field name="BrowserFormat" type="string" mandatory="false"
+					group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="QueryFormat" type="string" mandatory="false"
+					group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="LegendFormat" type="string" mandatory="false"
+					group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Empty" type="string" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Error" type="string" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ImagePath" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="ImageUrl" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Log" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="TempPath" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Template" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Header" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="Footer" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MaxTemplate" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+				<field name="MinTemplate" type="file" mandatory="false" group="Web Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+
+				<field name="MinScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Web Options">
+					<description>Maximum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="MaxScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Web Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+			</fields>
+		</class>
+		<class name="MapserverMapForm">
+			<description>Store the parameters need to open a CSV file
+			</description>
+			<fields>
+				<field name="Name" type="string" mandatory="false" group="MapServer Options">
+					<description>Extent Min X coordinate</description>
+				</field>
+
+				<field name="Status" type="string" mandatory="false"
+					defaultValue="ON" group="MapServer Options">
+					<description>Class status </description>
+					<availableValues>
+						<value label="ON">ON</value>
+						<value label="OFF">OFF</value>
+					</availableValues>
+				</field>
+				<field name="Debug" type="string" mandatory="false"
+					defaultValue="OFF" group="MapServer Options">
+					<description>Enables debugging of a layer in the current map.
+					</description>
+					<availableValues>
+						<value label="OFF">OFF</value>
+						<value label="ON">ON</value>
+						<value label="1">1</value>
+						<value label="2">2</value>
+						<value label="3">3</value>
+						<value label="4">4</value>
+						<value label="5">5</value>
+					</availableValues>
+				</field>
+				<field name="Web" type="DynObject" classOfValue="MapserverWebForm"
+					mandatory="false" group="MapServer Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+
+				<field name="Include" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="StringForm"
+					mandatory="false" defaultValue="" group="MapServer Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+				<field name="Config" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverLayerMetadataForm"
+					mandatory="false" defaultValue="" group="MapServer Options">
+					<description>This keyword allows for arbitrary data to be stored as
+						name value pairs.
+					</description>
+					<tags>
+						<value name="ViewMode" value="SimpleTable" />
+					</tags>
+				</field>
+
+				<field name="Projection" type="DynObject" classOfValue="MapserverLayerProjectionForm"
+					mandatory="false" defaultValue="" group="Geographic Options">
+					<description>Sets the projection of the Layer.</description>
+				</field>
+				<field name="Extent" type="DynObject" classOfValue="MapserverLayerExtentForm"
+					mandatory="false" defaultValue="" group="Geographic Options">
+					<description>The spatial extent of the data.</description>
+				</field>
+
+				<field name="SymbolSet" type="file" mandatory="false"
+					defaultValue="" group="Source Options">
+					<description>Used as a global alternative to CLASS TEMPLATE.
+					</description>
+				</field>
+				<field name="FontSet" type="file" mandatory="false"
+					defaultValue="" group="Source Options">
+					<description>Used as a global alternative to CLASS TEMPLATE.
+					</description>
+				</field>
+				<field name="ShapePath" type="file" mandatory="false"
+					defaultValue="" group="Source Options">
+					<description>Used as a global alternative to CLASS TEMPLATE.
+					</description>
+				</field>
+				<field name="DataPattern" type="string" mandatory="false"
+					defaultValue="" group="Source Options">
+					<description>Sets context for displaying this layer.</description>
+				</field>
+
+				<field name="Size" type="DynObject" classOfValue="MapserverLayerOffsetForm"
+					mandatory="false" defaultValue="" group="Graphical Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="MaxSize" type="integer" mandatory="false"
+					defaultValue="" group="Graphical Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Resolution" type="integer" mandatory="false"
+					defaultValue="" group="Graphical Options">
+					<description>Sets context for displaying this layer.</description>
+				</field>
+				<field name="DefResolution" type="integer" mandatory="false"
+					defaultValue="" group="Graphical Options">
+					<description>Sets context for displaying this layer.</description>
+				</field>
+				<field name="ScaleDenom" type="double" mandatory="false"
+					defaultValue="" group="Graphical Options">
+					<description>Minimum scale at which this LAYER is shown.
+					</description>
+				</field>
+				<field name="Units" type="string" mandatory="false"
+					defaultValue="METERS" group="Geographic Options">
+					<description>Units used by the Layer</description>
+					<availableValues>
+						<value label="Meters">METERS</value>
+						<value label="Kilometers">KILOMETERS</value>
+						<value label="Miles">MILES</value>
+						<value label="Inches">INCHES</value>
+						<value label="Feet">FEET</value>
+						<value label="Pixels">PIXELS</value>
+						<value label="Percentages">PERCENTAGES</value>
+						<value label="DD">DD</value>
+						<value label="Nautical miles">NAUTICALMILES</value>
+					</availableValues>
+				</field>
+				<field name="Angle" type="double" mandatory="false"
+					defaultValue="" group="Graphical Options">
+					<description>Layer status </description>
+				</field>
+				<field name="ImageColor" type="DynObject" classOfValue="MapserverColorForm"
+					mandatory="false" defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="ImageType" type="string" mandatory="false"
+					defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+				<field name="TemplatePattern" type="string" mandatory="false"
+					defaultValue="" group="Color Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+				</field>
+
+				<field name="OutputFormat" type="List" subType="DynObject" typeOfItems="DynObject" classOfItems="MapserverOutputFormatForm"
+					mandatory="false" defaultValue="" group="OutputFormat Options">
+					<description>Sets the color index to treat as transparent for
+						raster layers.
+					</description>
+					<tags>
+						<value name="allowNew" value="true" />
+						<value name="allowDelete" value="true" />
+						<value name="allowUpdate" value="false" />
+						<value name="allowSearch" value="false" />
+						<value name="allowClose" value="false" />
+					</tags>
+				</field>
+			</fields>
+		</class>
+	</classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/MapserverLayerPropertiesForm2.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/TestDefinition.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/TestDefinition.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/TestDefinition.xml	(revision 1235)
@@ -0,0 +1,247 @@
+<?xml version="1.0"?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 3
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+
+
+    <class name="FormPackageinfo">
+
+      <description>Form definition for package.info data</description>
+      <fields>
+        <field name="code" label="Code" type="string" mandatory="true" order="1" group="General">
+          <description>Package code. It is usually a lowercase name separated by dots or dashes.</description>
+        </field>
+        
+        <field name="name" label="Name" type="string" mandatory="true" group="General">
+          <description>Name of the package</description>
+        </field> 
+        
+        <field name="description" label="Description" type="string" subtype="text" group="General">
+          <description></description>
+        </field>      
+        
+        <field name="categories" label="Categories" type="string" group="General">
+          <description>Categories list separated by commas, for example:  View,Vector</description>
+        </field>      
+        
+        <field name="version" label="Version" type="string" mandatory="true" defaultValue="1.0.0-0" group="General">
+          <description>Version number of the package. The last number should be the same as the number of build</description>
+        </field> 
+        
+        <field name="buildNumber" label="Build" type="integer" mandatory="true" defaultValue="0" group="General">
+          <description>Build number of the package</description>
+        </field> 
+        
+        <field name="state" label="State" type="string" mandatory="false" defaultValue="testing" group="General">
+          <description>State of the package</description>
+          <availableValues>
+          	<value label="devel">devel</value>
+            <value label="testing">testing</value>
+            <value label="pilot">pilot</value>
+            <value label="prototype">prototype</value>
+            <value label="alpha1">alpha1</value>
+            <value label="alpha2">alpha2</value>
+            <value label="alpha3">alpha3</value>
+            <value label="beta1">beta1</value>
+            <value label="beta2">beta2</value>
+            <value label="beta3">beta3</value>
+            <value label="RC1">RC1</value>
+            <value label="RC2">RC2</value>
+            <value label="RC3">RC3</value>
+            <value label="final">final</value>
+          </availableValues>
+        </field>
+        
+        <field name="official" label="Official" type="boolean" group="General">
+          <description>Check if the package is a official package of gvSIG project</description>
+        </field>
+
+        <field name="sources-url" label="Source code URL" type="URL" mandatory="false" group="General">
+          <description>URL to the source of the package</description>
+        </field>      
+
+        <field name="owner" label="Package owner" type="string" mandatory="true" group="Owner">
+          <description>Package owner</description>
+        </field>      
+
+        <field name="web-url" label="Package owner URL" type="URL" mandatory="false" group="Owner">
+          <description>URL to the home page of the package owner</description>
+        </field>      
+
+
+        
+        <field name="operating-system" label="Operating System" type="string" mandatory="true" defaultValue="all" group="Requeriments">
+          <description>Operating system that require this package</description>
+          <availableValues>
+          	<value label="all">all</value>
+            <value label="Linux">lin</value>
+            <value label="Windows">win</value>
+            <value label="MAC OSX 10.4">osx_10_4</value>
+            <value label="MAC OSX 10.5">osx_10_5</value>
+            <value label="MAC OSX 10.6">osx_10_6</value>
+            <value label="MAC OSX 10.7">osx_10_7</value>
+            <value label="MAC OSX 10.8">osx_10_8</value>
+            <value label="MAC OSX 10.9">osx_10_9</value>
+          </availableValues>
+        </field>
+
+        <field name="architecture" label="Architecture" type="string" mandatory="true" defaultValue="all" group="Requeriments">
+          <description>Operating system that require this package</description>
+          <availableValues>
+          	<value label="all">all</value>
+            <value label="x86">x86</value>
+            <value label="x86_64/AMD64">x86_64</value>
+            <value label="PowerPC">PowerPC</value>
+          </availableValues>
+        </field>
+
+        <field name="java-version" label="Java version" type="string" mandatory="true" defaultValue="j1_5" group="Requeriments">
+          <description>Minimun java version required to run this package</description>
+          <availableValues>
+          	<value label="Java 1.5">j1_5</value>
+            <value label="Java 1.6">j1_6</value>
+            <value label="Java 1.7">j1_7</value>
+            <value label="Java 1.8">j1_8</value>
+          </availableValues>
+        </field>
+
+        <field name="gvSIG-version" label="gvSIG version" type="string" mandatory="true" defaultValue="2.0.0" group="Requeriments">
+          <description>gvSIG version for which this package has been created</description>
+        </field>      
+
+        <field name="dependencies" label="Dependencies" type="string" mandatory="false" group="Requeriments">
+          <description>Specifies the dependencies or conflicts with other packates</description>
+        </field>      
+
+        <field name="code-alias" label="Code alias" type="string" mandatory="false" group="Others">
+          <description>Alternative value for the code. It is useful when a renamed package to maintain compatibility with dependencies that other packages might have with this.</description>
+        </field>      
+
+           
+      </fields>
+    </class>
+
+    <class name="DBFStoreParameters">
+
+      <description>Store the parameters need to open a dbf file</description>
+      <fields>
+        <field name="DbfFile" type="file" mandatory="true" group="Basic" order="1">
+          <description>dbf file</description>
+        </field>
+        <field name="ProviderName" type="string" mandatory="true" group="Advanced">
+          <description>Name of the provider</description>
+        </field> 
+        <field name="description" type="string" subtype="text" mandatory="true" group="Advanced">
+          <description>Description ......</description>
+        </field>      
+
+        <field name="Encoding" type="string" mandatory="false" group="Basic" defaultValue="UTF-16">
+          <description>Encoding used in this file</description>
+          <availableValues>
+          	<value label="(default)"></value>
+            <value label="US-ASCII">US-ASCII</value>
+            <value label="ISO-8859-1">ISO-8859-1</value>
+            <value label="ISO-8859-15">ISO-8859-15</value>
+            <value label="windows-1250">windows-1250</value>
+            <value label="windows-1252">windows-1252</value>
+            <value label="UTF-8">UTF-8</value>
+            <value label="UTF-16">UTF-16</value>
+            <value label="UTF-16BE">UTF-16BE</value>
+            <value label="UTF-16LE">UTF-16LE</value>
+          </availableValues>
+        </field>
+        <field name="codePage" type="Integer" mandatory="false"  group="Advanced">          
+          <description>Code page used in this file</description>
+          <availableValues>
+            <value label="DOS USA">0x01</value>
+            <value label="DOS Multilingual">0x02</value>
+            <value label="Windows ANSI">0x03</value>
+            <value label="Standard Macintosh">0x04</value>
+            <value label="EE MS-DOS">0x64</value>
+            <value label="Nordic MS-DOS">0x65</value>
+            <value label="Russian MS-DOS">0x66</value>
+            <value label="Icelandic MS-DOS">0x67</value>
+            <value label="Kamenicky (Czech) MS-DOS">0x68</value>
+            <value label="Mazovia (Polish) MS-DOS">0x69</value>
+            <value label="Greek MS-DOS (437G)">0x6A</value>
+            <value label="Turkish MS-DOS">0x6B</value>
+            <value label="Russian Macintosh">0x96</value>
+            <value label="Macintosh">0x97</value>
+            <value label="Greek Macintosh">0x98</value>
+            <value label="Windows EE">0xC8</value>
+            <value label="Russian Windows">0xC9</value>
+            <value label="Turkish Windows">0xCA</value>
+            <value label="Greek Windows">0xCB</value>
+          </availableValues> 
+        </field>
+        
+        <field label="un entero" name="entero" type="integer" minValue="10" maxValue="100" group="Test tipos">
+        </field>
+        <field name="doble" type="double" group="Test tipos">
+        </field>
+        <field name="float" type="float" group="Test tipos">
+        </field>
+        <field name="boolean" type="boolean" group="Test tipos">
+        </field>
+        <field name="date" type="date" group="Test tipos">
+        </field>
+        <field name="time" type="time" group="Test tipos">
+        </field>
+        <field name="timestamp" type="timestamp" group="Test tipos">
+        </field>
+        <field name="byte" type="byte" group="Test tipos">
+        </field>
+        <field name="folder" type="folder" group="Test tipos">
+        </field>
+        <field name="url" type="url" group="Test tipos">
+        </field>
+        <field name="uri" type="uri" group="Test tipos">
+        </field>
+        <field name="long" type="long" group="Test tipos">
+        </field>
+        <field name="char" type="char" group="Test tipos">
+        </field>
+        <field name="version" type="version" group="Test tipos">
+        </field>
+        
+        <field name="dynobject" type="DYNOBJECT" StructWhenTypeIsDynObject="FormPackageinfo" group="Test containers">
+        </field>
+        <field name="array" type="ARRAY" group="Test containers">
+        </field>
+        <field name="list" type="LIST" group="Test containers">
+        </field>
+        <field name="set" type="SET" group="Test containers">
+        </field>
+        <field name="map" type="MAP" group="Test containers">
+        </field>
+        
+           
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/TestDefinition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/log4j.properties
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/log4j.properties	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/log4j.properties	(revision 1235)
@@ -0,0 +1,12 @@
+log4j.rootLogger=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# Pattern to output the caller's file name and line number.
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
+
+log4j.logger.org.gvsig.andami.plugins=INFO  
+log4j.logger.org.gvsig.tools.dataTypes=INFO
+log4j.logger.org.gvsig.installer.lib.impl.DefaultDependenciesCalculator=DEBUG
+  
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/main/log4j.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/problem.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/problem.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/transparent.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/transparent.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/delete.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/delete.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/last.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/last.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/close.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/close.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/search.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/search.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/first.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/first.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/new.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/new.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/previous.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/previous.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/next.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/next.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/save.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/org/gvsig/tools/dynform/impl/save.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.dynform.impl.DefaultDynFormLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/pom.xml	(revision 1235)
@@ -0,0 +1,61 @@
+<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>
+   <packaging>jar</packaging>
+  <parent>
+    <groupId>org.gvsig</groupId>
+    <artifactId>org.gvsig.tools.dynform</artifactId>
+    <version>3.0.57</version>
+  </parent>
+  <artifactId>org.gvsig.tools.dynform.impl</artifactId>
+  <name>org.gvsig.tools.dynform.impl</name>
+  <description>DynForms implementation</description>
+  <dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.swing.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.api</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.spi</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.dynform.services</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+		  <groupId>log4j</groupId>
+		  <artifactId>log4j</artifactId>
+		  <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.jgoodies</groupId>
+			<artifactId>jgoodies-common</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.jgoodies</groupId>
+			<artifactId>jgoodies-forms</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.jgoodies</groupId>
+			<artifactId>looks</artifactId>
+		</dependency>
+                <dependency>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-lang3</artifactId>
+                    <scope>compile</scope>
+            </dependency>
+	</dependencies>
+</project>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/pom.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl
___________________________________________________________________
Added: svn:ignore
   + .project

target

.classpath

.settings



Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.dynform
___________________________________________________________________
Added: svn:ignore
   + .project
.settings
target


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/resources/log4j.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/resources/log4j.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/resources/log4j.xml	(revision 1235)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- 
+Log4J configuration file for unit tests execution.
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<!-- Appender configuration to show logging messages through the console -->
+	<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>
+
+	<!-- 
+	Activate logging messages of DEBUG level of higher only for the
+	org.gvsig.tools packages.
+	You can put full classes names or packages instead, to configure
+	logging for all the classes and subpackages of the package.
+	-->
+	<category name="org.gvsig.tools">
+		<priority value="DEBUG" />
+	</category>
+
+	<!-- 
+	By default, show only logging messages of INFO level or higher, 
+	through the previously configured CONSOLE appender. 
+	-->
+	<root>
+		<priority value="INFO" />
+		<appender-ref ref="CONSOLE" />
+	</root>
+</log4j:configuration>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/window/ModalAction.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/window/ModalAction.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/window/ModalAction.java	(revision 1235)
@@ -0,0 +1,123 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.main.window;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.main.MainAction;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+
+/**
+ * Shows the panel of usability components.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team 
+ */
+public class ModalAction extends MainAction {
+
+
+    private static final WindowManager manager =
+        ToolsSwingLocator.getWindowManager();
+
+    /**
+     * @see MainAction#MainAction(JTabbedPane)
+     */
+    public ModalAction(JTabbedPane tabbedPane) {
+        super("Modal", tabbedPane);
+        putValue(SHORT_DESCRIPTION, "Modal components");
+    }
+
+    @Override
+    protected JComponent createComponent() {
+        JPanel panel = new JPanel();
+        panel.setLayout(new FlowLayout());
+        JButton button = new JButton(new Action() {
+			
+			public void actionPerformed(ActionEvent arg0) {
+				JTextField jtext = new JTextField();
+				jtext.setPreferredSize(new Dimension(300, 30));
+				
+				JPanel auxpanel = new JPanel();
+				auxpanel.add(jtext);
+				WindowManager wm = ToolsSwingLocator.getWindowManager();
+				wm.showWindow(auxpanel, "HOLA", WindowManager.MODE.DIALOG);
+				System.out.println("Value = "+jtext.getText());
+			}
+			
+			public void setEnabled(boolean b) {
+				// TODO Auto-generated method stub
+				
+			}
+			
+			public void removePropertyChangeListener(PropertyChangeListener listener) {
+				// TODO Auto-generated method stub
+				
+			}
+			
+			public void putValue(String key, Object value) {
+				// TODO Auto-generated method stub
+				
+			}
+			
+			public boolean isEnabled() {
+				return true;
+			}
+			
+			public Object getValue(String key) {
+				// TODO Auto-generated method stub
+				return null;
+			}
+			
+			public void addPropertyChangeListener(PropertyChangeListener listener) {
+				// TODO Auto-generated method stub
+				
+			}
+		});
+        button.setText("Show modal window");
+        panel.add(button);
+
+        return panel;
+    }
+
+    @Override
+    protected String getComponentTitle() {
+        return "Modal";
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/README.txt	(revision 1235)
@@ -0,0 +1,34 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+To add a new tab to the application, perform the following steps:
+
+- Create a new class extending the MainAction class, implementing the methods:
+
+  - createComponent(): create your demo panel
+  
+  - getComponentTitle(): return the name of the panel
+  
+- Add your new action class to the list of actions in the Main.createActions()
+  method. 
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/MainAction.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/MainAction.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/MainAction.java	(revision 1235)
@@ -0,0 +1,83 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.main;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JTabbedPane;
+
+/**
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class MainAction extends AbstractAction {
+
+    private static final long serialVersionUID = 7286136693329716214L;
+    private final JTabbedPane tabbedPane;
+
+    /**
+     * @see AbstractAction#AbstractAction()
+     */
+    public MainAction(JTabbedPane tabbedPane) {
+        super(); 
+        this.tabbedPane = tabbedPane;
+    }
+
+    /**
+     * @see AbstractAction#AbstractAction(String)
+     */
+    public MainAction(String name, JTabbedPane tabbedPane) {
+        super(name);
+        this.tabbedPane = tabbedPane;
+    }
+
+    /**
+     * @see AbstractAction#AbstractAction(String, Icon)
+     */
+    public MainAction(String name, Icon icon, JTabbedPane tabbedPane) {
+        super(name, icon);
+        this.tabbedPane = tabbedPane;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        String title = getComponentTitle();
+        int index = tabbedPane.indexOfTab(title);
+        if (index <= -1) {
+            tabbedPane.addTab(title, createComponent());
+            index = tabbedPane.indexOfTab(title);
+        }
+        tabbedPane.setSelectedIndex(index);
+    }
+
+    protected abstract JComponent createComponent();
+
+    protected abstract String getComponentTitle();
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/Main.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/Main.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/Main.java	(revision 1235)
@@ -0,0 +1,122 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.main;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.JToolBar;
+import javax.swing.WindowConstants;
+
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.gvsig.tools.main.taskstatus.JTaskStatusAction;
+import org.gvsig.tools.main.usability.UsabilityAction;
+import org.gvsig.tools.main.window.ModalAction;
+
+/**
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class Main {
+
+    private JTabbedPane tabbedPane;
+    private JMenuBar menuBar;
+    private JToolBar toolBar; 
+
+    public static void main(String args[]) {
+        new DefaultLibrariesInitializer().fullInitialize();
+        Main main = new Main();
+        main.show();
+    }
+
+    public void show() {
+
+        final JFrame frame = new JFrame("Tools swing components test app");
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+
+        // Add a tabbed pane as a content pane
+        tabbedPane = new JTabbedPane();
+        tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
+        frame.getContentPane().add(tabbedPane);
+
+        // Create application actions
+        MainAction[] actions = createActions();
+
+        // Create the menu bar.
+        menuBar = new JMenuBar();
+
+        // Build the menu.
+        JMenu menuFile = new JMenu("File");
+        JMenuItem menuItemExit = new JMenuItem("Exit");
+        menuItemExit.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                frame.dispose();
+                System.exit(0);
+            }
+        });
+        menuFile.add(menuItemExit);
+        menuBar.add(menuFile);
+
+        // Add all actions to the menu bar
+        JMenu menuDemo = new JMenu("Tools components");
+        for (int i = 0; i < actions.length; i++) {
+            menuDemo.add(new JMenuItem(actions[i]));
+        }
+        menuBar.add(menuDemo);
+
+        // Build the toolbar
+        toolBar = new JToolBar("Main toolbar");
+
+        // Add all actions to the toolbar
+        for (int i = 0; i < actions.length; i++) {
+            toolBar.add(new JButton(actions[i]));
+        }
+
+        frame.setPreferredSize(new Dimension(800, 600));
+
+        frame.setJMenuBar(menuBar);
+        frame.add(toolBar, BorderLayout.PAGE_START);
+
+        // Display the window.
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    private MainAction[] createActions() {
+        return new MainAction[] { 
+            new UsabilityAction(tabbedPane),
+            new JTaskStatusAction(tabbedPane),
+            new ModalAction(tabbedPane)
+        };
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/usability/UsabilityAction.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/usability/UsabilityAction.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/usability/UsabilityAction.java	(revision 1235)
@@ -0,0 +1,156 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.main.usability;
+
+import java.awt.Component;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.main.MainAction;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+
+/**
+ * Shows the panel of usability components.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team 
+ */
+public class UsabilityAction extends MainAction {
+
+    private static final long serialVersionUID = 6471916708466720365L;
+
+    private static final UsabilitySwingManager manager =
+        ToolsSwingLocator.getUsabilitySwingManager();
+
+    /**
+     * @see MainAction#MainAction(JTabbedPane)
+     */
+    public UsabilityAction(JTabbedPane tabbedPane) {
+        super("Usability", tabbedPane);
+        putValue(SHORT_DESCRIPTION, "Usability components");
+    }
+
+    @Override
+    protected JComponent createComponent() {
+        JTabbedPane tabbedPane = new JTabbedPane();
+        tabbedPane.setTabPlacement(JTabbedPane.RIGHT);
+
+        tabbedPane.addTab("JButton", createJButtonComponent());
+        tabbedPane.addTab("JTextArea", createJTextAreaComponent());
+        tabbedPane.addTab("JNullSpinner", createJNullSpinnerComponent());
+        return tabbedPane;
+    }
+
+    @Override
+    protected String getComponentTitle() {
+        return "Usability";
+    }
+
+    private Component createJButtonComponent() {
+        // Create the container panel
+        JPanel panel = new JPanel();
+        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+        // panel.setLayout(new GridLayout(18, 1));
+        // panel.setLayout(new );
+        JButton button = manager.createJButton("+");
+        panel.add(button); 
+        button = manager.createJButton("-");
+        panel.add(button);
+        button = manager.createJToolButton("+");
+        panel.add(button); 
+        button = manager.createJToolButton("-");
+        panel.add(button);
+        // Create buttons with different sizes
+        StringBuffer text = new StringBuffer("012");
+        for (int i = 4; i < 22; i++) {
+            text.append(String.valueOf(i % 10));
+            button = manager.createJButton(text.toString());
+            panel.add(button);
+        }
+
+        return panel;
+    }
+
+    private Component createJTextAreaComponent() {
+        // Create the container panel
+        JPanel panel = new JPanel();
+        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+        // panel.setLayout(new GridLayout(18, 1));
+        // panel.setLayout(new );
+        JTextArea ta = manager.createJTextArea("");       
+        ta = manager.createJTextArea("test");
+        panel.add(ta); 
+        ta = manager.createJTextArea("test longer");
+        panel.add(ta);
+        ta = manager.createJTextArea("test much longer");
+        panel.add(ta); 
+        ta = manager.createJTextArea("test");
+        panel.add(ta); 
+        ta = manager.createJTextArea("test size = 150", 150);
+        panel.add(ta); 
+        ta = manager.createJTextArea("test too long", -1);
+        panel.add(ta);
+        // Create buttons with different sizes
+        StringBuffer text = new StringBuffer("012");
+        for (int i = 4; i < 22; i++) {
+            text.append(String.valueOf(i % 10));
+            ta = manager.createJTextArea(text.toString());
+            panel.add(ta);
+        }
+   
+        
+        return panel;
+    }
+
+    private Component createJNullSpinnerComponent() {
+        // Create the container panel
+        JPanel panel = new JPanel();
+        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+        // panel.setLayout(new GridLayout(18, 1));
+        // panel.setLayout(new );
+        JSpinner spinner = manager.createJNullSpinner(DataTypes.FLOAT, "1.05", -1);
+        panel.add(spinner);
+        // Create buttons with different sizes
+        StringBuffer text = new StringBuffer("01287.");
+        for (int i = 4; i < 22; i++) {
+            text.append(String.valueOf(i % 10));
+            spinner = manager.createJNullSpinner(DataTypes.FLOAT, text.toString(), -1);
+            panel.add(spinner);
+        }
+
+        return panel;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/taskstatus/JTaskStatusAction.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/taskstatus/JTaskStatusAction.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/taskstatus/JTaskStatusAction.java	(revision 1235)
@@ -0,0 +1,112 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.main.taskstatus;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+import org.gvsig.tools.main.MainAction;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.task.JTaskStatus;
+import org.gvsig.tools.swing.api.task.JTasksStatus;
+import org.gvsig.tools.swing.api.task.TaskStatusSwingManager;
+import org.gvsig.tools.task.AbstractMonitorableTask;
+
+public class JTaskStatusAction extends MainAction {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5408828606365712614L;
+
+	public JTaskStatusAction(JTabbedPane tabbedPane) {
+		super("Task status", tabbedPane);
+        putValue(SHORT_DESCRIPTION, "Task status");
+	}
+
+	private class MiTask extends AbstractMonitorableTask {
+		
+		private int max;
+		private int sleepInterval;
+		
+		public MiTask(String tittle, int max, int sleepInterval) {
+			super(tittle);
+			this.max = max;
+			this.sleepInterval = sleepInterval;
+		}
+		public MiTask(String tittle, int max) {
+			this(tittle, max, 100);
+		}
+		public void run() {
+			this.taskStatus.setRangeOfValues(0, this.max);
+			for(int i=0; i<this.max; i++ ) {
+				this.taskStatus.setCurValue(i);
+				try {
+					Thread.sleep(sleepInterval);
+				} catch (InterruptedException e) {
+					// Ignore
+				}
+				if( this.taskStatus.isCancellationRequested() ) {
+					this.taskStatus.cancel();
+					break;
+				}
+			}
+			if( this.taskStatus.isRunning() ) {
+				this.taskStatus.terminate();
+			}
+		}
+	}
+	
+	protected JComponent createComponent() {
+		TaskStatusSwingManager manager = ToolsSwingLocator.getTaskStatusSwingManager();
+		JPanel panel = new JPanel();
+		panel.setLayout( new FlowLayout());
+		JTasksStatus tasks = manager.createJTasksStatus();
+		tasks.setBackground(Color.BLUE.brighter());
+		panel.add( tasks );
+		JTaskStatus taskStatusPanel = manager.createJTaskStatus();
+		panel.add( taskStatusPanel );
+		
+		MiTask task1 = new MiTask("Task1",100);
+		task1.start();
+		MiTask task2 = new MiTask("Task2",300);
+		task2.start();
+		MiTask task3 = new MiTask("Task3",1000);
+		task3.start();
+		MiTask task4 = new MiTask("Task4",50,5000);
+		task4.start();
+
+		taskStatusPanel.bind(task1.getTaskStatus());
+		return panel;
+	}
+
+	protected String getComponentTitle() {
+		return "Task status";
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/taskstatus/JTaskStatusAction.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/test/java/org/gvsig/tools/main/AppTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/test/java/org/gvsig/tools/main/AppTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/src/test/java/org/gvsig/tools/main/AppTest.java	(revision 1235)
@@ -0,0 +1,58 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.main;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest extends TestCase {
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(AppTest.class);
+    }
+
+    /**
+     * Create the test case
+     * 
+     * @param testName
+     *            name of the test case
+     */
+    public AppTest(String testName) {
+        super(testName);
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp() {
+        assertTrue(true);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main/pom.xml	(revision 1235)
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.main</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.main</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools</artifactId>
+        <version>3.0.57</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.api</artifactId>
+        </dependency>
+       <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+   </dependencies>
+</project>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.main
___________________________________________________________________
Added: svn:ignore
   + target
.settings
.classpath
.project
bin


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/README.txt	(revision 1235)
@@ -0,0 +1,32 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+For each class you are going to test, create one Test class with the same
+name as the class to test, ending with Test.
+
+For example, the unit tests of the "ExampleLibrary" class are performed
+by the "ExampleLibraryTest" class.
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/locator/AbstractLocatorTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/locator/AbstractLocatorTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/locator/AbstractLocatorTest.java	(revision 1235)
@@ -0,0 +1,133 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+package org.gvsig.tools.locator;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the AbstractLocator class.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class AbstractLocatorTest extends TestCase {
+
+    private TestLocator locator;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        locator = new TestLocator();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for {@link org.gvsig.tools.locator.AbstractLocator#getNames()}.
+     */
+    public void testGetNames() {
+        assertNull("Empty locator must not return any names", locator
+                .getNames());
+
+        String name1 = "test1";
+        String name2 = "test2";
+
+        locator.register(name1, String.class);
+        locator.register(name2, String.class);
+
+        String[] names = locator.getNames();
+
+        assertEquals("Number of registered names incorrect, must be 2", 2,
+                names.length);
+
+        Collection namesColl = Arrays.asList(names);
+        assertTrue("The list of names does not contain the registered name: "
+                + name1, namesColl.contains(name1));
+        assertTrue("The list of names does not contain the registered name: "
+                + name2, namesColl.contains(name2));
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.locator.AbstractLocator#get(java.lang.String)} and
+     * {@link org.gvsig.tools.locator.AbstractLocator#register(java.lang.String, java.lang.Class)}
+     */
+    public void testGetAndRegisterClass() {
+        Class clazz = String.class;
+        String name = "test";
+
+        locator.register(name, clazz);
+
+        Object ref = locator.get(name);
+
+        assertEquals(clazz, ref.getClass());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.locator.AbstractLocator#get(java.lang.String)} and
+     * {@link org.gvsig.tools.locator.AbstractLocator#register(String, LocatorObjectFactory)
+
+     */
+    public void testGetAndRegisterFactory() {
+        final Object ref = new Object();
+        LocatorObjectFactory factory = new LocatorObjectFactory() {
+
+            public Object create() {
+                return ref;
+            }
+
+            public Object create(Object[] args) {
+                return ref;
+            }
+
+            public Object create(Map args) {
+                return ref;
+            }
+        };
+
+        String name = "test";
+
+        locator.register(name, factory);
+
+        Object locatorRef = locator.get(name);
+
+        assertEquals(ref, locatorRef);
+    }
+
+    public class TestLocator extends AbstractLocator {
+        public String getLocatorName() {
+            return "TestLocator";
+        }
+    }
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibrariesInitializerTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibrariesInitializerTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibrariesInitializerTest.java	(revision 1235)
@@ -0,0 +1,320 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.library;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the {@link AbstractLibrariesInitializer} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class AbstractLibrariesInitializerTest extends TestCase {
+
+    private Library lib1api = new Lib1API();
+    private Library lib1impl = new Lib1Impl();
+    private Library lib1prov1 = new Lib1Prov1();
+    private Library lib1prov2 = new Lib1Prov2();
+    private Library lib2api = new Lib2API();
+    private Library lib2impl = new Lib2Impl();
+    private Library lib2prov1 = new Lib2Prov1();
+    private Library lib3api = new Lib3API();
+    private Library lib3impl = new Lib3Impl();
+    private Library lib4api = new Lib4API();
+    private Library lib4impl1 = new Lib4Impl1();
+    private Library lib4impl2 = new Lib4Impl2();
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testInitialize() {
+        // Test with 3 different libs orders just in case
+        testInitializer(new TestLibrariesInitializer1());
+        testInitializer(new TestLibrariesInitializer2());
+        testInitializer(new TestLibrariesInitializer3());
+    }
+
+    private void testInitializer(AbstractLibrariesInitializer init) {
+        // This is an ordered set
+        List libs = init.getLibraries();
+
+        checkOrder(libs);
+    }
+
+    private void checkOrder(List libs) {
+        int ilib1api = libs.indexOf(lib1api);
+        int ilib1impl = libs.indexOf(lib1impl);
+        int ilib1prov1 = libs.indexOf(lib1prov1);
+        int ilib1prov2 = libs.indexOf(lib1prov2);
+        int ilib2api = libs.indexOf(lib2api);
+        int ilib2impl = libs.indexOf(lib2impl);
+        int ilib2prov1 = libs.indexOf(lib2prov1);
+        int ilib3api = libs.indexOf(lib3api);
+        int ilib3impl = libs.indexOf(lib3impl);
+        int ilib4api = libs.indexOf(lib4api);
+        int ilib4impl1 = libs.indexOf(lib4impl1);
+        int ilib4impl2 = libs.indexOf(lib4impl2);
+
+        // Check all needed libraries have been included into the list
+        assertTrue("Lib1API is not included in the list", ilib1api > -1);
+        assertTrue("Lib1Impl is not included in the list", ilib1impl > -1);
+        assertTrue("Lib1Prov1 is not included in the list", ilib1prov1 > -1);
+        assertTrue("Lib1Prov2 is not included in the list", ilib1prov2 > -1);
+        assertTrue("Lib2API is not included in the list", ilib2api > -1);
+        assertTrue("Lib2Impl is not included in the list", ilib2impl > -1);
+        assertTrue("Lib2Prov1 is not included in the list", ilib2prov1 > -1);
+        assertTrue("Lib3API is not included in the list", ilib3api > -1);
+        assertTrue("Lib3Impl is not included in the list", ilib3impl > -1);
+        assertTrue("Lib4API is not included in the list", ilib4api > -1);
+
+        // Check implementation priorities
+        assertEquals(
+            "Lib4Impl1 has less priority than Lib4Impl2, it must not be initialized",
+            ilib4impl1, -1);
+        assertTrue(
+            "Lib4Impl2 has more priority than Lib4Impl1, it must have been initialized",
+            ilib4impl2 > -1);
+
+        // Check api-impl-service(provider) relationships:
+        // first API, next Impl and then services (providers)
+        assertTrue("Lib1API must be initialized before Lib1Impl",
+            ilib1api < ilib1impl);
+        assertTrue("Lib1Impl must be initialized before Lib1Prov1",
+            ilib1impl < ilib1prov1);
+        assertTrue("Lib1Impl must be initialized before Lib1Prov2",
+            ilib1impl < ilib1prov2);
+
+        assertTrue("Lib2API must be initialized before Lib2Impl",
+            ilib2api < ilib2impl);
+        assertTrue("Lib2Impl must be initialized before Lib2Prov1",
+            ilib2impl < ilib2prov1);
+
+        assertTrue("Lib3API must be initialized before Lib3Impl",
+            ilib3api < ilib3impl);
+
+        assertTrue("Lib4API must be initialized before Lib4Impl",
+            ilib4api < ilib4impl2);
+
+        // Check dependencies between libraries
+        assertTrue(
+            "Lib2Impl dependends on Lib1API, must be initialized after it",
+            ilib1api < ilib2impl);
+        assertTrue(
+            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Impl",
+            ilib1impl < ilib2impl);
+        assertTrue(
+            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Prov1",
+            ilib1prov1 < ilib2impl);
+        assertTrue(
+            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Prov2",
+            ilib1prov2 < ilib2impl);
+
+        assertTrue(
+            "Lib2Prov1 dependends on Lib3API, must be initialized afterwards",
+            ilib3api < ilib2prov1);
+        assertTrue(
+            "Lib2Prov1 dependends on Lib3Impl, must be initialized after it",
+            ilib3impl < ilib2prov1);
+
+        assertTrue(
+            "Lib4API dependends on Lib2Prov1, must be initialized after it",
+            ilib4api > ilib2prov1);
+    }
+
+    private class TestLibrariesInitializer1 extends
+        AbstractLibrariesInitializer {
+
+        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+            Set libs = new LinkedHashSet();
+
+            libs.add(lib4impl1);
+            libs.add(lib2api);
+            libs.add(lib2impl);
+            libs.add(lib2prov1);
+            libs.add(lib1api);
+            libs.add(lib1impl);
+            libs.add(lib4impl2);
+            libs.add(lib1prov1);
+            libs.add(lib1prov2);
+            libs.add(lib3api);
+            libs.add(lib3impl);
+            libs.add(lib4api);
+
+            return libs;
+        }
+
+    }
+
+    private class TestLibrariesInitializer2 extends
+        AbstractLibrariesInitializer {
+
+        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+            Set libs = new LinkedHashSet();
+
+            libs.add(lib2api);
+            libs.add(lib4impl1);
+            libs.add(lib2prov1);
+            libs.add(lib1impl);
+            libs.add(lib4impl2);
+            libs.add(lib3impl);
+            libs.add(lib2impl);
+            libs.add(lib1api);
+            libs.add(lib1prov2);
+            libs.add(lib3api);
+            libs.add(lib1prov1);
+            libs.add(lib4api);
+
+            return libs;
+        }
+
+    }
+
+    private class TestLibrariesInitializer3 extends
+        AbstractLibrariesInitializer {
+
+        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+            Set libs = new LinkedHashSet();
+
+            libs.add(lib4api);
+            libs.add(lib2prov1);
+            libs.add(lib2api);
+            libs.add(lib4impl2);
+            libs.add(lib3api);
+            libs.add(lib1api);
+            libs.add(lib4impl1);
+            libs.add(lib2impl);
+            libs.add(lib1prov2);
+            libs.add(lib3impl);
+            libs.add(lib1impl);
+            libs.add(lib1prov1);
+
+            return libs;
+        }
+
+    }
+
+    private class DummyLibrary extends AbstractLibrary {
+
+        protected void doInitialize() throws LibraryException {
+            // Nothing to do
+        }
+
+        protected void doPostInitialize() throws LibraryException {
+            // Nothing to do
+        }
+    }
+
+    private class Lib1API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(Lib1API.class);
+        }
+    }
+
+    private class Lib1Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(Lib1API.class);
+        }
+    }
+
+    private class Lib1Prov1 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(Lib1API.class);
+        }
+    }
+
+    private class Lib1Prov2 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(Lib1API.class);
+        }
+    }
+
+    private class Lib2API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(Lib2API.class);
+        }
+    }
+
+    private class Lib2Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(Lib2API.class);
+            require(Lib1API.class);
+        }
+    }
+
+    private class Lib2Prov1 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(Lib2API.class);
+            require(Lib3API.class);
+        }
+    }
+
+    private class Lib3API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(Lib3API.class);
+        }
+    }
+
+    private class Lib3Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(Lib3API.class);
+        }
+    }
+
+    private class Lib4API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(Lib4API.class);
+            require(Lib2Prov1.class);
+        }
+    }
+
+    private class Lib4Impl1 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(Lib4API.class);
+        }
+    }
+
+    private class Lib4Impl2 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(Lib4API.class, 10);
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibraryTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibraryTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibraryTest.java	(revision 1235)
@@ -0,0 +1,101 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.library;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the {@link AbstractLibrary} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class AbstractLibraryTest extends TestCase {
+
+	private AbstractLibrary baseLibrary;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		baseLibrary = new DummyLibrary();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.library.AbstractLibrary.BaseLibrary#initialize()}.
+	 */
+	public void testInitialize() {
+		baseLibrary.initialize();
+
+		// If BaseLibrary is not working as expected, those invocations will
+		// fail
+		baseLibrary.initialize();
+		baseLibrary.initialize();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.library.AbstractLibrary#postInitialize()}.
+	 */
+	public void testPostInitialize() {
+		baseLibrary.postInitialize();
+
+		// If BaseLibrary is not working as expected, those invocations will
+		// fail
+		baseLibrary.postInitialize();
+		baseLibrary.postInitialize();
+	}
+
+	public static class DummyLibrary extends AbstractLibrary {
+
+		public static boolean alreadyInitialized = false;
+		public static boolean alreadyPostInitialized = false;
+		
+		public void doRegistration() {
+			super.doRegistration();
+			registerAsAPI(DummyLibrary.class);
+		}
+
+		protected void doInitialize() throws LibraryException {
+			if (alreadyInitialized) {
+				throw new RuntimeException(
+						"The DymmyLibrary is already initialized");
+			}
+			alreadyInitialized = true;
+		}
+
+		protected void doPostInitialize() throws LibraryException {
+			if (alreadyPostInitialized) {
+				throw new RuntimeException(
+						"The DymmyLibrary is already postInitialized");
+			}
+			alreadyPostInitialized = true;
+		}
+
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug67Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug67Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug67Test.java	(revision 1235)
@@ -0,0 +1,220 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.library;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for the 16017 bug.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug67Test extends TestCase {
+
+    private Library lib1api = new lib1API();
+    private Library lib2api = new lib2API();
+    private Library lib3api = new lib3API();
+    private Library lib3impl = new lib3Impl();
+    private Library lib2impl = new lib2Impl();
+    private Library lib1impl = new lib1Impl();
+    private Library lib2serv1 = new lib2Serv1();
+    private Library lib2serv2 = new lib2Serv2();
+    private Library lib2serv3 = new lib2Serv3();
+    private Library lib2serv4 = new lib2Serv4();
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    private class DummyLibrary extends AbstractLibrary {
+
+        protected void doInitialize() throws LibraryException {
+            // Nothing to do
+        }
+
+        protected void doPostInitialize() throws LibraryException {
+            // Nothing to do
+        }
+    }
+
+    private class lib1API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(lib1API.class);
+        }
+    }
+
+    private class lib1Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(lib1API.class);
+            require(lib3API.class);
+        }
+    }
+
+    private class lib2API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(lib2API.class);
+            require(lib1API.class);
+        }
+    }
+
+    private class lib2Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(lib2API.class);
+        }
+    }
+
+    private class lib2Serv1 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(lib2API.class);
+        }
+    }
+
+    private class lib2Serv2 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(lib2API.class);
+            require(lib2Serv1.class);
+        }
+    }
+
+    private class lib2Serv3 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(lib2API.class);
+            require(lib2Serv2.class);
+        }
+    }
+
+    private class lib2Serv4 extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsServiceOf(lib2API.class);
+            require(lib2Serv1.class);
+            require(lib2Serv3.class);
+        }
+    }
+
+    private class lib3API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(lib3API.class);
+        }
+    }
+
+    private class lib3Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(lib3API.class);
+            require(lib2API.class);
+        }
+    }
+
+    private class TestLibraries extends AbstractLibrariesInitializer {
+
+        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+            Set libs = new LinkedHashSet();
+
+            libs.add(lib1api);
+            libs.add(lib2api);
+            libs.add(lib2serv4);
+            libs.add(lib3api);
+            libs.add(lib2serv1);
+            libs.add(lib1impl);
+            libs.add(lib2serv3);
+            libs.add(lib3impl);
+            libs.add(lib2serv2);
+            libs.add(lib2impl);
+
+            return libs;
+        }
+
+    }
+
+    public void testInitialize() throws Exception {
+        TestLibraries init = new TestLibraries();
+        List libs = init.getLibraries();
+        checkOrder(libs);
+    }
+
+    private void checkOrder(List libs) {
+        int ilib1api = libs.indexOf(lib1api);
+        int ilib1impl = libs.indexOf(lib1impl);
+        int ilib2api = libs.indexOf(lib2api);
+        int ilib2impl = libs.indexOf(lib2impl);
+        int ilib2serv1 = libs.indexOf(lib2serv1);
+        int ilib2serv2 = libs.indexOf(lib2serv2);
+        int ilib2serv3 = libs.indexOf(lib2serv3);
+        int ilib2serv4 = libs.indexOf(lib2serv4);
+        int ilib3api = libs.indexOf(lib3api);
+        int ilib3impl = libs.indexOf(lib3impl);
+
+        // Check all needed libraries have been included into the list
+        assertTrue("Lib1API is not included in the list", ilib1api > -1);
+        assertTrue("Lib1Impl is not included in the list", ilib1impl > -1);
+        assertTrue("Lib2API is not included in the list", ilib2api > -1);
+        assertTrue("Lib2Impl is not included in the list", ilib2impl > -1);
+        assertTrue("Lib2Serv1 is not included in the list", ilib2serv1 > -1);
+        assertTrue("Lib2Serv2 is not included in the list", ilib2serv2 > -1);
+        assertTrue("Lib2Serv3 is not included in the list", ilib2serv3 > -1);
+        assertTrue("Lib2Serv4 is not included in the list", ilib2serv4 > -1);
+        assertTrue("Lib3API is not included in the list", ilib3api > -1);
+        assertTrue("Lib3Impl is not included in the list", ilib3impl > -1);
+
+        // Check api-impl-service(provider) relationships:
+        // first API, next Impl and then services (providers)
+        assertTrue("Lib1API must be initialized before Lib1Impl",
+                ilib1api < ilib1impl);
+
+        assertTrue("Lib2API must be initialized before Lib2Impl",
+                ilib2api < ilib2impl);
+        assertTrue("Lib2Impl must be initialized before Lib2Serv1",
+            ilib2impl < ilib2serv1);
+        assertTrue("Lib2Serv1 must be initialized before Lib2Serv2",
+            ilib2serv1 < ilib2serv2);
+        assertTrue("Lib2Serv2 must be initialized before Lib2Serv3",
+            ilib2serv2 < ilib2serv3);
+        assertTrue("Lib2Serv3 must be initialized before Lib2Serv4",
+            ilib2serv3 < ilib2serv4);
+
+        assertTrue("Lib3API must be initialized before Lib3Impl",
+                ilib3api < ilib3impl);
+
+        // Check dependencies between libraries
+        assertTrue(
+                "Lib2Impl dependends on Lib1API, must be initialized after it",
+                ilib1api < ilib2impl);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug16017Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug16017Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug16017Test.java	(revision 1235)
@@ -0,0 +1,128 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.library;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for the 16017 bug.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class Bug16017Test extends TestCase {
+
+    private Library libCircular1api = new LibCircular1API();
+    private Library libCircular2api = new LibCircular2API();
+    private Library libCircular3api = new LibCircular3API();
+    private Library libCircular3impl = new LibCircular3Impl();
+    private Library libCircular2impl = new LibCircular2Impl();
+    private Library libCircular1impl = new LibCircular1Impl();
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    private class DummyLibrary extends AbstractLibrary {
+
+        protected void doInitialize() throws LibraryException {
+            // Nothing to do
+        }
+
+        protected void doPostInitialize() throws LibraryException {
+            // Nothing to do
+        }
+    }
+
+    private class LibCircular1API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(LibCircular1API.class);
+        }
+    }
+
+    private class LibCircular1Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(LibCircular1API.class);
+            require(LibCircular3API.class);
+        }
+    }
+
+    private class LibCircular2API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(LibCircular2API.class);
+            require(LibCircular1API.class);
+        }
+    }
+
+    private class LibCircular2Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(LibCircular2API.class);
+        }
+    }
+
+    private class LibCircular3API extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsAPI(LibCircular3API.class);
+        }
+    }
+
+    private class LibCircular3Impl extends DummyLibrary {
+
+        public void doRegistration() {
+            registerAsImplementationOf(LibCircular3API.class);
+            require(LibCircular2API.class);
+        }
+    }
+
+    private class TestLibrariesCircular extends AbstractLibrariesInitializer {
+
+        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+            Set libs = new LinkedHashSet();
+
+            libs.add(libCircular1api);
+            libs.add(libCircular2api);
+            libs.add(libCircular3api);
+            libs.add(libCircular1impl);
+            libs.add(libCircular3impl);
+            libs.add(libCircular2impl);
+
+            return libs;
+        }
+
+    }
+
+    public void testInitializeCircular() throws Exception {
+        TestLibrariesCircular init = new TestLibrariesCircular();
+        init.getLibraries();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AbstractBasicTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AbstractBasicTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AbstractBasicTest.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractBasicTest 	extends AbstractLibraryAutoInitTestCase {
+		protected static final Logger logger = LoggerFactory.getLogger(AbstractBasicTest.class);
+	
+		protected PersistenceManager manager;
+
+		abstract protected String getTestId();
+
+		protected void saveState(Object obj) throws Exception {
+			PersistentState state = manager.getState(obj);
+
+			File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "S.zip");
+			OutputStream out = new FileOutputStream(f);
+			manager.saveState(state, out);
+			out.close();
+		}
+
+		protected PersistentState saveAndRestoreState(Object obj) throws Exception {
+			PersistentState state1 = manager.getState(obj);
+
+			File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "SR.zip");
+			OutputStream out = new FileOutputStream(f);
+			manager.saveState(state1, out);
+			out.close();
+			
+			InputStream in = new FileInputStream(f);
+			PersistentState state2 = manager.loadState(in);
+			return state2;
+		}
+		
+		protected void saveObject(Object obj) throws Exception {
+			File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "OS.zip");
+			OutputStream out = new FileOutputStream(f);
+			manager.putObject(out,obj);
+			out.close();
+		}
+
+		protected Object saveAndRestoreObject(Object obj) throws Exception {
+			File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "OSR.zip");
+			OutputStream out = new FileOutputStream(f);
+			manager.putObject(out,obj);
+			out.close();
+			
+			InputStream in = new FileInputStream(f);
+			Object obj2 = manager.getObject(in);
+			in.close();
+			return obj2;
+		}
+
+		public void doSetUp() throws Exception {
+			this.manager = ToolsLocator.getPersistenceManager();
+			manager.setAutoValidation(PersistenceManager.MANDATORY);
+		}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AbstractBasicTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesArrayTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesArrayTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesArrayTest.java	(revision 1235)
@@ -0,0 +1,186 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+
+public class BasicTypesArrayTest 	extends AbstractBasicTest {
+
+	private static int counter = 0;
+	
+	private static Date getDate(int day) {
+		return new GregorianCalendar(2010, 8, 5, 12, day).getTime();
+	}
+	
+
+	public static  class MyObjectArray implements Persistent {
+		int a[] ;
+		long b[];
+		double c[];
+		float d[];
+		boolean e[];
+		String f[];
+		Date g[];
+		
+		public MyObjectArray() {
+			float value = (counter/3)*700;
+			
+			this.a =  new int[] { (int)value, (int)value, (int)value } ;
+			this.b = new long[] { (long)value, (long)value, (long)value } ;
+			this.c = new double[] { value, value, value };
+			this.d = new float[] { value, value, value };
+			this.e = new boolean[] { (counter%2) == 0, (counter%2) == 0, (counter%2) == 0 };
+			this.f = new String[] { String.valueOf(value),String.valueOf(value),String.valueOf(value) };
+			this.g = new Date[] { getDate(10), getDate(11), getDate(20) };
+			counter++;
+		}
+		
+		void check(MyObjectArray other) {
+			for( int i=0; i<this.a.length; i++ ) {
+				assertEquals("int value["+i+"] mistmach", this.a[i], other.a[i]);
+				assertEquals("long value["+i+"] mistmach", this.b[i], other.b[i]);
+				assertEquals("double value["+i+"] mistmach", this.c[i], other.c[i],0.01);
+				assertEquals("float value["+i+"] mistmach", this.d[i], other.d[i], 0.01);
+				assertEquals("boolean value["+i+"] mistmach", this.e[i], other.e[i]);
+				assertEquals("String value["+i+"] mistmach", this.f[i], other.f[i]);
+				assertTrue("Date value["+i+"] mistmach", this.f[i].equals( other.f[i]) );
+			}
+		}
+
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.a = state.getIntArray("a");
+			this.b = state.getLongArray("b");
+			this.c = state.getDoubleArray("c");
+			this.d = state.getFloatArray("d");
+			this.e = state.getBooleanArray("e");
+			this.f = state.getStringArray("f");
+			this.g = state.getDateArray("g");
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("a",a);
+			state.set("b",b);
+			state.set("c",c);
+			state.set("d",d);
+			state.set("e",e);
+			state.set("f",f);
+			state.set("g",g);
+		}
+	}
+
+	
+	protected void registerArray() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MyObjectArray.class,
+				"MyObjectBasicTypesArray",
+				"MyObjectBasicTypesArray Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldArray("a").setMandatory(true).setElementsType(DataTypes.INT);
+		definition.addDynFieldArray("b").setMandatory(true).setElementsType(DataTypes.LONG);
+		definition.addDynFieldArray("c").setMandatory(true).setElementsType(DataTypes.DOUBLE);
+		definition.addDynFieldArray("d").setMandatory(true).setElementsType(DataTypes.FLOAT);
+		definition.addDynFieldArray("e").setMandatory(true).setElementsType(DataTypes.BOOLEAN);
+		definition.addDynFieldArray("f").setMandatory(true).setElementsType(DataTypes.STRING);
+		definition.addDynFieldArray("g").setMandatory(true).setElementsType(DataTypes.DATE);
+	}
+
+	protected void unregister() throws PersistenceClassNotRegistered {
+		manager.unregisterClass("MyObjectBasicTypesArray");
+	}
+	
+	public void doSetUp() throws Exception {
+		super.doSetUp();
+		registerArray();
+	}
+	
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		unregister();
+	}
+	
+	protected String getTestId() {
+		return "basicarray";
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(MyObjectArray.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicTypesArray", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObjectArray obj = new MyObjectArray();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+		DynStruct definition = state.getDefinition();
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicTypesArray", 
+				definition.getName()
+		);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObjectArray obj1 = new MyObjectArray();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		MyObjectArray obj2 = (MyObjectArray) manager.create(state);
+		obj1.check(obj2);
+	}
+
+	public void testSaveState() throws Exception {
+		MyObjectArray obj = new MyObjectArray();
+		saveState(obj);
+	}
+
+	public void testLoadState() throws Exception {
+		MyObjectArray obj1 = new MyObjectArray();
+		MyObjectArray obj2 = (MyObjectArray) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj1.check(obj2);		
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesArrayTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesTest.java	(revision 1235)
@@ -0,0 +1,209 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class BasicTypesTest 	extends AbstractBasicTest {
+
+		private static int counter = 0;
+		
+		private static Date getDate() {
+			return new GregorianCalendar(2010, 8, 5, 12, 5).getTime();
+		}
+		
+		public static  class MyObject implements Persistent {
+			int a;
+			long b;
+			double c;
+			float d;
+			boolean e;
+			String f;
+			Date g;
+			
+			public MyObject() {
+				float value = (counter/3)*700;
+				
+				this.a =  (int)value;
+				this.b = (long) value ;
+				this.c = value;
+				this.d = value;
+				this.e = (counter%2) == 0;
+				this.f = String.valueOf(value);
+				this.g= getDate(); 
+				
+				counter++;
+			}
+			
+			void check(MyObject other) {
+				assertEquals("int value mistmach", this.a, other.a);
+				assertEquals("long value mistmach", this.b, other.b);
+				assertEquals("double value mistmach", this.c, other.c,0.01);
+				assertEquals("float value mistmach", this.d, other.d, 0.01);
+				assertEquals("boolean value mistmach", this.e, other.e);
+				assertEquals("String value mistmach", this.f, other.f);
+				assertTrue("Date value mistmach", getDate().equals(this.g));
+			}
+
+			public void loadFromState(PersistentState state)
+					throws PersistenceException {
+				this.a = state.getInt("a");
+				this.b = state.getLong("b");
+				this.c = state.getDouble("c");
+				this.d = state.getFloat("d");
+				this.e = state.getBoolean("e");
+				this.f = state.getString("f");
+				this.g = (Date) state.get("g");
+			}
+
+			public void saveToState(PersistentState state)
+					throws PersistenceException {
+				state.set("a",a);
+				state.set("b",b);
+				state.set("c",c);
+				state.set("d",d);
+				state.set("e",e);
+				state.set("f",f);
+				state.set("g",g);
+			}
+		}
+		
+		protected void register() {
+			PersistenceManager manager = ToolsLocator.getPersistenceManager();
+			DynStruct definition = manager.addDefinition(
+					MyObject.class,
+					"MyObjectBasicTypes",
+					"MyObjectBasicTypes Persistence definition",
+					null, 
+					null
+			);
+			definition.addDynFieldInt("a").setMandatory(true);
+			definition.addDynFieldLong("b").setMandatory(true);
+			definition.addDynFieldDouble("c").setMandatory(true);
+			definition.addDynFieldFloat("d").setMandatory(true);
+			definition.addDynFieldBoolean("e").setMandatory(true);
+			definition.addDynFieldString("f").setMandatory(true);
+			definition.addDynFieldDate("g").setMandatory(true);
+		}
+
+		protected void unregister() throws PersistenceClassNotRegistered {
+			manager.unregisterClass("MyObjectBasicTypes");
+		}
+		
+		public void doSetUp() throws Exception {
+			super.doSetUp();
+			register();
+		}
+		
+		protected void tearDown() throws Exception {
+			super.tearDown();
+			unregister();
+		}
+		
+		//
+		// =================================================
+		//
+		
+		protected String getTestId() {
+			return "basictypes";
+		}
+		
+		public void testRegister() {
+			DynStruct definition = manager.getDefinition(MyObject.class);
+			assertNotNull("Can't register class", definition);
+			assertEquals(
+					"Registration didn't work, incorrect name.", 
+					"MyObjectBasicTypes", 
+					definition.getName()
+			);
+			assertEquals(
+					"Registration didn't work, incorrect namespace.",
+					PersistenceManager.PERSISTENCE_NAMESPACE, 
+					definition.getNamespace()
+			);
+		}
+		
+		public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+			try {
+				MyObject obj = new MyObject();
+				PersistentState state = manager.getState(obj);
+				assertNotNull("Can't retrieve state", state);
+				DynStruct definition = state.getDefinition();
+				assertNotNull("Can't register class", definition);
+				assertEquals(
+						"Registration don't work, name incorrect", 
+						"MyObjectBasicTypes", 
+						definition.getName()
+				);
+			} catch( PersistenceValidateExceptions ex) {
+				logger.warn( ex.getMessageStack(), ex);
+				throw ex;
+			}
+		}
+
+		public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+			MyObject obj1 = new MyObject();
+			PersistentState state = manager.getState(obj1);
+			assertNotNull("Can't retrieve state", state);
+			
+			MyObject obj2 = (MyObject) manager.create(state);
+			obj1.check(obj2);
+		}
+
+		public void testSaveState() throws Exception {
+			MyObject obj = new MyObject();
+			saveState(obj);
+		}
+
+		public void testLoadState() throws Exception {
+			MyObject obj1 = new MyObject();
+			PersistentState state = this.saveAndRestoreState(obj1);
+			MyObject obj2 = (MyObject) manager.create(state);
+			
+			obj1.check(obj2);		
+		}
+
+		public void testPutObject() throws Exception {
+			MyObject obj = new MyObject();
+			saveObject(obj);
+		}
+
+		public void testGetObject() throws Exception {
+			MyObject obj1 = new MyObject();
+			MyObject obj2 = (MyObject) this.saveAndRestoreObject(obj1);
+			
+			obj1.check(obj2);		
+		}
+
+		
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypesTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypes2Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypes2Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypes2Test.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import org.gvsig.tools.ToolsLocator;
+
+public class BasicTypes2Test extends BasicTypesTest {
+
+	protected void register() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		manager.addDefinition(
+				MyObject.class, 
+				"MyObjectBasicTypes", 
+				this.getClass().getResourceAsStream("BasicTypes2Test.xml"), 
+				this.getClass().getClassLoader(),
+				null, 
+				null
+		);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicTypes2Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactoryTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactoryTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactoryTest.java	(revision 1235)
@@ -0,0 +1,171 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.InputStream;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.ToolsLocator;
+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.exception.BaseException;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class DynObjectFactoryTest extends AbstractBasicTest {
+
+	private static Logger logger = LoggerFactory
+			.getLogger(DynObjectFactoryTest.class);
+
+	private static int counter = 0;
+
+	protected String OBJ1_NAME = "MyObjectBasicTypes";
+	protected DynObjectManager dynManager;
+
+	private static Date getDate() {
+		return new GregorianCalendar(2010, 8, 5, 12, 5).getTime();
+	}
+
+	public void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		this.dynManager = ToolsLocator.getDynObjectManager();
+	}
+
+	protected void register() throws Exception {
+		if (this.manager.getDynObjectDefinition(OBJ1_NAME) == null) {
+			InputStream resource = this
+					.getClass()
+					.getClassLoader()
+					.getResourceAsStream(
+							"org/gvsig/tools/persistence/BasicTypes2Test.xml");
+
+			Map definitions = this.dynManager.importDynClassDefinitions(
+					resource, null);
+			DynClass dynStruct = (DynClass) definitions.get(OBJ1_NAME);
+			this.manager.addDefinition(dynStruct, null, null);
+		}
+
+	}
+
+	protected DynObject createDynObject1() {
+		return createDynObject1(OBJ1_NAME);
+	}
+
+	protected DynObject createDynObject1(String name) {
+		DynObject obj = this.dynManager.createDynObject(name,
+				PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE);
+		float value = (counter / 3) * 700;
+
+		obj.setDynValue("a", new Integer((int) value));
+		obj.setDynValue("b", new Long((long) value));
+		obj.setDynValue("c", new Double(value));
+		obj.setDynValue("d", new Float(value));
+		obj.setDynValue("e", new Boolean((counter % 2) == 0));
+		obj.setDynValue("f", String.valueOf(value));
+		obj.setDynValue("g", getDate());
+
+		counter++;
+
+		return obj;
+	}
+
+	void check(DynObject obj1, DynObject obj2) {
+		assertEquals("int value mistmach", obj1.getDynValue("a"),
+				obj2.getDynValue("a"));
+		assertEquals("long value mistmach", obj1.getDynValue("b"),
+				obj2.getDynValue("b"));
+		assertEquals("double value mistmach",
+				((Double) obj1.getDynValue("c")).doubleValue(),
+				((Double) obj2.getDynValue("c")).doubleValue(), 0.01);
+		assertEquals("float value mistmach",
+				((Float) obj1.getDynValue("d")).floatValue(),
+				((Float) obj2.getDynValue("d")).floatValue(), 0.01);
+		assertEquals("boolean value mistmach", obj1.getDynValue("e"),
+				obj2.getDynValue("e"));
+		assertEquals("String value mistmach", obj1.getDynValue("f"),
+				obj2.getDynValue("f"));
+		assertTrue("Date value mistmach",
+				obj1.getDynValue("g").equals(obj2.getDynValue("g")));
+	}
+
+	public void testRegisterFactory() throws Exception {
+		register();
+	}
+
+	public void testGetState() throws Exception {
+		try {
+			register();
+			DynObject obj = createDynObject1();
+			PersistentState state = manager.getState(obj);
+			assertNotNull("Can't retrieve state", state);
+			DynStruct definition = state.getDefinition();
+			assertNotNull("Can't register class", definition);
+			assertEquals("Registration doesn't work, incorrect name", obj
+					.getDynClass().getName(), definition.getName());
+		} catch (BaseException ex) {
+			logger.warn(ex.getMessageStack(), ex);
+			throw ex;
+		}
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException,
+			PersistenceClassNotRegistered, PersistenceException,
+			PersistenceValidateExceptions {
+		DynObject obj1 = createDynObject1();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+
+		DynObject obj2 = (DynObject) manager.create(state);
+		check(obj1, obj2);
+	}
+
+	public void testSaveState() throws Exception {
+		DynObject obj = createDynObject1();
+		saveState(obj);
+	}
+
+	public void testLoadState() throws Exception {
+		DynObject obj1 = createDynObject1();
+		PersistentState state = this.saveAndRestoreState(obj1);
+		DynObject obj2 = (DynObject) manager.create(state);
+
+		check(obj1, obj2);
+	}
+
+	protected String getTestId() {
+		return "dopf";
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactoryTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AllTests.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AllTests.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AllTests.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.gvsig.tools.persistence.case1.Case1AllTests;
+
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for org.gvsig.tools.persistence");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(BasicMapTest.class);
+		suite.addTestSuite(BasicTypesArrayTest.class);
+		suite.addTestSuite(BasicSetTest.class);
+		suite.addTestSuite(BasicListTest.class);
+		suite.addTestSuite(BasicTypesTest.class);
+		suite.addTestSuite(BasicTypes2Test.class);
+		suite.addTestSuite(DynObjectFactoryTest.class);
+		suite.addTestSuite(DynObjectFactory2Test.class);
+		suite.addTestSuite(DynObjectFactory3Test.class);
+		//$JUnit-END$
+
+		suite.addTest(Case1AllTests.suite());
+
+		return suite;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AllTests.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory2Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory2Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory2Test.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.InputStream;
+
+import org.gvsig.tools.dynobject.DynObject;
+
+public class DynObjectFactory2Test extends DynObjectFactoryTest {
+
+	protected void register() throws Exception {
+		if(this.manager.getDynObjectDefinition(OBJ1_NAME)==null){
+			InputStream resource = this
+			.getClass()
+			.getClassLoader()
+			.getResourceAsStream(
+			"org/gvsig/tools/persistence/BasicTypes2Test.xml");
+			
+			this.manager.addDefinition(DynObject.class, OBJ1_NAME, resource, null, null, null);
+		}
+
+	}
+	
+	protected String getTestId() {
+		return "dopf2";
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory2Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory3Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory3Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory3Test.java	(revision 1235)
@@ -0,0 +1,174 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+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.exception.BaseException;
+import org.gvsig.tools.persistence.case1.model.ModelManager;
+import org.gvsig.tools.persistence.case1.model.Projection;
+import org.gvsig.tools.persistence.case1.model.ViewPort;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DynObjectFactory3Test extends AbstractBasicTest {
+
+	private static Logger logger = LoggerFactory
+			.getLogger(DynObjectFactory3Test.class);
+
+//	private static int counter = 0;
+
+	protected static final String OBJ1_NAME = "MyObjectDynTypes";
+	protected DynObjectManager dynManager;
+	ModelManager modelmgr;
+
+	public void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		this.dynManager = ToolsLocator.getDynObjectManager();
+		modelmgr = new ModelManager();
+		modelmgr.registerPersistence();
+
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		this.manager.unregisterClass(ViewPort.class);
+		modelmgr.unregisterPersistence();
+
+	}
+
+	protected void register() throws Exception {
+		if(this.manager.getDynObjectDefinition(OBJ1_NAME)==null){
+			InputStream resource = this
+			.getClass()
+			.getClassLoader()
+			.getResourceAsStream(
+			"org/gvsig/tools/persistence/DynTypesTest.xml");
+			
+			Map definitions = this.dynManager.importDynClassDefinitions(resource, null);
+			DynClass dynStruct = (DynClass)definitions.get(OBJ1_NAME);
+			this.manager.addDefinition(dynStruct, null, null);
+			
+//			this.manager.addDefinition(DynObject.class, OBJ1_NAME, resource, null, null, null);
+		}
+	}
+	
+	private DynObject createDynObject1(){
+		DynObject obj = this.dynManager.createDynObject(OBJ1_NAME, PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE);
+		
+		Map m = new HashMap();
+		m.put("a", "A1");
+		m.put("b", "B2");
+		obj.setDynValue("mapa", m);
+		
+		Set s = new HashSet();
+		s.add("elementoConjunto1");
+		s.add("elementoConjunto2");
+		obj.setDynValue("conjunto", s);
+
+		List l = new ArrayList();
+		l.add("elementoLista1");
+		l.add("elementoLista2");
+		obj.setDynValue("lista", l);
+
+		ViewPort vp = new ViewPort(new Projection());
+		obj.setDynValue("viewPort", vp);
+
+//		counter++;
+		
+		return obj;
+	}
+
+	void check(DynObject obj1, DynObject obj2) {
+		assertEquals("map value mistmach", obj1.getDynValue("mapa"), obj2.getDynValue("mapa"));
+		assertEquals("set value mistmach", obj1.getDynValue("conjunto"), obj2.getDynValue("conjunto"));
+		assertEquals("list value mistmach", obj1.getDynValue("lista"), obj2.getDynValue("lista"));
+		assertEquals("object value mistmach", ((ViewPort)obj1.getDynValue("viewPort")).getCode(), ((ViewPort)obj2.getDynValue("viewPort")).getCode());
+	}
+	
+	public void testRegisterFactory() throws Exception {
+		register();
+	}
+
+	public void testGetState() throws Exception {
+		try {
+			register();
+			DynObject obj = createDynObject1();
+			PersistentState state = manager.getState(obj);
+			assertNotNull("Can't retrieve state", state);
+			DynStruct definition = state.getDefinition();
+			assertNotNull("Can't register class", definition);
+			assertEquals("Registration don't work, name incorrect", OBJ1_NAME,
+					definition.getName());
+		} catch (BaseException ex) {
+			logger.warn(ex.getMessageStack(), ex);
+			throw ex;
+		}
+	}
+	
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		DynObject obj1 = createDynObject1();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		DynObject obj2 = (DynObject) manager.create(state);
+		check(obj1, obj2);
+	}
+
+	public void testSaveState() throws Exception {
+		DynObject obj = createDynObject1();
+		saveState(obj);
+	}
+
+	public void testLoadState() throws Exception {
+		DynObject obj1 = createDynObject1();
+		PersistentState state = this.saveAndRestoreState(obj1);
+		DynObject obj2 = (DynObject) manager.create(state);
+		
+		check(obj1, obj2);		
+	}
+
+	protected String getTestId() {
+		return "dopf3";
+
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory3Test.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/AwtFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/AwtFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/AwtFactory.java	(revision 1235)
@@ -0,0 +1,106 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import java.awt.Color;
+import java.awt.geom.Point2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractMultiPersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class AwtFactory extends AbstractMultiPersistenceFactory{
+
+	private static final String DYNCLASS_COLOR_NAME = "Color";
+	private static final String DYNCLASS_COLOR_DESCRIPTION = "Color";
+	private static final String RED_FIELD = "red";
+	private static final String GREEN_FIELD = "green";
+	private static final String BLUE_FIELD = "blue";
+	private static final String ALPHA_FIELD = "alpha";
+
+	private static final String DYNCLASS_POINT2D_NAME = "Point2D";
+	private static final String DYNCLASS_POINT2D_DESCRIPTION = "Point2D";
+	private static final String FIELD_X = "x";
+	private static final String FIELD_Y = "y";
+
+	public AwtFactory() {
+		super();
+	}
+	
+	protected void makeDefinitions() {
+		DynStruct color_definition = this.addDefinition(Color.class, DYNCLASS_COLOR_NAME, DYNCLASS_COLOR_DESCRIPTION);
+
+		color_definition.addDynFieldInt(RED_FIELD).setMandatory(true);
+		color_definition.addDynFieldInt(GREEN_FIELD).setMandatory(true);
+		color_definition.addDynFieldInt(BLUE_FIELD).setMandatory(true);
+		color_definition.addDynFieldInt(ALPHA_FIELD).setMandatory(true);
+
+		DynStruct point_definition = this.addDefinition(Point2D.class, DYNCLASS_POINT2D_NAME, DYNCLASS_POINT2D_DESCRIPTION);
+		point_definition.addDynFieldDouble(FIELD_X).setMandatory(true);
+		point_definition.addDynFieldDouble(FIELD_Y).setMandatory(true);
+
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		if( this.getManagedClass(state).isAssignableFrom(Color.class) ) {
+			int red = state.getInt(RED_FIELD);
+			int green = state.getInt(GREEN_FIELD);
+			int blue = state.getInt(BLUE_FIELD);
+			int alpha = state.getInt(ALPHA_FIELD);
+	
+			return new Color(red, green, blue, alpha);
+		}
+		
+		if( this.getManagedClass(state).isAssignableFrom(Point2D.class) ) {
+			double x = state.getDouble(FIELD_X);
+			double y = state.getDouble(FIELD_Y);
+
+			return new Point2D.Double(x, y);
+		}
+		
+		throw new RuntimeException(); //FIXME 
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		if( obj instanceof Color ) {
+			Color color = (Color) obj;
+			state.set(RED_FIELD, color.getRed());
+			state.set(GREEN_FIELD, color.getGreen());
+			state.set(BLUE_FIELD, color.getBlue());
+			state.set(ALPHA_FIELD, color.getAlpha());
+			return;
+		}
+		if( obj instanceof Point2D ) {
+			Point2D point = (Point2D) obj;
+			state.set(FIELD_X, point.getX());
+			state.set(FIELD_Y, point.getY());
+			return;
+		}
+		throw new RuntimeException(); //FIXME 
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/AwtFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectionFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectionFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectionFactory.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class ProjectionFactory extends AbstractSinglePersistenceFactory{
+
+	// DynClass name for the IProjection objects 
+	private static final String DYNCLASS_NAME = "Projection";
+	private static final String DYNCLASS_DESCRIPTION = "Projection";
+	// Persisted attribute name with the projection code
+	private static final String FULLCODE = "fullcode";
+	private static final String FULLCODE_DESCRIPTION = "Projection abbreviature";
+
+
+	public ProjectionFactory() {
+		super(Projection.class, DYNCLASS_NAME,	DYNCLASS_DESCRIPTION, null, null);
+		this.getDefinition().addDynFieldString(FULLCODE)
+			.setDescription(FULLCODE_DESCRIPTION)
+			.setMandatory(true);
+	}
+	
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		return new Projection( state.getString("fullcode"));
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		state.set("fullcode",((Projection)obj).getFullCode());
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectionFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Project.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Project.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Project.java	(revision 1235)
@@ -0,0 +1,86 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class Project extends Base implements Persistent {
+	
+	public String comments;
+	public Color color;
+	public Projection projection;
+	public List extents; // list of ProjectExtent
+	public List documents; // list of Document
+	
+	public Project() {
+		super();
+		this.comments = "Project["+getCode()+"].comments";
+		this.color = new Color(getCode(), getCode(),getCode());
+		this.projection = new Projection();
+		this.extents = new ArrayList();
+		this.documents = new ArrayList();
+	}
+
+	public void addExtent() {
+		this.extents.add( new ProjectExtent() );
+	}
+	
+	public void addDocument() {
+		this.documents.add( new Document(this.projection) );
+	}
+	
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+		comments = state.getString("comments");
+		color =  (Color)state.get("color") ;
+		projection = (Projection) state.get("projection");
+
+		List extents = (List) state.get("extents");
+		for( int i=0; i<extents.size(); i++) {
+			this.extents.add( extents.get(i) );
+		}
+
+		List docs = (List) state.get("documents");
+		for( int i=0; i<docs.size(); i++) {
+			this.documents.add( docs.get(i) );
+		}
+	}
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		state.set("comments", this.comments);
+		state.set("color", this.color);
+		state.set("projection", this.projection);
+		state.set("extents", this.extents);
+		state.set("documents", this.documents);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Project.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Base.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Base.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Base.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class Base  {
+	private static int counter = 0;
+	private int code;
+	
+	public Base() {
+		this.code = ++counter;
+	}
+	
+	public int getCode() {
+		return code;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		this.code = state.getInt("code");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("code", code);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Base.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ModelManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ModelManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ModelManager.java	(revision 1235)
@@ -0,0 +1,221 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import java.awt.Color;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+
+public class ModelManager {
+
+	private static ModelManager manager = null;
+	
+	public static ModelManager getManager() {
+		if( manager != null ) {
+			return manager;
+		}
+		manager = new ModelManager();
+		return manager;
+	}
+	
+	AwtFactory awtFactory;
+	ProjectionFactory projectionFactory;
+	
+	public Projection getDefaultProjection() {
+		return new Projection();
+	}
+	
+	public void registerPersistence() {
+		
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+	
+		this.awtFactory = new AwtFactory();
+		this.projectionFactory = new ProjectionFactory();
+		
+		manager.registerFactory(	this.awtFactory);
+		manager.registerFactory(this.projectionFactory);
+		
+		registerDocumentPersistence();
+		registerLayerPersistence();
+		registerLayersPersistence();
+		registerMapContextPersistence();
+		registerProjectPersistence();
+		registerProjectExtentPersistence();
+		registerViewPortPersistence();
+	}
+	
+	public void unregisterPersistence() throws PersistenceClassNotRegistered {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+
+		manager.unregisterFactory(this.awtFactory);
+		manager.unregisterFactory(this.projectionFactory);
+		manager.unregisterClass("Document");
+		manager.unregisterClass("Layer");
+		manager.unregisterClass("Layers");
+		manager.unregisterClass("MapContext");
+		manager.unregisterClass("Project");
+		manager.unregisterClass("ProjectExtent");
+		manager.unregisterClass("ViewPort");		
+	}
+
+	private void registerDocumentPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				Document.class,
+				"Document",
+				"Document Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("comment");
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldString("creationDate").setMandatory(true);
+		definition.addDynFieldString("name").setMandatory(true);
+		definition.addDynFieldString("owner");
+		definition.addDynFieldBoolean("locked");
+		
+		definition.addDynFieldObject("mainMapContext")
+			.setClassOfValue(MapContext.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("overviewMapContext")
+			.setClassOfValue(MapContext.class)
+			.setMandatory(false);
+	}
+
+	private void registerLayerPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				Layer.class,
+				"Layer",
+				"Layer Persistence definition",
+				null, 
+				null
+		);
+		
+		definition.addDynFieldObject("context")
+			.setClassOfValue(MapContext.class)
+			.setMandatory(true);
+
+		/*
+		 * FIXME:  Esto es una primera aproximacion, habria que ver de persistir directamente
+		 * el valor de this.values en cuanto haya algo que nos permita persistir un
+		 * DynObject.
+		 */
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldString("name").setMandatory(true);
+		definition.addDynFieldObject("projection")
+			.setClassOfValue(Projection.class)
+			.setMandatory(true);
+	}
+	
+	private void registerLayersPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				Layers.class,
+				"Layers",
+				"Layers Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldList("layers")
+			.setClassOfItems(Layer.class);
+		definition.addDynFieldObject("context")
+			.setClassOfValue(MapContext.class);
+	}
+
+	private void registerMapContextPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MapContext.class,
+				"MapContext",
+				"MapContext Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldObject("layers")
+			.setClassOfValue(Layers.class);
+		definition.addDynFieldObject("viewPort")
+			.setClassOfValue(ViewPort.class);
+
+	}
+
+	private void registerProjectPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				Project.class,
+				"Project",
+				"Project Persistence definition", 
+				null, 
+				null
+		);
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldString("comments").setMandatory(true);
+		definition.addDynFieldObject("color")
+			.setClassOfValue(Color.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("projection")
+			.setClassOfValue(Projection.class)
+			.setMandatory(true);
+		definition.addDynFieldList("extents")
+			.setClassOfItems(ProjectExtent.class)
+			.setMandatory(true);
+		definition.addDynFieldList("documents")
+			.setClassOfItems(Document.class)
+			.setMandatory(true);
+	}
+
+	private void registerProjectExtentPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ProjectExtent.class,
+				"ProjectExtent",
+				"ProjectExtent Persistence definition" ,
+				null, 
+				null
+		);
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldString("description").setMandatory(true);
+	}
+	
+	public void registerViewPortPersistence() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ViewPort.class,
+				"ViewPort",
+				"ViewPort Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("code").setMandatory(true);
+		definition.addDynFieldObject("projection")
+			.setClassOfValue(Projection.class);
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ModelManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layer.java	(revision 1235)
@@ -0,0 +1,118 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+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.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class Layer extends Base implements Persistent, DynObject {
+
+	private DelegatedDynObject values;
+
+	private MapContext context;
+	
+	public Layer(MapContext context) {
+		super();
+		this.context = context;
+		this.values.setDynValue("projection", context.getProjection());
+		this.values.setDynValue("name", "layer"+this.getCode());
+	}
+	
+	public String getName() {
+		return (String) this.values.getDynValue("name");
+	}
+	
+	public Projection getProjection() {
+		return (Projection) this.values.getDynValue("projection");
+	}
+	
+	public MapContext getContext() {
+		return this.context;
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		
+		state.set("context", this.context);
+		state.set("name", this.getName());
+		state.set("projection", this.getProjection());
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		super.loadFromState(state);
+
+		this.context = (MapContext) state.get("context");
+		this.values.setDynValue("name", (String)state.get("name"));
+		this.values.setDynValue("projection", (Projection)state.get("projection"));
+		
+	}
+	
+
+	
+	public void delegate(DynObject dynObject) {
+		this.values.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		return this.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		return this.values.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		return this.values.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		this.values.implement(dynClass);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		return this.values.invokeDynMethod(name, context);
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		return this.invokeDynMethod(code, context);
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+			this.values.setDynValue(name, value);
+	}
+
+	public void clear() {
+		values.clear();
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Projection.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Projection.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Projection.java	(revision 1235)
@@ -0,0 +1,47 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+public class Projection {
+	/*
+	 * Don't implement Persistent.
+	 * Require a factory to be persisted.
+	 */
+
+	private static int codecounter = 0;
+	private String fullcode;
+	
+	public Projection() {
+		this.fullcode = "Projection.getFullCode("+ codecounter++ + ")";
+	}
+	
+	Projection(String fullCode) {
+		this.fullcode = fullCode;
+	}
+	
+	public String getFullCode() {
+		return this.fullcode;
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Projection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Document.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Document.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Document.java	(revision 1235)
@@ -0,0 +1,82 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class Document extends Base implements Persistent {
+
+	public String name;
+	public String creationDate;
+	public String owner;
+	public String comment;
+	public boolean locked = false;
+	public MapContext mapContext;
+	public MapContext mapOverViewContext;
+
+	public Document() {
+		this(null);
+	}
+	
+	public Document(Projection projection) {
+		super();
+		if( projection == null ) {
+			projection = ModelManager.getManager().getDefaultProjection();
+		}
+		this.name = "Document["+getCode()+"].name";
+		this.creationDate = "Document["+getCode()+"].creationDate";
+		this.owner = "Document["+getCode()+"].owner";
+		this.comment = "Document["+getCode()+"].comment";
+		this.locked = false;
+		this.mapContext = new MapContext(projection);
+		this.mapOverViewContext = null;
+	}
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		state.set("comment", comment);
+		state.set("creationDate", creationDate);
+		state.set("name", name);
+		state.set("owner", owner);
+		state.set("locked", locked);
+		state.set("mainMapContext", this.mapContext);
+		state.set("overviewMapContext", this.mapOverViewContext);
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+		this.comment = state.getString("comment");
+		this.creationDate = state.getString("creationDate");
+		this.name = state.getString("name");
+		this.owner = state.getString("owner");
+		this.locked = state.getBoolean("locked");
+		this.mapContext = (MapContext) state.get("mainMapContext");
+		this.mapOverViewContext = null;
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Document.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectExtent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectExtent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectExtent.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class ProjectExtent extends Base implements Persistent {
+
+	public String description;
+
+	public ProjectExtent() {
+		super();
+		this.description = "ProjectExtent[" + getCode() + "].description";
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+		description = state.getString("description");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		state.set("description", this.description);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ProjectExtent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layers.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layers.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layers.java	(revision 1235)
@@ -0,0 +1,81 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class Layers extends Base implements Persistent {
+	
+	private  List layers; // List of Layer
+	private  MapContext context;
+	
+	public Layers()	{
+		this(null);
+	}
+	
+	public Layers(MapContext context) {
+		this.context = context;
+		this.layers = new ArrayList();
+	}
+	
+	public Layer add() {
+		Layer layer = new Layer(context);
+		this.layers.add(layer);
+		return layer;
+	}
+	
+	public List getLayers() {
+		return this.layers;
+	}
+	
+	public MapContext getContext() {
+		return this.context;
+	}
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		
+		state.set("context", this.context);
+		state.set("layers", layers);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		super.loadFromState(state);
+
+		this.context = (MapContext) state.get("context");
+		List layers = (List) state.getList("layers");
+		Iterator layersIterator = layers.iterator();
+		while (layersIterator.hasNext()) {
+			Layer layer = (Layer) layersIterator.next();
+			this.layers.add( layer);
+		}
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/Layers.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ViewPort.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ViewPort.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ViewPort.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class ViewPort extends Base implements Persistent {
+
+	private Projection projection;
+	
+	public ViewPort() {
+		this(null);
+	}
+	
+	public ViewPort(Projection projection) {
+		this.projection = projection;
+	}
+
+	public Projection getProjection() {
+		return this.projection;
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		
+		state.set("projection", this.projection);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		super.loadFromState(state);
+
+		this.projection = (Projection) state.get("projection");
+	}
+	
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/ViewPort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/MapContext.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/MapContext.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/MapContext.java	(revision 1235)
@@ -0,0 +1,73 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1.model;
+
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class MapContext extends Base implements Persistent {
+
+	private Layers layers;
+	private ViewPort viewPort;
+	
+	public MapContext() {
+		this(null);
+	}
+	
+	public MapContext(Projection projection) {
+		super();
+		if( projection == null ) {
+			projection = ModelManager.getManager().getDefaultProjection();
+		}
+		this.viewPort = new ViewPort(projection);
+		this.layers = new Layers(this);
+	}
+	
+	public Projection getProjection() {
+		return this.viewPort.getProjection();
+	}
+	
+	public Layers getLayers() {
+		return this.layers;
+	}
+	
+	public ViewPort getViewPort() {
+		return this.viewPort;
+	}
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		state.set("layers",this.layers);
+		state.set("viewPort",this.viewPort);
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+		this.layers = (Layers) state.get("layers");
+		this.viewPort = (ViewPort) state.get("viewPort");
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/model/MapContext.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MultiFactoryTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MultiFactoryTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MultiFactoryTest.java	(revision 1235)
@@ -0,0 +1,107 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import java.awt.Color;
+import java.awt.geom.Point2D;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.case1.model.AwtFactory;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class MultiFactoryTest extends AbstractLibraryAutoInitTestCase {
+
+	PersistenceManager manager;
+	PersistenceFactory factory;
+	
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		factory = new AwtFactory();
+		manager.registerFactory(factory);
+	}
+	
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		manager.unregisterFactory(factory);
+	}
+	
+	public void testRegister() {
+		DynStruct color_definition = manager.getDefinition(Color.class);
+		assertNotNull("Can't register class", color_definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"Color", 
+				color_definition.getName()
+		);
+		DynStruct point_definition = manager.getDefinition(Point2D.class);
+		assertNotNull("Can't register class", point_definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"Point2D", 
+				point_definition.getName()
+		);
+	}
+	
+	public void testColorGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Color obj = new Color(100,101,102);
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+	}
+
+	public void testPointGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Point2D obj = new Point2D.Double(100,100);
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+	}
+
+	public void testColorSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Color obj1 = new Color(100,101,102);
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		Color obj2 = (Color) manager.create(state);
+		assertEquals("Restore of object state failed, RGB mismatch", obj1.getRGB(), obj2.getRGB());
+		assertEquals("Restore of object state failed, alpha mismatch", obj1.getAlpha(), obj2.getAlpha());
+	}
+
+	public void testPoint2DSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Point2D obj1 = new Point2D.Double(100,101);
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		Point2D obj2 = (Point2D) manager.create(state);
+		assertEquals("Restore of object state failed, X mismatch", obj1.getX(), obj2.getX(),0);
+		assertEquals("Restore of object state failed, Y mismatch", obj1.getY(), obj2.getY(),0);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MultiFactoryTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/ComplexTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/ComplexTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/ComplexTest.java	(revision 1235)
@@ -0,0 +1,140 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.case1.model.MapContext;
+import org.gvsig.tools.persistence.case1.model.ModelManager;
+import org.gvsig.tools.persistence.case1.model.Projection;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComplexTest extends AbstractLibraryAutoInitTestCase {
+
+	private static Logger LOG = LoggerFactory.getLogger(ComplexTest.class);
+
+	PersistenceManager manager;
+	ModelManager modelmgr;
+
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		modelmgr = new ModelManager();
+		modelmgr.registerPersistence();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		modelmgr.unregisterPersistence();
+	}
+
+	public void compareMapContext(MapContext obj1, MapContext obj2) {
+		assertEquals("MapContext aren't equals, code mismatch", obj1.getCode(),
+				obj2.getCode());
+		assertEquals("MapContext aren't equals, projection mismatch", obj1
+				.getProjection().getFullCode(), obj2.getProjection()
+				.getFullCode());
+		assertEquals("MapContext aren't equals, viewport mismatch", obj1
+				.getViewPort().getCode(), obj2.getViewPort().getCode());
+	}
+
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(MapContext.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals("Registration don't work, name incorrect", "MapContext",
+				definition.getName());
+	}
+
+	public void testGetState() throws PersistenceTypeNotSupportedException,
+			PersistenceClassNotRegistered, PersistenceException,
+			PersistenceValidateExceptions {
+		try {
+			MapContext obj = new MapContext(new Projection());
+			PersistentState state = manager.getState(obj);
+			assertNotNull("Can't retrieve state", state);
+			assertNotNull("Can't retrieve layers", state.get("layers"));
+			assertNotNull("Can't retrieve viewPort", state.get("viewPort"));
+		} catch (BaseException ex) {
+			LOG.error(ex.getMessageStack());
+		} catch (Exception ex) {
+			LOG.error(ex.getMessage());
+		}
+
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException,
+			PersistenceClassNotRegistered, PersistenceException,
+			PersistenceValidateExceptions {
+		MapContext obj1 = new MapContext(new Projection());
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+
+		MapContext obj2 = (MapContext) manager.create(state);
+		this.compareMapContext(obj1, obj2);
+	}
+
+	public void testSaveState() throws Exception {
+		MapContext obj = new MapContext(new Projection());
+		PersistentState state = manager.getState(obj);
+
+		File f = File.createTempFile("gvsig-test-pers-complex", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+
+	public void testLoadState() throws Exception {
+		MapContext obj1 = new MapContext(new Projection());
+		PersistentState state1 = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-complex", "B.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state1, out);
+		out.close();
+
+		InputStream in = new FileInputStream(f);
+		PersistentState state2 = manager.loadState(in);
+		MapContext obj2 = (MapContext) manager.create(state2);
+
+		this.compareMapContext(obj1, obj2);
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/ComplexTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/Case1AllTests.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/Case1AllTests.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/Case1AllTests.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import org.gvsig.tools.persistence.case1.ComplexTest;
+import org.gvsig.tools.persistence.case1.MoreComplexTest;
+import org.gvsig.tools.persistence.case1.SingleFactoryTest;
+import org.gvsig.tools.persistence.case1.SimpleTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class Case1AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for org.gvsig.tools.persistence.case1");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(SimpleTest.class);
+		suite.addTestSuite(SingleFactoryTest.class);
+		suite.addTestSuite(MultiFactoryTest.class);
+		suite.addTestSuite(ComplexTest.class);
+		suite.addTestSuite(MoreComplexTest.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/Case1AllTests.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SimpleTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SimpleTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SimpleTest.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.case1.model.ModelManager;
+import org.gvsig.tools.persistence.case1.model.ProjectExtent;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class SimpleTest extends AbstractLibraryAutoInitTestCase {
+
+	PersistenceManager manager;
+	ModelManager modelmgr;
+	
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		modelmgr = new ModelManager();
+		modelmgr.registerPersistence();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		modelmgr.unregisterPersistence();
+	}
+	
+	public void testRegister() {
+
+		DynStruct definition = manager.getDefinition(ProjectExtent.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"ProjectExtent", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		ProjectExtent obj = new ProjectExtent();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+		DynStruct definition = state.getDefinition();
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"ProjectExtent", 
+				definition.getName()
+		);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		ProjectExtent obj1 = new ProjectExtent();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		ProjectExtent obj2 = (ProjectExtent) manager.create(state);
+		assertEquals("Restore of object state failed, code mismatch", obj1.getCode(), obj2.getCode());
+		assertEquals("Restore of object state failed, description mismatch", obj1.description, obj2.description);
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SimpleTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SingleFactoryTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SingleFactoryTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SingleFactoryTest.java	(revision 1235)
@@ -0,0 +1,83 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.case1.model.Projection;
+import org.gvsig.tools.persistence.case1.model.ProjectionFactory;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class SingleFactoryTest extends AbstractLibraryAutoInitTestCase {
+
+	PersistenceManager manager;
+	PersistenceFactory factory;
+	
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		factory = new ProjectionFactory();
+		manager.registerFactory(factory);
+		
+	}
+	
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		manager.unregisterFactory(factory);
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(Projection.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"Projection", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Projection obj = new Projection();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Projection obj1 = new Projection();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		Projection obj2 = (Projection) manager.create(state);
+		assertEquals("Restore of object state failed, fullcode mismatch", obj1.getFullCode(), obj2.getFullCode());
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/SingleFactoryTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MoreComplexTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MoreComplexTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MoreComplexTest.java	(revision 1235)
@@ -0,0 +1,172 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.case1;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.case1.model.ModelManager;
+import org.gvsig.tools.persistence.case1.model.Project;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class MoreComplexTest  extends AbstractLibraryAutoInitTestCase {
+
+	PersistenceManager manager;
+	ModelManager modelmgr;
+	
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getPersistenceManager();
+		manager.setAutoValidation(PersistenceManager.MANDATORY);
+		modelmgr = ModelManager.getManager();
+		modelmgr.registerPersistence();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		modelmgr.unregisterPersistence();
+	}
+
+	private void compareProject(Project obj1, Project obj2) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(Project.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"Project", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Project obj = new Project();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		Project obj1 = new Project();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		Project obj2 = (Project) manager.create(state);
+		this.compareProject(obj1, obj2);
+	}
+
+	public void testSaveState() throws Exception {
+		Project obj1 = new Project();
+		PersistentState state = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+
+	public void testLoadState() throws Exception {
+		Project obj1 = new Project();
+		PersistentState state1 = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "B.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state1, out);
+		out.close();
+		
+		InputStream in = new FileInputStream(f);
+		PersistentState state2 = manager.loadState(in);
+		Project obj2 = (Project) manager.create(state2);
+		
+		this.compareProject(obj1, obj2);		
+
+	}
+
+	public void testSaveStateWithOneProjectExtent() throws Exception {
+		Project obj1 = new Project();
+		obj1.addExtent();
+		PersistentState state = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+
+	public void testSaveStateWithTwoProjectExtent() throws Exception {
+		Project obj1 = new Project();
+		obj1.addExtent();
+		obj1.addExtent();
+		PersistentState state = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+
+	public void testSaveStateWithOneDocument() throws Exception {
+		Project obj1 = new Project();
+		obj1.addExtent();
+		obj1.addExtent();
+		obj1.addDocument();
+		PersistentState state = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+	public void testSaveStateWithTwoDocument() throws Exception {
+		Project obj1 = new Project();
+		obj1.addExtent();
+		obj1.addExtent();
+		obj1.addDocument();
+		obj1.addDocument();
+		PersistentState state = manager.getState(obj1);
+
+		File f = File.createTempFile("gvsig-test-pers-project", "A.zip");
+		OutputStream out = new FileOutputStream(f);
+		manager.saveState(state, out);
+		out.close();
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/case1/MoreComplexTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicListTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicListTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicListTest.java	(revision 1235)
@@ -0,0 +1,269 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class BasicListTest 	extends AbstractBasicTest {
+
+	private static final int TEST_LIST = 0;
+	private static final int TEST_ITERATOR_SET = 1;
+	private static final int TEST_ITERATOR = 2;
+	
+	private static int test_mode = TEST_LIST;
+	
+	public static  class MyObject2 implements Persistent {
+
+		String name;
+		
+		public MyObject2() {
+			this.name = "(unknow)";
+		}
+		
+		MyObject2(String name){
+			this.name = name;
+		}
+		
+		public String getName() {
+			return this.name;
+		}
+		
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.name = state.getString("name");
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("name",this.name);
+		}
+		
+	}
+	
+	public static  class MyObject implements Persistent {
+		List values;
+		List persistentValues;
+
+		public MyObject() {
+			this.values = new ArrayList();
+			this.persistentValues = new ArrayList();
+
+			for( int i=0; i<10; i++ ) {
+				this.values.add("valor-" + i);
+			}
+
+			for( int i=0; i<10; i++ ) {
+				this.persistentValues.add( new MyObject2("valor-" + i));
+			}
+		}
+		
+		void check() {
+			assertNotNull(this.values);
+			assertNotNull(this.persistentValues);
+			assertEquals("size of list mistmach",10, this.values.size());
+			for( int i=0; i<10; i++ ) {
+				assertEquals("value "+ i + "mistmach.", "valor-"+i, this.values.get(i));
+			}
+			for( int i=0; i<10; i++ ) {
+				assertEquals("persistentValue "+ i + "mistmach.", "valor-"+i, ((MyObject2)this.persistentValues.get(i)).getName());
+			}
+		}
+
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			switch( test_mode) {
+			case TEST_ITERATOR_SET:
+			case TEST_LIST:
+				this.values = new ArrayList(state.getList("values"));
+				this.persistentValues = new ArrayList(state.getList("persistentValues"));
+				break;
+				
+			case TEST_ITERATOR:
+				Iterator it;
+				this.values = new ArrayList();
+				it = state.getIterator("values");
+				while( it.hasNext() ) {
+					this.values.add( it.next());
+				}
+				this.persistentValues = new ArrayList();
+				it = state.getIterator("persistentValues");
+				while( it.hasNext() ) {
+					this.persistentValues.add( it.next());
+				}
+				break;
+			}
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			switch( test_mode) {
+			case TEST_LIST:
+				state.set("values",this.values);
+				state.set("persistentValues",this.persistentValues);
+				break;
+
+			case TEST_ITERATOR:
+			case TEST_ITERATOR_SET:
+				state.set("values",this.values.iterator());
+				state.set("persistentValues",this.persistentValues.iterator());
+				break;
+			}
+		}
+	}
+	
+	protected void register() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition2 = manager.addDefinition(
+				MyObject2.class,
+				"MyObject2BasicList",
+				"MyObject2BasicList Persistence definition",
+				null, 
+				null
+		);
+		definition2.addDynFieldString("name").setMandatory(true);
+
+		DynStruct definition = manager.addDefinition(
+				MyObject.class,
+				"MyObjectBasicList",
+				"MyObjectBasicList Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldList("values").setMandatory(true).setElementsType(DataTypes.STRING);
+		definition.addDynFieldList("persistentValues").setMandatory(true).setElementsType(definition2);
+	}
+
+	protected void unregister() throws PersistenceClassNotRegistered {
+		manager.unregisterClass("MyObjectBasicList");
+		manager.unregisterClass("MyObject2BasicList");
+	}
+	
+	public void doSetUp() throws Exception {
+		super.doSetUp();
+		register();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		unregister();
+	}
+	
+
+	//
+	// =================================================
+	//
+	
+	protected String getTestId() {
+		return "basiclist";
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(MyObject.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicList", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObject obj = new MyObject();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+		DynStruct definition = state.getDefinition();
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicList", 
+				definition.getName()
+		);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObject obj1 = new MyObject();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		MyObject obj2 = (MyObject) manager.create(state);
+		obj2.check();
+		obj1.check();
+	}
+
+	public void testListSaveState() throws Exception {
+		test_mode = TEST_LIST;
+		MyObject obj = new MyObject();
+		saveState(obj);
+	}
+
+	public void testListLoadState() throws Exception {
+		test_mode = TEST_LIST;
+		MyObject obj1 = new MyObject();
+		MyObject obj2 = (MyObject) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj2.check();
+		obj1.check();
+	}
+	
+	public void testIteratorSetSaveState() throws Exception {
+		test_mode = TEST_ITERATOR_SET;
+		MyObject obj = new MyObject();
+		saveState(obj);
+	}
+
+	public void testIteratorSetLoadState() throws Exception {
+		test_mode = TEST_ITERATOR_SET;
+		MyObject obj1 = new MyObject();
+		MyObject obj2 = (MyObject) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj2.check();
+		obj1.check();
+	}
+
+	public void testIteratorSaveState() throws Exception {
+		test_mode = TEST_ITERATOR;
+		MyObject obj = new MyObject();
+		saveState(obj);
+	}
+
+	public void testIteratorLoadState() throws Exception {
+		test_mode = TEST_ITERATOR;
+		MyObject obj1 = new MyObject();
+		MyObject obj2 = (MyObject) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj2.check();
+		obj1.check();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicListTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicSetTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicSetTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicSetTest.java	(revision 1235)
@@ -0,0 +1,220 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class BasicSetTest 	extends AbstractBasicTest {
+	
+	public static  class MyObject2 implements Persistent {
+
+		String name;
+		
+		public MyObject2() {
+			this.name = "(unknow)";
+		}
+		
+		MyObject2(String name){
+			this.name = name;
+		}
+		
+		public String getName() {
+			return this.name;
+		}
+		
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.name = state.getString("name");
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("name",this.name);
+		}
+		
+	}
+	
+	public static  class MyObject implements Persistent {
+		Set values;
+		Set persistentValues;
+
+		public MyObject() {
+			this.values = new HashSet();
+			this.persistentValues = new HashSet();
+
+			for( int i=0; i<10; i++ ) {
+				this.values.add( "valor-" + i);
+			}
+
+			for( int i=0; i<10; i++ ) {
+				this.persistentValues.add( new MyObject2("valor-" + i));
+			}
+		}
+		
+		void check() {
+			assertNotNull(this.values);
+			assertNotNull(this.persistentValues);
+			assertEquals("size of list of strings mistmach",10, this.values.size());
+			assertEquals("size of list of complex object mistmach",10, this.persistentValues.size());
+			Set values = new HashSet();
+			
+			for( int i=0; i<10; i++ ) {
+				String value = "valor-"+i;
+				values.add(value);
+				assertTrue("value "+ i + " mistmach in list of strings.", this.values.contains(value));
+			}
+			Iterator it = this.persistentValues.iterator();
+			while( it.hasNext() ) {
+				MyObject2 obj = (MyObject2) it.next();
+				if( ! values.contains(obj.getName()) ) {
+					fail("value '"+ obj.getName() + "' mistmach in list of complex objects.");
+				}
+				values.remove(obj.getName());
+			}
+			if( values.size() != 0 ) {
+				fail("Unspected values in list of complex objects ");
+			}
+		}
+
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.values = new HashSet(state.getSet("values"));
+			this.persistentValues = new HashSet(state.getSet("persistentValues"));
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("values",this.values);
+			state.set("persistentValues",this.persistentValues);
+		}
+	}
+	
+
+	protected void register() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition2 = manager.addDefinition(
+				MyObject2.class,
+				"MyObject2BasicSet",
+				"MyObject2BasicSet Persistence definition",
+				null, 
+				null
+		);
+		definition2.addDynFieldString("name").setMandatory(true);
+
+		DynStruct definition = manager.addDefinition(
+				MyObject.class,
+				"MyObjectBasicSet",
+				"MyObjectBasicSet Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldSet("values").setMandatory(true).setElementsType(DataTypes.STRING);
+		definition.addDynFieldSet("persistentValues").setMandatory(true).setElementsType(definition2);
+	}
+
+	protected void unregister() throws PersistenceClassNotRegistered {
+		manager.unregisterClass("MyObjectBasicSet");
+		manager.unregisterClass("MyObject2BasicSet");
+	}
+	
+	public void doSetUp() throws Exception {
+		super.doSetUp();
+		register();
+	}
+	
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		unregister();
+	}
+	
+	//
+	// =================================================
+	//
+	
+	protected String getTestId() {
+		return "basiclist";
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(MyObject.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicSet", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		try {
+			MyObject obj = new MyObject();
+			PersistentState state = manager.getState(obj);
+			assertNotNull("Can't retrieve state", state);
+			DynStruct definition = state.getDefinition();
+			assertNotNull("Can't register class", definition);
+			assertEquals(
+					"Registration don't work, name incorrect", 
+					"MyObjectBasicSet", 
+					definition.getName()
+			);
+		}catch(PersistenceValidateExceptions ex) {
+			fail(ex.getMessage());
+		}
+ 	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObject obj1 = new MyObject();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		MyObject obj2 = (MyObject) manager.create(state);
+		obj2.check();
+		obj1.check();
+	}
+
+	public void testListSaveState() throws Exception {
+		MyObject obj = new MyObject();
+		saveState(obj);
+	}
+
+	public void testListLoadState() throws Exception {
+		MyObject obj1 = new MyObject();
+		MyObject obj2 = (MyObject) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj2.check();
+		obj1.check();
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicSetTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory4Test.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory4Test.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/DynObjectFactory4Test.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.InputStream;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class DynObjectFactory4Test extends DynObjectFactoryTest {
+
+	private String OBJPARENT_NAME = "MyObjectComplexTypes";
+
+	public void doSetUp() throws Exception {
+		super.doSetUp();
+	}
+
+	protected void register() throws Exception {
+		if (this.manager.getDynObjectDefinition(OBJPARENT_NAME) == null) {
+			InputStream resource = this
+			.getClass()
+			.getClassLoader()
+			.getResourceAsStream(
+			"org/gvsig/tools/persistence/BasicTypes2Test.xml");
+			
+			Map definitions = this.dynManager.importDynClassDefinitions(
+					resource, null);
+
+			DynClass dynStruct = (DynClass) definitions.get(OBJPARENT_NAME);
+			this.manager.addDefinition(dynStruct, null, null);
+			// ToolsLocator.getDynObjectManager().add(dynStruct);
+
+			dynStruct = (DynClass) definitions.get(OBJ1_NAME);
+			ToolsLocator.getDynObjectManager().add(dynStruct);
+			this.manager.addDefinition(dynStruct, null, null);
+
+		}
+
+	}
+	
+	void check(DynObject obj1, DynObject obj2) {
+		super.check(obj1, obj2);
+
+	}
+
+	protected DynObject createDynObject1() {
+		DynObject dynObject = super.createDynObject1(OBJPARENT_NAME);
+		dynObject.setDynValue("child", super.createDynObject1(OBJ1_NAME));
+		return dynObject;
+	}
+
+	protected String getTestId() {
+		return "dopf4";
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicMapTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicMapTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicMapTest.java	(revision 1235)
@@ -0,0 +1,199 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public class BasicMapTest 	extends AbstractBasicTest {
+	
+	public static  class MyObject2 implements Persistent {
+
+		String name;
+		
+		public MyObject2() {
+			this.name = "(unknow)";
+		}
+		
+		MyObject2(String name){
+			this.name = name;
+		}
+		
+		public String getName() {
+			return this.name;
+		}
+		
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.name = state.getString("name");
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("name",this.name);
+		}
+		
+	}
+	
+	public static  class MyObject implements Persistent {
+		Map values;
+		Map persistentValues;
+
+		public MyObject() {
+			this.values = new HashMap();
+			this.persistentValues = new HashMap();
+
+			for( int i=0; i<10; i++ ) {
+				this.values.put(new Integer(i), "valor-" + i);
+			}
+
+			for( int i=0; i<10; i++ ) {
+				this.persistentValues.put( new Integer(i), new MyObject2("valor-" + i));
+			}
+		}
+		
+		void check() {
+			assertNotNull(this.values);
+			assertNotNull(this.persistentValues);
+			assertEquals("size of list mistmach",10, this.values.size());
+			for( int i=0; i<10; i++ ) {
+				assertEquals("value "+ i + "mistmach.", "valor-"+i, this.values.get(new Integer(i)));
+			}
+			for( int i=0; i<10; i++ ) {
+				assertEquals("persistentValue "+ i + "mistmach.", "valor-"+i, ((MyObject2)this.persistentValues.get(new Integer(i))).getName());
+			}
+		}
+
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.values = new HashMap(state.getMap("values"));
+			this.persistentValues = new HashMap(state.getMap("persistentValues"));
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("values",this.values);
+			state.set("persistentValues",this.persistentValues);
+		}
+	}
+	
+	protected void register() {
+		DynStruct definition2 = manager.addDefinition(
+				MyObject2.class,
+				"MyObject2BasicMap",
+				"MyObject2BasicMap Persistence definition",
+				null, 
+				null
+		);
+		definition2.addDynFieldString("name").setMandatory(true);
+
+		DynStruct definition = manager.addDefinition(
+				MyObject.class,
+				"MyObjectBasicMap",
+				"MyObjectBasicMap Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldMap("values").setMandatory(true).setElementsType(DataTypes.STRING);
+		definition.addDynFieldMap("persistentValues").setMandatory(true).setElementsType(definition2);
+	}
+
+	protected void unregister() throws PersistenceClassNotRegistered {
+		manager.unregisterClass("MyObjectBasicMap");
+		manager.unregisterClass("MyObject2BasicMap");
+	}
+	
+	//
+	// =================================================
+	//
+	
+	public void doSetUp() throws Exception {
+		super.doSetUp();
+		register();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		unregister();
+	}
+	
+	protected String getTestId() {
+		return "basicmap";
+	}
+	
+	public void testRegister() {
+		DynStruct definition = manager.getDefinition(MyObject.class);
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicMap", 
+				definition.getName()
+		);
+	}
+	
+	public void testGetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObject obj = new MyObject();
+		PersistentState state = manager.getState(obj);
+		assertNotNull("Can't retrieve state", state);
+		DynStruct definition = state.getDefinition();
+		assertNotNull("Can't register class", definition);
+		assertEquals(
+				"Registration don't work, name incorrect", 
+				"MyObjectBasicMap", 
+				definition.getName()
+		);
+	}
+
+	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+		MyObject obj1 = new MyObject();
+		PersistentState state = manager.getState(obj1);
+		assertNotNull("Can't retrieve state", state);
+		
+		MyObject obj2 = (MyObject) manager.create(state);
+		obj2.check();
+		obj1.check();
+	}
+
+	public void testListSaveState() throws Exception {
+		MyObject obj = new MyObject();
+		saveState(obj);
+	}
+
+	public void testListLoadState() throws Exception {
+		MyObject obj1 = new MyObject();
+		MyObject obj2 = (MyObject) manager.create(this.saveAndRestoreState(obj1));
+		
+		obj2.check();
+		obj1.check();
+	}
+	
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/BasicMapTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/paging/DefaultPagingCalculatorTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/paging/DefaultPagingCalculatorTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/paging/DefaultPagingCalculatorTest.java	(revision 1235)
@@ -0,0 +1,138 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.paging;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.paging.DefaultPagingCalculator;
+import org.gvsig.tools.paging.PagingCalculator.Sizeable;
+
+/**
+ * Unit tests for the {@link DefaultPagingCalculator} class.
+ * 
+ * @author gvSIG team
+ */
+public class DefaultPagingCalculatorTest extends TestCase {
+
+    private DefaultPagingCalculator calculator;
+
+	private static final long SIZE = 22;
+
+	private static final int MAX_PAGE_SIZE = 4;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		calculator = createCalculator();
+	}
+
+    protected DefaultPagingCalculator createCalculator() {
+        return new DefaultPagingCalculator(new Sizeable() {
+
+            public long getSize() {
+                return SIZE;
+            }
+        }, MAX_PAGE_SIZE);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#getMaxPageSize()}
+	 * and
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#setMaxPageSize(int)}
+	 * .
+	 */
+	public void testMaxPageSize() {
+		assertEquals(MAX_PAGE_SIZE, calculator.getMaxPageSize());
+
+		calculator.setMaxPageSize(100);
+		assertEquals(100, calculator.getMaxPageSize());
+
+		try {
+			calculator.setMaxPageSize(-10);
+			fail("Calculator accepts a negative max page size value");
+		} catch (Exception ex) {
+			// works as expected
+		}
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#getCurrentPage()}
+	 * and
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#setCurrentPage(long)}
+	 * .
+	 */
+	public void testCurrentPage() {
+		assertEquals(0, calculator.getCurrentPage());
+
+		long page = calculator.getNumPages() - 1;
+		calculator.setCurrentPage(page);
+
+		assertEquals(page, calculator.getCurrentPage());
+
+		try {
+			calculator.setCurrentPage(-10);
+			fail("Calculator accepts a negative current page value");
+		} catch (Exception ex) {
+			// works as expected
+		}
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#getInitialIndex()}
+	 * .
+	 */
+	public void testGetInitialIndex() {
+		calculator.setCurrentPage(0l);
+		assertEquals(0, calculator.getInitialIndex());
+
+		calculator.setCurrentPage(2);
+		assertEquals(2 * calculator.getMaxPageSize(),
+				calculator.getInitialIndex());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#getNumPages()}
+	 * .
+	 */
+	public void testGetNumPages() {
+		assertEquals(6, calculator.getNumPages());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.AbstractPagingCalculator#getCurrentPageSize()}
+	 * .
+	 */
+	public void testGetCurrentPageSize() {
+		for (int i = 0; i < calculator.getNumPages() - 1; i++) {
+			calculator.setCurrentPage(i);
+			assertEquals(MAX_PAGE_SIZE, calculator.getCurrentPageSize());			
+		}
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertEquals(SIZE % MAX_PAGE_SIZE, calculator.getCurrentPageSize());
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/TestAbstractDisposableManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/TestAbstractDisposableManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/TestAbstractDisposableManager.java	(revision 1235)
@@ -0,0 +1,131 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dispose.impl;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposableManager;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Unit tests for the {@link DisposableManager} API.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class TestAbstractDisposableManager extends TestCase {
+
+	private DisposableManager manager;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		manager = createDisposableManager();
+	}
+
+	protected abstract DisposableManager createDisposableManager();
+
+	/**
+	 * Test method for {@link org.gvsig.tools.dispose.impl.DefaultDisposableManager#bind(org.gvsig.tools.dispose.Disposable)}.
+	 */
+	public void testBind() {
+		Disposable disposable = new TestDisposable();
+		assertTrue(manager.bind(disposable));
+		assertFalse("A disposable has been able to bind once again",
+				manager.bind(disposable));
+		assertEquals(1, manager.getBoundDisposableCount());
+		
+		Disposable disposable2 = new TestDisposable();
+		assertTrue(manager.bind(disposable2));
+		assertFalse(manager.bind(disposable2));
+		assertEquals(2, manager.getBoundDisposableCount());
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.tools.dispose.impl.DefaultDisposableManager#release(org.gvsig.tools.dispose.Disposable)}.
+	 */
+	public void testRelease() {
+		Disposable disposable = new TestDisposable();
+		assertFalse(manager.release(disposable));
+		manager.bind(disposable);
+		assertTrue(manager.release(disposable));
+		assertEquals(0, manager.getBoundDisposableCount());
+
+		Disposable disposable2 = new TestDisposable();
+		manager.bind(disposable);
+		assertFalse(manager.release(disposable2));
+		manager.bind(disposable2);
+		assertTrue(manager.release(disposable2));
+		assertEquals(1, manager.getBoundDisposableCount());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dispose.impl.DefaultDisposableManager#releaseAll()}
+	 * .
+	 * 
+	 * @throws BaseException
+	 */
+	public void testReleaseAll() throws BaseException {
+		Disposable disposable = new TestDisposable();
+		Disposable disposable2 = new TestDisposable();
+		manager.bind(disposable);
+		manager.bind(disposable2);
+		manager.releaseAll();
+		assertEquals(0, manager.getBoundDisposableCount());
+		assertFalse(manager.release(disposable));
+		assertFalse(manager.release(disposable2));
+	}
+
+	private class TestDisposable implements Disposable {
+		public void dispose() {
+			// Nothing to do
+		}
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/DefaultDisposableManagerTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/DefaultDisposableManagerTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dispose/impl/DefaultDisposableManagerTest.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.dispose.impl;
+
+import org.gvsig.tools.dispose.DisposableManager;
+
+/**
+ * Unit tests for the {@link DefaultDisposableManager}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultDisposableManagerTest extends TestAbstractDisposableManager {
+
+	protected DisposableManager createDisposableManager() {
+		return new DefaultDisposableManager();
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoint.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoint.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoint.java	(revision 1235)
@@ -0,0 +1,199 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.extensionpoint;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+import org.gvsig.tools.extensionpoint.impl.DefaultExtensionPointManager;
+
+public class TestExtensionPoint extends TestCase {
+
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	private ExtensionPointManager getManager() {
+		return DefaultExtensionPointManager.getManager();
+	}
+
+	public void testCreacion() {
+		String name = "LayerWizars";
+		String description = "Punto de extension que registra los distintos Wizars para a�adir capas.";
+		ExtensionPoint ep = null;
+
+		ep = getManager().create(name, description);
+		TestExtensionPoint.assertEquals(ep.getName(),name);
+		TestExtensionPoint.assertEquals(ep.getDescription(),description);
+
+		ep.append("WMSLayer", null, ExtensionDePrueba2.class);
+		ep.append("WCSLayer", null, ExtensionDePrueba1.class);
+		ep.append("WFSLayer", null, ExtensionDePrueba1.class);
+
+		TestExtensionPoint.assertEquals(ep.getCount(), 3);
+
+		// Comprobamos que la lista de extensiones
+		// mantiene el orden de insercion.
+		Iterator iter = ep.iterator();
+		TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+		TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+
+		try {
+			/*Object extension =*/ ep.create("WCSLayer");
+		} catch (InstantiationException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WCSLayer con InstantiationException");
+		} catch (IllegalAccessException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WCSLayer con IllegalAccessException");
+		}
+
+		ExtensionDePrueba2 extension = null;
+		try {
+			Object args[] = {"pepe",new Integer(5)};
+			extension =(ExtensionDePrueba2)ep.create("WMSLayer",args);
+		} catch (InstantiationException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con InstantiationException");
+		} catch (IllegalAccessException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con IllegalAccessException");
+		} catch (SecurityException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con SecurityException");
+		} catch (IllegalArgumentException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con IllegalArgumentException");
+		} catch (NoSuchMethodException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con NoSuchMethodException");
+		} catch (InvocationTargetException e) {
+			TestExtensionPoint.fail("Ha petado la creacion de WMSLayer con InvocationTargetException");
+		}
+
+		TestExtensionPoint.assertEquals("pepe",extension.nombre);
+		TestExtensionPoint.assertEquals(5,extension.ancho);
+
+	}
+
+	public void testInsert() {
+		String name = "LayerWizars";
+		String description = "Punto de extension que registra los distintos Wizars para a�adir capas.";
+		ExtensionPoint ep = null;
+
+		ep = getManager().create(name, description);
+
+		ep.append("WMSLayer", null, ExtensionDePrueba2.class);
+		ep.append("WCSLayer", null, ExtensionDePrueba1.class);
+		ep.append("WFSLayer", null, ExtensionDePrueba1.class);
+		Iterator iter = ep.iterator();
+        TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+
+		ep.insert("WCSLayer", "testA", null, ExtensionDePrueba1.class);
+
+		iter = ep.iterator();
+        TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testA", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+
+		ep.insert("XXXX", "testB", null, ExtensionDePrueba1.class);
+		iter = ep.iterator();
+        TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testA", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testB", ((Extension) iter.next())
+                .getName());
+
+		ep.insert("testB", "testC", null, ExtensionDePrueba1.class);
+		iter = ep.iterator();
+        TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testA", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testC", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testB", ((Extension) iter.next())
+                .getName());
+
+		ep.insert("WMSLayer", "testD", null, ExtensionDePrueba1.class);
+		iter = ep.iterator();
+        TestExtensionPoint.assertEquals("testD", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WMSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testA", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WCSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("WFSLayer", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testC", ((Extension) iter.next())
+                .getName());
+        TestExtensionPoint.assertEquals("testB", ((Extension) iter.next())
+                .getName());
+	}
+
+	public static class ExtensionDePrueba1 {
+        public ExtensionDePrueba1() {
+            ;
+        }
+    }
+
+	public static class ExtensionDePrueba2 {
+        public int ancho;
+        public String nombre;
+
+        public ExtensionDePrueba2(String nombre, Integer ancho) {
+            this.ancho = ancho.intValue();
+            this.nombre = nombre;
+        }
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoints.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoints.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/extensionpoint/TestExtensionPoints.java	(revision 1235)
@@ -0,0 +1,187 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.extensionpoint;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+import org.gvsig.tools.extensionpoint.impl.DefaultExtensionPointManager;
+
+public class TestExtensionPoints extends TestCase {
+
+	protected void setUp() throws Exception {
+	    // Remove previous registered extension points, so other tests
+        // don't affect the test validations.
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	public void test() {
+		ExtensionPointManager manager = new DefaultExtensionPointManager();
+
+		manager.add("LayerWizars").append("WMS", null,
+				UnaExtensionDePrueba1.class);
+		manager.add("LayerWizars").append("WCS", null,
+				UnaExtensionDePrueba2.class);
+		manager.add("OtherWizars").append("uno", null,
+				UnaExtensionDePrueba1.class);
+		manager.add("OtherWizars").append("dos", null,
+				UnaExtensionDePrueba2.class);
+
+		// Comprobamos que el orden de las extensiones es el que hemos fijado.
+		ExtensionPoint x = manager.get("LayerWizars");
+		Iterator i = x.iterator();
+		String[] nombres = {"WMS", "WCS" };
+		int n = 0;
+		while( i.hasNext() ) {
+			String nombre = ((Extension) i.next()).getName();
+			assertTrue(nombres[n].equals(nombre));
+			n++;
+		}
+
+
+		ExtensionPoint extensionPointLayerWizars;
+		extensionPointLayerWizars = manager.get("LayerWizars");
+		assertTrue(extensionPointLayerWizars.has("WMS"));
+		assertTrue(extensionPointLayerWizars.has("WCS"));
+
+		assertEquals(2, manager.getCount());
+		assertEquals(2, extensionPointLayerWizars.getCount());
+
+		ExtensionPoint extensionPointLayerWizars2 = manager.create(
+				"LayerWizars", null);
+
+
+		extensionPointLayerWizars2.append("File", null,
+				UnaExtensionDePrueba3.class);
+		extensionPointLayerWizars2.append("JDBC", null,
+				UnaExtensionDePrueba4.class);
+
+		manager.add(extensionPointLayerWizars2);
+
+		extensionPointLayerWizars = manager.get("LayerWizars");
+		assertEquals(manager.getCount(), 2);
+		assertEquals(4, extensionPointLayerWizars.getCount());
+        assertEquals(2, manager.get("OtherWizars").getCount());
+
+		assertTrue(extensionPointLayerWizars.has("WMS"));
+		assertTrue(extensionPointLayerWizars.has("WCS"));
+		assertTrue(extensionPointLayerWizars.has("File"));
+		assertTrue(extensionPointLayerWizars.has("JDBC"));
+
+		assertEquals(UnaExtensionDePrueba4.class, extensionPointLayerWizars
+                .get("JDBC").getExtension());
+        assertEquals(UnaExtensionDePrueba1.class, extensionPointLayerWizars
+                .get("WMS").getExtension());
+
+		assertEquals(UnaExtensionDePrueba1.class, manager.get("OtherWizars")
+                .get("uno").getExtension());
+
+		ExtensionPoint extensionPointOther2 = manager.create("OtherWizars",
+				null);
+		extensionPointOther2.append("tres", null, UnaExtensionDePrueba3.class);
+		extensionPointOther2
+				.append("cuatro", null, UnaExtensionDePrueba4.class);
+
+		manager.add(extensionPointOther2);
+
+		ExtensionPoint extensionPointOther = manager.get("OtherWizars");
+		assertEquals(manager.getCount(), 2);
+		assertEquals(extensionPointLayerWizars.getCount(), 4);
+		assertEquals(extensionPointOther.getCount(), 4);
+
+		assertTrue(extensionPointOther.has("uno"));
+		assertTrue(extensionPointOther.has("dos"));
+		assertTrue(extensionPointOther.has("tres"));
+		assertTrue(extensionPointOther.has("cuatro"));
+
+		assertEquals(UnaExtensionDePrueba3.class, extensionPointOther.get(
+                "tres").getExtension());
+        assertEquals(UnaExtensionDePrueba2.class, extensionPointOther
+                .get("dos").getExtension());
+
+		assertEquals(manager.get("Ninguno"), null);
+	}
+
+	public void testSingleton() {
+		ExtensionPointManager manager1 = DefaultExtensionPointManager
+				.getManager();
+		int previous_count = manager1.getCount();
+		if (manager1.has("LayerWizars")) {
+			previous_count--;
+		}
+		if (manager1.has("OtherWizars")) {
+			previous_count--;
+		}
+
+
+
+		manager1.add("LayerWizars").append("WMS", null,
+				UnaExtensionDePrueba1.class);
+		manager1.add("LayerWizars").append("WCS", null,
+				UnaExtensionDePrueba2.class);
+		manager1.add("OtherWizars").append("uno", null,
+				UnaExtensionDePrueba1.class);
+		manager1.add("OtherWizars").append("dos", null,
+				UnaExtensionDePrueba2.class);
+
+		ExtensionPointManager manager2 = DefaultExtensionPointManager
+				.getManager();
+		assertEquals(previous_count + 2, manager2.getCount());
+		assertEquals(previous_count + 2, manager1.getCount());
+
+		ExtensionPoint extensionPointLayerWizars;
+		extensionPointLayerWizars = manager2.get("LayerWizars");
+		assertTrue(extensionPointLayerWizars.has("WMS"));
+		assertTrue(extensionPointLayerWizars.has("WCS"));
+	}
+}
+
+class UnaExtensionDePrueba1 {
+    public UnaExtensionDePrueba1() {
+		;
+	}
+}
+class UnaExtensionDePrueba2 {
+	public UnaExtensionDePrueba2() {
+	}
+}
+
+class UnaExtensionDePrueba3 {
+	public UnaExtensionDePrueba3() {
+	}
+}
+
+class UnaExtensionDePrueba4 {
+	public UnaExtensionDePrueba4() {
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservableTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservableTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservableTest.java	(revision 1235)
@@ -0,0 +1,267 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.observer.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+
+/**
+ * Unit tests for the {@link BaseWeakReferencingObservable} class.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class BaseWeakReferencingObservableTest extends TestCase {
+
+    private BaseWeakReferencingObservable observable;
+    private MockControl obsControl;
+    private Observer observer;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        observable = new BaseWeakReferencingObservable();
+        obsControl = MockControl.createStrictControl(Observer.class);
+        observer = (Observer) obsControl.getMock();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#enableNotifications()}
+     * .
+     */
+    public void testEnableNotifications() {
+        observer.update(observable, null);
+        obsControl.replay();
+
+        observable.addObserver(observer);
+        observable.enableNotifications();
+        observable.notifyObservers();
+
+        obsControl.verify();
+    }
+
+    /**
+     * Test method for {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#dis}.
+     */
+    public void testDisableNotifications() {
+        // The observer must not be notified
+        obsControl.replay();
+
+        observable.addObserver(observer);
+        observable.disableNotifications();
+        observable.notifyObservers();
+
+        obsControl.verify();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#isEnabledNotifications()}
+     * .
+     */
+    public void testIsEnabledNotifications() {
+        assertTrue(observable.isEnabledNotifications());
+
+        observable.disableNotifications();
+        assertFalse(observable.isEnabledNotifications());
+
+        observable.enableNotifications();
+        assertTrue(observable.isEnabledNotifications());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#addObserver(org.gvsig.tools.observer.Observer)}
+     * .
+     */
+    public void testAddObserverObserver() {
+        assertEquals(0, observable.countObservers());
+        observable.addObserver(observer);
+        assertEquals(1, observable.countObservers());
+        observable.addObserver(observer);
+        assertEquals(1, observable.countObservers());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#addObserver(java.lang.ref.Reference)}
+     * .
+     */
+    public void testAddObserverReference() {
+        assertEquals(0, observable.countObservers());
+        observable.addObserver(new WeakReference(observer));
+        assertEquals(1, observable.countObservers());
+        observable.addObserver(new WeakReference(observer));
+        assertEquals(1, observable.countObservers());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseObservable#addObservers(org.gvsig.tools.observer.impl.BaseObservable)}
+     * .
+     */
+    // public void testAddObservers() {
+    // fail("Not yet implemented");
+    // }
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#deleteObserver(org.gvsig.tools.observer.Observer)}
+     * .
+     */
+    public void testDeleteObserverObserver() {
+        observable.addObserver(observer);
+        assertEquals(1, observable.countObservers());
+        observable.deleteObserver(observer);
+        assertEquals(0, observable.countObservers());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.tools.observer.impl.BaseWeakReferencingObservable#deleteObserver(java.lang.ref.Reference)}
+     * .
+     */
+    public void testDeleteObserverReference() {
+        observable.addObserver(new WeakReference(observer));
+        assertEquals(1, observable.countObservers());
+        observable.deleteObserver(new WeakReference(observer));
+        assertEquals(0, observable.countObservers());
+    }
+
+	/**
+	 * Test method for complex notification management. .
+	 */
+    public void testComplexNotification() {
+		TestObserver observer = new TestObserver();
+		observable.addObserver(observer);
+    	
+		assertFalse(observable.inComplex());
+
+        observable.beginComplexNotification();
+		assertTrue(observable.inComplex());
+        observable.beginComplexNotification();
+		assertTrue(observable.inComplex());
+        observable.beginComplexNotification();
+		assertTrue(observable.inComplex());
+        
+		observable.endComplexNotification();
+		assertTrue(observable.inComplex());
+		observable.endComplexNotification();
+		assertTrue(observable.inComplex());
+        
+        observer.setMustBeNotified(true);
+		observable.endComplexNotification();
+		assertFalse(observable.inComplex());
+    }
+
+    public void testComplex() {
+
+        Random rnd = new Random();
+        rnd.setSeed(System.currentTimeMillis());
+        int i;
+        int notifications = rnd.nextInt(10) + 2;
+        int observers = rnd.nextInt(10) + 3;
+        ArrayList observerList = new ArrayList(observers);
+        MyObserver obs;
+        for (i = 0; i < observers; i++) {
+            obs = new MyObserver();
+            obs.addObserverInFirstNotification = rnd.nextBoolean();
+            observerList.add(obs);
+            observable.addObserver(obs);
+        }
+        observable.beginComplexNotification();
+        for (i = 0; i < notifications; i++) {
+            Object obj = new Integer(i);
+            observable.notifyObservers(obj);
+        }
+
+        for (i = 0; i < observers; i++) {
+            obs = (MyObserver) observerList.get(i);
+            assertEquals(0, obs.notifications.size());
+            assertNull(obs.observerAdded);
+        }
+
+        observable.endComplexNotification();
+
+        for (i = 0; i < observers; i++) {
+            obs = (MyObserver) observerList.get(i);
+            assertEquals(notifications, obs.notifications.size());
+            if (obs.addObserverInFirstNotification) {
+                assertNotNull(obs.observerAdded);
+                assertEquals(0,
+                    obs.observerAdded.notifications.size());
+            }
+        }
+    }
+
+    private class MyObserver implements Observer {
+
+        public List notifications = new ArrayList();
+        public boolean addObserverInFirstNotification = false;
+        public MyObserver observerAdded = null;
+
+        public void update(Observable observable, Object notification) {
+            notifications.add(notification);
+            if (addObserverInFirstNotification && notifications.size() == 1) {
+                observerAdded = new MyObserver();
+                observable.addObserver(observerAdded);
+            }
+        }
+
+    }
+
+	private class TestObserver implements Observer {
+		private boolean mustBeNotified = false;
+
+		public boolean isMustBeNotified() {
+			return mustBeNotified;
+		}
+
+		public void setMustBeNotified(boolean mustBeNotified) {
+			this.mustBeNotified = mustBeNotified;
+		}
+
+		public void update(Observable observable, Object notification) {
+			if (!isMustBeNotified()) {
+				fail("Observer notified when it shouldn't");
+			}
+		}
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLibrary.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider;
+
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class MyLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsAPI(MyLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProvider.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProvider.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProvider.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.spi;
+
+import org.gvsig.tools.service.spi.Provider;
+
+public interface MyProvider extends Provider {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderLocator.java	(revision 1235)
@@ -0,0 +1,96 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.spi;
+
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+public class MyProviderLocator extends BaseLocator {
+
+    /**
+     * My provider manager name.
+     */
+    public static final String MANAGER_NAME = "my.provider.manager";
+
+    /**
+     * My provider manager description.
+     */
+    public static final String MANAGER_DESCRIPTION = "My Provider Manager";
+
+    private static final String LOCATOR_NAME = "my.provider.locator";
+
+    /**
+     * Unique instance.
+     */
+    private static final MyProviderLocator INSTANCE =
+        new MyProviderLocator();
+
+    /**
+     * Return the singleton instance.
+     * 
+     * @return the singleton instance
+     */
+    public static MyProviderLocator getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * Return the Locator's name
+     * 
+     * @return a String with the Locator's name
+     */
+    public String getLocatorName() {
+        return LOCATOR_NAME;
+    }
+
+    /**
+     * Return a reference to the {@link Thematic MapProviderManager}
+     * 
+     * @return a reference to the {@link Thematic MapProviderManager}
+     * @throws LocatorException
+     *             if there is no access to the class or the class cannot be
+     *             instantiated
+     * @see Locator#get(String)
+     */
+    public static MyProviderManager getManager()
+        throws LocatorException {
+        return (MyProviderManager) getInstance().get(MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link Thematic MapProviderManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link Thematic MapProviderManager}
+     *            interface
+     */
+    public static void registerManager(
+        Class clazz) {
+        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
+    }
+    
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderServices.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.spi;
+
+import org.gvsig.tools.service.spi.ProviderServices;
+
+public interface MyProviderServices extends ProviderServices {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderFactory.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.spi;
+
+import org.gvsig.tools.service.spi.ProviderFactory;
+
+public interface MyProviderFactory extends ProviderFactory {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderManager.java	(revision 1235)
@@ -0,0 +1,31 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.spi;
+
+import org.gvsig.tools.service.spi.ProviderManager;
+
+public interface MyProviderManager extends ProviderManager {
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/spi/MyProviderManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/test/ProviderManagerTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/test/ProviderManagerTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/test/ProviderManagerTest.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.test;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.impl.DefaultDataTypesManager;
+import org.gvsig.tools.dynobject.impl.DefaultDynObjectManager;
+import org.gvsig.tools.service.spi.ProviderManager_WithGetFactories;
+import org.gvsig.tools.servicewithprovider.MyLocator;
+import org.gvsig.tools.servicewithprovider.impl.DefaultMyManager;
+import org.gvsig.tools.servicewithprovider.impl.DefaultMyProviderManager;
+import org.gvsig.tools.servicewithprovider.myone.myone1.MyOne1ProviderFactory;
+import org.gvsig.tools.servicewithprovider.myone.myone2.MyOne2ProviderFactory;
+import org.gvsig.tools.servicewithprovider.spi.MyProviderLocator;
+import org.gvsig.tools.servicewithprovider.spi.MyProviderManager;
+
+public class ProviderManagerTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		ToolsLocator.registerDefaultDataTypesManager(DefaultDataTypesManager.class);
+		ToolsLocator.registerDynObjectManager(DefaultDynObjectManager.class);
+		MyProviderLocator.registerManager(DefaultMyProviderManager.class);
+		MyLocator.registerManager(DefaultMyManager.class);
+	}
+
+	private void registerProviders() {
+		MyProviderManager providerManager = MyProviderLocator.getManager();
+		
+		providerManager.addProviderFactory(new MyOne1ProviderFactory());
+		providerManager.addProviderFactory(new MyOne2ProviderFactory());
+	}
+	
+	public void testProviderFactories() {
+		MyProviderManager providerManager = MyProviderLocator.getManager();
+
+		registerProviders();
+		
+		List factories = ((ProviderManager_WithGetFactories)providerManager).getProviderFactories();
+		assertEquals("Expected 2 ProviderFactories", 2, factories.size());
+		
+		assertTrue("Expected an instance of MyOne1ProviderFactory as the first provider factory", factories.get(0) instanceof MyOne1ProviderFactory );
+		assertTrue("Expected an instance of MyOne1ProviderFactory as the second provider factory", factories.get(1) instanceof MyOne2ProviderFactory );
+		
+	}
+	
+	public void testProvider() {
+		MyProviderManager providerManager = MyProviderLocator.getManager();
+		List factories = ((ProviderManager_WithGetFactories)providerManager).getProviderFactories();
+		if( factories.size()!=2 ) {
+			
+		}
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/test/ProviderManagerTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyManager.java	(revision 1235)
@@ -0,0 +1,31 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider;
+
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+public interface MyManager extends ServiceManager, Manager{
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyTwoService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyTwoService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyTwoService.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider;
+
+import org.gvsig.tools.service.Service;
+
+public interface MyTwoService extends Service {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyTwoService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyOneService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyOneService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyOneService.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.service.AbstractService;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.spi.ProviderManager;
+import org.gvsig.tools.servicewithprovider.MyManager;
+import org.gvsig.tools.servicewithprovider.MyOneService;
+
+/*
+ * "MyOne" service that use providers.
+ */
+public class DefaultMyOneService extends AbstractService implements MyOneService {
+
+	private MyManager manager;
+	
+	public DefaultMyOneService(MyManager manager) {
+		this.manager = manager;
+	}
+	
+	public Manager getManager() {
+		return this.manager;
+	}
+
+	protected ProviderManager getProviderManager() {
+		return null;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyOneService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyLibrary.java	(revision 1235)
@@ -0,0 +1,47 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.servicewithprovider.MyLibrary;
+import org.gvsig.tools.servicewithprovider.MyLocator;
+import org.gvsig.tools.servicewithprovider.spi.MyProviderLocator;
+
+public class DefaultMyLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsImplementationOf(MyLibrary.class);
+    }
+    
+    protected void doInitialize() throws LibraryException {
+        MyLocator.registerManager(DefaultMyManager.class);
+        MyProviderLocator.registerManager(DefaultMyProviderManager.class);
+    }
+
+	protected void doPostInitialize() throws LibraryException {
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderManager.java	(revision 1235)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.spi.AbstractProviderManager;
+import org.gvsig.tools.service.spi.ProviderServices;
+import org.gvsig.tools.servicewithprovider.spi.MyProviderManager;
+
+public class DefaultMyProviderManager extends AbstractProviderManager implements MyProviderManager {
+
+	protected String getRegistryKey() {
+		return "My.providers";
+	}
+
+	protected String getRegistryDescription() {
+		return "My providers";
+	}
+
+	public ProviderServices createProviderServices(Service service) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyManager.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.AbstractServiceManager;
+import org.gvsig.tools.servicewithprovider.MyManager;
+
+public class DefaultMyManager extends AbstractServiceManager implements MyManager {
+
+	protected String getRegistryKey() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected String getRegistryDescription() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Service getService(DynObject parameters) throws ServiceException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyTwoService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyTwoService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyTwoService.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.service.AbstractService;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.spi.ProviderManager;
+
+public class DefaultMyTwoService extends AbstractService {
+
+	public Manager getManager() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected ProviderManager getProviderManager() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyTwoService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderServices.java	(revision 1235)
@@ -0,0 +1,31 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.impl;
+
+import org.gvsig.tools.service.spi.AbstractProviderServices;
+import org.gvsig.tools.servicewithprovider.spi.MyProviderServices;
+
+public class DefaultMyProviderServices extends AbstractProviderServices implements MyProviderServices {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/impl/DefaultMyProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1Provider.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1Provider.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1Provider.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.myone.myone1;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.AbstractProvider;
+import org.gvsig.tools.service.spi.ProviderServices;
+
+public class MyOne1Provider extends AbstractProvider {
+
+	private DynObject parameters = null;
+	
+	public MyOne1Provider(DynObject parameters, ProviderServices providerServices) {
+		super(providerServices);
+		this.parameters = parameters;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1Provider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderLibrary.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.myone.myone1;
+
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.servicewithprovider.MyLibrary;
+
+public class MyOne1ProviderLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsServiceOf(MyLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderFactory.java	(revision 1235)
@@ -0,0 +1,66 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.myone.myone1;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.service.spi.AbstractProviderFactory;
+import org.gvsig.tools.service.spi.Provider;
+import org.gvsig.tools.service.spi.ProviderServices;
+
+public class MyOne1ProviderFactory extends AbstractProviderFactory {
+
+	
+    public static final String PROVIDER_NAME = "MyOne1";
+    public static final String PROVIDER_DESCRIPTION = "This is the MyOne1 provider";
+
+    private DynClass parametersDefinition;
+
+    public void initialize() {
+        if (parametersDefinition == null) {
+            DynObjectManager dynObjectManager =ToolsLocator.getDynObjectManager();
+            parametersDefinition = dynObjectManager.createDynClass(PROVIDER_NAME,
+                    PROVIDER_DESCRIPTION);
+
+            parametersDefinition.addDynFieldString("param1").setMandatory(true);
+            parametersDefinition.addDynFieldString("param2").setMandatory(true);
+
+            dynObjectManager.add(parametersDefinition);
+        }
+    }
+
+    protected DynClass createParametersDynClass() {
+        if (parametersDefinition == null) {
+            initialize();
+        }
+        return parametersDefinition;
+    }
+
+    protected Provider doCreate(DynObject parameters, ProviderServices services) {
+        return new MyOne1Provider(parameters, services);
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone1/MyOne1ProviderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2Provider.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2Provider.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2Provider.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.myone.myone2;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.AbstractProvider;
+import org.gvsig.tools.service.spi.ProviderServices;
+
+public class MyOne2Provider extends AbstractProvider {
+
+	private DynObject parameters = null;
+	
+	public MyOne2Provider(DynObject parameters, ProviderServices providerServices) {
+		super(providerServices);
+		this.parameters = parameters;
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2Provider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2ProviderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2ProviderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2ProviderFactory.java	(revision 1235)
@@ -0,0 +1,66 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider.myone.myone2;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.service.spi.AbstractProviderFactory;
+import org.gvsig.tools.service.spi.Provider;
+import org.gvsig.tools.service.spi.ProviderServices;
+import org.gvsig.tools.servicewithprovider.myone.myone1.MyOne1Provider;
+
+public class MyOne2ProviderFactory extends AbstractProviderFactory {
+	
+    public static final String PROVIDER_NAME = "MyOne2";
+    public static final String PROVIDER_DESCRIPTION = "This is the MyOne2 provider";
+
+    private DynClass parametersDefinition;
+
+    public void initialize() {
+        if (parametersDefinition == null) {
+            DynObjectManager dynObjectManager =ToolsLocator.getDynObjectManager();
+            parametersDefinition = dynObjectManager.createDynClass(PROVIDER_NAME,
+                    PROVIDER_DESCRIPTION);
+
+            parametersDefinition.addDynFieldString("param1").setMandatory(true);
+            parametersDefinition.addDynFieldString("param2").setMandatory(true);
+
+            dynObjectManager.add(parametersDefinition);
+        }
+    }
+
+    protected DynClass createParametersDynClass() {
+        if (parametersDefinition == null) {
+            initialize();
+        }
+        return parametersDefinition;
+    }
+
+    protected Provider doCreate(DynObject parameters, ProviderServices services) {
+        return new MyOne2Provider(parameters, services);
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/myone/myone2/MyOne2ProviderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyOneService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyOneService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyOneService.java	(revision 1235)
@@ -0,0 +1,33 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider;
+
+import org.gvsig.tools.service.Service;
+
+/*
+ * "MyOne" service with providers
+ */
+public interface MyOneService extends Service {
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyOneService.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLocator.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.servicewithprovider;
+
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+public class MyLocator  extends BaseLocator {
+
+    /**
+     * My manager name.
+     */
+    public static final String MANAGER_NAME = "my.manager";
+
+    /**
+     * My manager description.
+     */
+    public static final String MANAGER_DESCRIPTION = "My Manager";
+
+    private static final String LOCATOR_NAME = "my.locator";
+
+    /**
+     * Unique instance.
+     */
+    private static final MyLocator INSTANCE = new MyLocator();
+
+    /**
+     * Return the singleton instance.
+     * 
+     * @return the singleton instance
+     */
+    public static MyLocator getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * Return the Locator's name.
+     * 
+     * @return a String with the Locator's name
+     */
+    public final String getLocatorName() {
+        return LOCATOR_NAME;
+    }
+
+    /**
+     * Return a reference to the MyManager.
+     * 
+     * @return a reference to the MyManager
+     * @throws LocatorException
+     *             if there is no access to the class or the class cannot be
+     *             instantiated
+     * @see Locator#get(String)
+     */
+    public static MyManager getManager() throws LocatorException {
+        return (MyManager) getInstance().get(MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the MyManager interface.
+     * 
+     * @param clazz
+     *            implementing the MyManager interface
+     */
+    public static void registerManager(Class clazz) {
+        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/servicewithprovider/MyLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/junit/AbstractLibraryAutoInitTestCase.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/junit/AbstractLibraryAutoInitTestCase.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/junit/AbstractLibraryAutoInitTestCase.java	(revision 1235)
@@ -0,0 +1,84 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.junit;
+
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class AbstractLibraryAutoInitTestCase extends TestCase {
+
+	/**
+	 * @see TestCase#TestCase() 
+	 */
+	public AbstractLibraryAutoInitTestCase() {
+		super();
+	}
+
+	/**
+	 * @see TestCase#TestCase(String) 
+	 */
+	public AbstractLibraryAutoInitTestCase(String name) {
+		super(name);
+	}
+	
+	protected final void setUp() throws Exception {
+		super.setUp();
+		
+		new DefaultLibrariesInitializer().fullInitialize();
+		
+		doSetUp();
+	}
+	
+	protected abstract void doSetUp() throws Exception;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/AllTests.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/AllTests.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/AllTests.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.gvsig.tools.dynobject.ImportDynClassTest;
+import org.gvsig.tools.persistence.BasicListTest;
+import org.gvsig.tools.persistence.BasicMapTest;
+import org.gvsig.tools.persistence.BasicSetTest;
+import org.gvsig.tools.persistence.BasicTypesArrayTest;
+import org.gvsig.tools.persistence.BasicTypesTest;
+import org.gvsig.tools.persistence.case1.Case1AllTests;
+
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Test for org.gvsig.tools.persistence");
+
+		// Persistence tests
+		suite.addTestSuite(BasicMapTest.class);
+		suite.addTestSuite(BasicTypesArrayTest.class);
+		suite.addTestSuite(BasicSetTest.class);
+		suite.addTestSuite(BasicListTest.class);
+		suite.addTestSuite(BasicTypesTest.class);
+		suite.addTest(Case1AllTests.suite());
+
+		// DynObject tests
+		suite.addTestSuite(ImportDynClassTest.class);
+		return suite;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/AllTests.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DefaultVersionTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DefaultVersionTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DefaultVersionTest.java	(revision 1235)
@@ -0,0 +1,15 @@
+package org.gvsig.tools.packageutils;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.packageutils.impl.DefaultVersion;
+
+public class DefaultVersionTest extends TestCase {
+
+	public void testFormat() {
+		DefaultVersion v = new DefaultVersion();
+		v.parse("1.2.3-SNAPSHOT-4");
+		String s = v.format("%M.%m.%r-%c-%b");
+		assertEquals("1.2.3-SNAPSHOT-4", s);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DefaultVersionTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/VersionTest_peta.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/VersionTest_peta.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/VersionTest_peta.java	(revision 1235)
@@ -0,0 +1,69 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.packageutils.impl.DefaultVersion;
+
+public class VersionTest_peta extends TestCase {
+
+	public void testParseVersion() {
+		Version v = new DefaultVersion();
+
+		v.parse("2.3.20-SNAPSHOT-10");
+		assertEquals("0002.0003.0020-SNAPSHOT-0010", v.fullFormat());
+
+		v.parse("2.3.20-SNAPSHOT");
+		assertEquals("0002.0003.0020-SNAPSHOT-0000", v.fullFormat());
+
+		v.parse("2.3.20-10");
+		assertEquals("0002.0003.0020-AAAA-0010", v.fullFormat());
+
+		v.parse("2.3.20");
+		assertEquals("0002.0003.0020-AAAA-0000", v.fullFormat());
+
+		v.parse("2.3");
+		assertEquals("0002.0003.0000-AAAA-0000", v.fullFormat());
+
+		v.parse("2");
+		assertEquals("0002.0000.0000-AAAA-0000", v.fullFormat());
+	}
+
+	public void testCompareVersion() {
+		Version v1 = new DefaultVersion();
+		Version v2 = new DefaultVersion();
+
+		v1.parse("2.3.20-SNAPSHOT-10");
+		v2.parse("2.3");
+		boolean b = v2.check("<", v1);
+		assert (b);
+
+	}
+
+	protected void doSetUp() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/VersionTest_peta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/PackageManagerTest_peta.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/PackageManagerTest_peta.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/PackageManagerTest_peta.java	(revision 1235)
@@ -0,0 +1,101 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.tools.packageutils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.packageutils.impl.DefaultPackageInfo;
+import org.gvsig.tools.packageutils.impl.DefaultPackageManager;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public class PackageManagerTest_peta extends TestCase {
+
+	PackageManager manager = null;
+
+	private PackageManager getManager() {
+		if (this.manager == null) {
+			this.manager = new DefaultPackageManager();
+		}
+		return this.manager;
+	}
+
+	protected void doSetUp() throws Exception {
+		// Do nothing
+
+	}
+
+	public void testReadPackage() throws IOException {
+		InputStream fis = getClass().getResourceAsStream("package1.info");
+
+		PackageInfo packageInfo = new DefaultPackageInfo();
+
+		getManager().readPacakgeInfo(packageInfo, fis);
+//		System.out.println(packageInfo.toString());
+
+		assertEquals(packageInfo.getCode(), "org.gvsig.myplugin");
+		assertEquals(packageInfo.getName(), "myplugin");
+		assertEquals(packageInfo.getDescription(), "Test");
+		assertEquals(packageInfo.getVersion().toString(), "1.0.0-0");
+		assertEquals(packageInfo.getState(), "RC1");
+		assertEquals(packageInfo.isOfficial(), true);
+	}
+
+	public void testWritePackage() throws IOException {
+		PackageInfo packageInfo1 = new DefaultPackageInfo();
+		PackageInfo packageInfo2 = new DefaultPackageInfo();
+
+		packageInfo1.setCode("org.gvsig.myplugin");
+		packageInfo1.setName("My name");
+		packageInfo1.setDescription("My description");
+		packageInfo1.getVersion().parse("1.0.0");
+		packageInfo1.setState("final");
+		packageInfo1.setOfficial(false);
+		packageInfo1.setType("plugin");
+
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+		getManager().writePacakgeInfo(packageInfo1, out);
+		getManager().readPacakgeInfo(packageInfo2, new ByteArrayInputStream(out.toByteArray()));
+
+		assertEquals("org.gvsig.myplugin", packageInfo2.getCode());
+		assertEquals("My name", packageInfo2.getName());
+		assertEquals("My description", packageInfo2.getDescription());
+		assertEquals("1.0.0-0", packageInfo2.getVersion().toString());
+		assertEquals("final", packageInfo2.getState());
+		assertEquals(false, packageInfo2.isOfficial());
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/PackageManagerTest_peta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DependencyTest_peta.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DependencyTest_peta.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DependencyTest_peta.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.packageutils.impl.DefaultDependency;
+
+public class DependencyTest_peta extends TestCase {
+
+	public void testParse() {
+		Dependency dep = new DefaultDependency();
+
+		dep.parse("required: org.gvsig.app >= 2.0.0-SNAPSHOT-2030");
+		String s = dep.toString();
+		assertEquals("required: org.gvsig.app >= 2.0.0-SNAPSHOT-2030", s);
+	}
+
+	protected void doSetUp() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/packageutils/DependencyTest_peta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTimeTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTimeTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTimeTest.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDate;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDateTime;
+
+/**
+ * Unit tests for the {@link CoerceToDate} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToDateTimeTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToDateTime coerce = new CoerceToDateTime();
+
+        Calendar calendar = Calendar.getInstance();
+        // Remember the month value is in format 0 to 11, instead of 1 to 12,
+        // so september is the 8th month
+        calendar.set(2011, 8, 5, 10, 5, 30);
+        Date date = calendar.getTime();
+
+        assertCoercion(coerce, date, date);
+        DateFormat format =
+            DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
+        assertCoercion(coerce, format.format(date), date);
+    }
+
+    private void assertCoercion(Coercion coerce, Object value, Date expected)
+        throws CoercionException {
+        Object result = coerce.coerce(value);
+        assertEquals(Date.class, result.getClass());
+        Date resultDate = (Date) result;
+        assertEquals(expected.getYear(), resultDate.getYear());
+        assertEquals(expected.getMonth(), resultDate.getMonth());
+        assertEquals(expected.getDay(), resultDate.getDay());
+        assertEquals(expected.getHours(), resultDate.getHours());
+        assertEquals(expected.getMinutes(), resultDate.getMinutes());
+        assertEquals(expected.getSeconds(), resultDate.getSeconds());
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDateTest.java	(revision 1235)
@@ -0,0 +1,65 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDate;
+
+/**
+ * Unit tests for the {@link CoerceToDate} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToDateTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToDate coerce = new CoerceToDate();
+
+        Calendar calendar = Calendar.getInstance();
+        // Remember the month value is in format 0 to 11, instead of 1 to 12,
+        // so september is the 8th month
+        calendar.set(2011, 8, 5);
+        Date date = calendar.getTime();
+
+        assertCoercion(coerce, date, date);
+        DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT);
+        assertCoercion(coerce, format.format(date), date);
+    }
+
+    private void assertCoercion(CoerceToDate coerce, Object value, Date expected)
+        throws CoercionException {
+        Object result = coerce.coerce(value);
+        assertEquals(Date.class, result.getClass());
+        Date resultDate = (Date) result;
+        assertEquals(expected.getYear(), resultDate.getYear());
+        assertEquals(expected.getMonth(), resultDate.getMonth());
+        assertEquals(expected.getDay(), resultDate.getDay());
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToTimeTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToTimeTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToTimeTest.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDate;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToTime;
+
+/**
+ * Unit tests for the {@link CoerceToDate} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToTimeTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToTime coerce = new CoerceToTime();
+
+        Calendar calendar = Calendar.getInstance();
+        // Remember the month value is in format 0 to 11, instead of 1 to 12,
+        // so september is the 8th month
+        calendar.set(2011, 8, 5, 10, 5, 30);
+        Date date = calendar.getTime();
+
+        assertCoercion(coerce, date, date);
+        DateFormat format = DateFormat.getTimeInstance(DateFormat.MEDIUM);
+        assertCoercion(coerce, format.format(date), date);
+    }
+
+    private void assertCoercion(Coercion coerce, Object value, Date expected)
+        throws CoercionException {
+        Object result = coerce.coerce(value);
+        assertEquals(Date.class, result.getClass());
+        Date resultDate = (Date) result;
+        assertEquals(expected.getHours(), resultDate.getHours());
+        assertEquals(expected.getMinutes(), resultDate.getMinutes());
+        assertEquals(expected.getSeconds(), resultDate.getSeconds());
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToBooleanTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToBooleanTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToBooleanTest.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToBoolean;
+
+/**
+ * Unit tests for the {@link CoerceToBoolean} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToBooleanTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToBoolean coerce = new CoerceToBoolean();
+
+        assertCoercion(coerce, Boolean.TRUE, Boolean.TRUE);
+        assertCoercion(coerce, Boolean.FALSE, Boolean.FALSE);
+        assertCoercion(coerce, "true", Boolean.TRUE);
+        assertCoercion(coerce, "false", Boolean.FALSE);
+        assertCoercion(coerce, new Integer(1), Boolean.TRUE);
+        assertCoercion(coerce, new Integer(0), Boolean.FALSE);
+        assertCoercion(coerce, new Float(1.0f), Boolean.TRUE);
+        assertCoercion(coerce, new Float(0.0f), Boolean.FALSE);
+    }
+
+    private void assertCoercion(CoerceToBoolean coerce, Object value,
+        Boolean expected) throws CoercionException {
+        assertCoercion(coerce, value, Boolean.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFileTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFileTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFileTest.java	(revision 1235)
@@ -0,0 +1,62 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.io.File;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToFile;
+
+/**
+ * Unit tests for the {@link CoerceToFile} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToFileTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToFile coerce = new CoerceToFile();
+
+        // Test with absolute path
+        testFileCoercion(coerce, "/tmp/test.txt");
+
+        // Test with relative path
+        testFileCoercion(coerce, "test.txt");
+    }
+
+    private void testFileCoercion(CoerceToFile coerce, String path)
+        throws CoercionException {
+        File file = new File(path);
+        assertCoercion(coerce, file, file);
+        assertCoercion(coerce, file.getPath(), file);
+        assertCoercion(coerce, file.toURI(), file.getAbsoluteFile());
+    }
+
+    private void assertCoercion(CoerceToFile coerce, Object value, File expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, File.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToLongTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToLongTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToLongTest.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToLong;
+
+/**
+ * Unit tests for the {@link CoerceToLong} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToLongTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToLong coerce = new CoerceToLong();
+
+        Long long12 = new Long(12);
+
+        assertCoercion(coerce, new Integer(12), long12);
+        assertCoercion(coerce, new Long(12l), long12);
+        assertCoercion(coerce, new Float(12.0f), long12);
+        assertCoercion(coerce, new Double(12.0d), long12);
+        assertCoercion(coerce, "12", long12);
+        assertCoercion(coerce, "0x000C", long12);
+    }
+
+    private void assertCoercion(CoerceToLong coerce, Object value, Long expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, Long.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURITest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURITest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURITest.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.net.URI;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToURI;
+
+/**
+ * Unit tests for the {@link CoerceToURI} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToURITest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToURI coerce = new CoerceToURI();
+
+        URI uri = new URI("http://www.gvsig.org");
+
+        assertCoercion(coerce, uri, uri);
+        assertCoercion(coerce, uri.toString(), uri);
+    }
+
+    private void assertCoercion(CoerceToURI coerce, Object value, URI expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, URI.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoercionTestAbstract.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoercionTestAbstract.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoercionTestAbstract.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+/**
+ * Parent abstract class for Unit tests of the {@link Coercion} implementations.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoercionTestAbstract extends TestCase {
+
+    /**
+     * Asserts the result of a coercion
+     * 
+     * @param coercion
+     *            to apply
+     * @param value
+     *            to coerce
+     * @param expectedClass
+     *            class that must have the result of the coercion
+     * @param expectedResult
+     *            value that must have the result of the coercion
+     * @throws CoercionException
+     *             if there is an error while performing the coercion
+     */
+    protected void assertCoercion(Coercion coercion, Object value,
+        Class expectedClass, Object expectedResult)
+        throws CoercionException {
+        Object result = coercion.coerce(value);
+        assertEquals(expectedClass, result.getClass());
+        assertEquals(expectedResult, result);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURLTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURLTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToURLTest.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import java.net.URL;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToURL;
+
+/**
+ * Unit tests for the {@link CoerceToURL} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToURLTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToURL coerce = new CoerceToURL();
+
+        URL url = new URL("http://www.gvsig.org");
+
+        assertCoercion(coerce, url, url);
+        assertCoercion(coerce, url.toString(), url);
+    }
+
+    private void assertCoercion(CoerceToURL coerce, Object value, URL expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, URL.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToByteTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToByteTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToByteTest.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToByte;
+
+/**
+ * Unit tests for the {@link CoerceToByte} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToByteTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToByte coerce = new CoerceToByte();
+
+        Byte byte12 = new Byte((byte) 12);
+
+        assertCoercion(coerce, new Byte((byte) 12), byte12);
+        assertCoercion(coerce, new Integer(12), byte12);
+        assertCoercion(coerce, new Long(12l), byte12);
+        assertCoercion(coerce, new Float(12.0f), byte12);
+        assertCoercion(coerce, new Double(12.0d), byte12);
+        assertCoercion(coerce, "12", byte12);
+        assertCoercion(coerce, "0xC", byte12);
+    }
+
+    private void assertCoercion(CoerceToByte coerce, Object value, Byte expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, Byte.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFloatTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFloatTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToFloatTest.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToFloat;
+
+/**
+ * Unit tests for the {@link CoerceToFloat} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToFloatTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToFloat coerce = new CoerceToFloat();
+
+        Float float12 = new Float(12.0f);
+
+        assertCoercion(coerce, new Integer(12), float12);
+        assertCoercion(coerce, new Long(12l), float12);
+        assertCoercion(coerce, new Float(12.0f), float12);
+        assertCoercion(coerce, new Double(12.0d), float12);
+        assertCoercion(coerce, "12", float12);
+        assertCoercion(coerce, "12.0", float12);
+        assertCoercion(coerce, "0x000C", float12);
+    }
+
+    private void assertCoercion(CoerceToFloat coerce, Object value,
+        Float expected) throws CoercionException {
+        assertCoercion(coerce, value, Float.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToStringTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToStringTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToStringTest.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToString;
+
+/**
+ * Unit tests for the {@link CoerceToString} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToStringTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToString coerce = new CoerceToString();
+
+        String string = "123";
+
+        assertCoercion(coerce, string, string);
+        assertCoercion(coerce, new StringBuffer(string), string);
+        assertCoercion(coerce, Integer.valueOf(string), string);
+    }
+
+    private void assertCoercion(CoerceToString coerce, Object value,
+        String expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, String.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDoubleTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDoubleTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToDoubleTest.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDouble;
+
+/**
+ * Unit tests for the {@link CoerceToDouble} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToDoubleTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToDouble coerce = new CoerceToDouble();
+
+        Double double12 = new Double(12.0f);
+
+        assertCoercion(coerce, new Integer(12), double12);
+        assertCoercion(coerce, new Long(12l), double12);
+        assertCoercion(coerce, new Float(12.0f), double12);
+        assertCoercion(coerce, new Double(12.0d), double12);
+        assertCoercion(coerce, "12", double12);
+        assertCoercion(coerce, "12.0", double12);
+        assertCoercion(coerce, "0x000C", double12);
+    }
+
+    private void assertCoercion(CoerceToDouble coerce, Object value,
+        Double expected) throws CoercionException {
+        assertCoercion(coerce, value, Double.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.datatypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToInt;
+
+/**
+ * Unit tests for the {@link CoerceToInt} class.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToIntTest extends CoercionTestAbstract {
+
+    public void testCoerce() throws Exception {
+        CoerceToInt coerce = new CoerceToInt();
+
+        Integer integer12 = new Integer(12);
+
+        assertCoercion(coerce, new Integer(12), integer12);
+        assertCoercion(coerce, new Long(12l), integer12);
+        assertCoercion(coerce, new Float(12.0f), integer12);
+        assertCoercion(coerce, new Double(12.0d), integer12);
+        assertCoercion(coerce, "12", integer12);
+        assertCoercion(coerce, "0x0C", integer12);
+    }
+
+    private void assertCoercion(CoerceToInt coerce, Object value,
+        Integer expected)
+        throws CoercionException {
+        assertCoercion(coerce, value, Integer.class, expected);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseRuntimeExceptionTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseRuntimeExceptionTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseRuntimeExceptionTest.java	(revision 1235)
@@ -0,0 +1,97 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.Map;
+
+public class BaseRuntimeExceptionTest extends BaseExceptionTest {
+
+    public void testRuntimeExceptionNature() {
+        Object test = new Object() {
+
+            public String toString() {
+                throw new BaseRuntimeException("ERROR", "ERROR", 1) {
+					private static final long serialVersionUID = 8770868293941582598L;
+
+					protected Map values() {
+                        return null;
+                    }
+                };
+            }
+
+        };
+
+        try {
+            test.toString();
+            fail("RuntimeException not generated");
+        } catch (RuntimeException rex) {
+            // success
+        }
+    }
+
+    public void testRuntimeExceptionNature2() {
+		Object test = new Object() {
+
+			public String toString() {
+				throw new BaseRuntimeException("ERROR", "ERROR", 1) {
+					private static final long serialVersionUID = 5320635962420929034L;
+				};
+			}
+
+		};
+
+		try {
+			test.toString();
+			fail("RuntimeException not generated");
+		} catch (RuntimeException rex) {
+			// success
+			rex.toString();
+		}
+	}
+
+    protected IBaseException createBadDateException(String driver,
+            Throwable throwable) {
+        return new BadDateException(driver, throwable);
+    }
+
+    protected IBaseException createDriverException(String driver,
+            Throwable throwable) {
+        return new DriverRuntimeException(driver, throwable);
+    }
+
+    class BadDateException extends DriverRuntimeException {
+        private static final long serialVersionUID = -8985920349210629998L;
+        private static final String KEY = "Driver_%(driverName)s_Formato_de_fecha_incorrecto";
+
+        private static final String MESSAGE = "Driver %(driverName)s: Formato de fecha incorrecto";
+
+        public BadDateException(String driverName, Throwable cause) {
+            super(driverName, MESSAGE, cause, KEY, serialVersionUID);
+        }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverRuntimeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverRuntimeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverRuntimeException.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DriverRuntimeException extends BaseRuntimeException {
+	
+	private static final long serialVersionUID = -8985920349210629999L;
+	
+    private static final String KEY = "Error_in_the_driver_%(driverName)s";
+
+    private static final String MESSAGE = "Error in the driver %(driverName)s";
+	
+	private String driverName;
+	
+	public DriverRuntimeException(String driverName) {
+		super(MESSAGE, KEY, serialVersionUID);
+		this.driverName = driverName;
+	}
+	
+	public DriverRuntimeException(String driverName, Throwable cause) {
+        super(MESSAGE, cause, KEY, serialVersionUID);
+		this.driverName = driverName;
+	}
+    
+    public DriverRuntimeException(String driverName, String message, Throwable cause,
+            String key, long code) {
+        super(message, cause, key, code);
+        this.driverName = driverName;
+    }
+
+	public String getDriverName() {
+		return driverName;
+	}
+	
+	protected Map values() {
+		HashMap values = new HashMap();
+		values.put("driverName",this.driverName);
+		return values;
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/ListBaseExceptionTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/ListBaseExceptionTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/ListBaseExceptionTest.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import junit.framework.TestCase;
+
+public class ListBaseExceptionTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	public void testSimple(){
+
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseExceptionTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseExceptionTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/BaseExceptionTest.java	(revision 1235)
@@ -0,0 +1,160 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import junit.framework.TestCase;
+
+public class BaseExceptionTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+	
+	public void testSimple(){
+		try {
+			throw new NullPointerException("Excepcion de puntero nulo");
+		} catch (NullPointerException e){
+		    IBaseException de = createDriverException("SimpleDriver", e);
+			assertEquals("Error in the driver SimpleDrivers", de.getMessage());
+			assertEquals(
+                    "Error in the driver SimpleDrivers\nExcepcion de puntero nulo",
+                    de.getMessageStack());
+		}
+	}
+
+	public void testSimpleLocalized(){
+		class MyTranslator implements ExceptionTranslator {
+			public String getText(String clave) {
+				return clave.toUpperCase();
+			}
+		}
+		BaseException.setTranslator(new MyTranslator());
+		try {
+			throw new NullPointerException("Excepcion de puntero nulo");
+		} catch (NullPointerException e){
+            IBaseException de = createDriverException("SimpleDriver", e);
+			assertEquals("ERROR_IN_THE_DRIVER_%(DRIVERNAME)S",de.getLocalizedMessage());
+			assertTrue(de
+					.getLocalizedMessageStack()
+					.startsWith(
+							"ERROR_IN_THE_DRIVER_%(DRIVERNAME)S\nExcepcion de puntero nulo"));
+		}
+		BaseException.setTranslator(null);
+	}
+
+	public void testSimple2(){
+		try {
+			throw new NullPointerException("Excepcion de puntero nulo");
+		} catch (NullPointerException e){
+            IBaseException de = createBadDateException("SimpleDriver", e);
+			assertEquals("Driver SimpleDrivers: Formato de fecha incorrecto",
+                    de.getMessage());
+			assertEquals(
+                    "Driver SimpleDrivers: Formato de fecha incorrecto\nExcepcion de puntero nulo",
+                    de.getMessageStack());
+		}
+	}
+
+	public void testSimpleLocalized2(){
+		class MyTranslator implements ExceptionTranslator {
+			public String getText(String clave) {
+				return clave.toUpperCase();
+			}
+		}
+		BaseException.setTranslator(new MyTranslator());
+		try {
+			throw new NullPointerException("Excepcion de puntero nulo");
+		} catch (NullPointerException e){
+            IBaseException de = createBadDateException("SimpleDriver", e);
+			assertEquals("DRIVER_%(DRIVERNAME)S_FORMATO_DE_FECHA_INCORRECTO",de.getLocalizedMessage());
+			assertTrue(de
+					.getLocalizedMessageStack()
+					.startsWith(
+							"DRIVER_%(DRIVERNAME)S_FORMATO_DE_FECHA_INCORRECTO\nExcepcion de puntero nulo"));
+		}
+		BaseException.setTranslator(null);
+	}
+
+	public void testTranslatorWithoutInterface() {
+		class MyTranslator implements ExceptionTranslator {
+			public String getText(String clave) {
+				return clave.toUpperCase();
+			}
+		}
+		BaseException.setTranslator(new MyTranslator());
+		try {
+			throw new NullPointerException("Excepcion de puntero nulo");
+		} catch (NullPointerException e){
+            IBaseException de = createBadDateException("SimpleDriver", e);
+			assertEquals("DRIVER_%(DRIVERNAME)S_FORMATO_DE_FECHA_INCORRECTO",de.getLocalizedMessage());
+			assertTrue(de
+					.getLocalizedMessageStack()
+					.startsWith(
+							"DRIVER_%(DRIVERNAME)S_FORMATO_DE_FECHA_INCORRECTO\nExcepcion de puntero nulo"));
+		}
+		BaseException.setTranslator(null);
+		
+	}
+	
+    public void testInsertBlanksAtStart() {
+        String src = "test";
+
+        assertEquals("test", BaseException.insertBlanksAtStart(src, 0));
+
+        assertEquals("test", BaseException.insertBlanksAtStart(src, -5));
+
+        assertEquals("  test", BaseException.insertBlanksAtStart(src, 2));
+
+        assertEquals("      test", BaseException.insertBlanksAtStart(src, 6));
+    }
+    
+    protected IBaseException createDriverException(String driver,
+            Throwable throwable) {
+        return new DriverException(driver, throwable);
+    }
+    
+    protected IBaseException createBadDateException(String driver,
+            Throwable throwable) {
+        return new BadDateException(driver, throwable);
+    }
+
+	class BadDateException extends DriverException {
+		private static final long serialVersionUID = -8985920349210629998L;
+	    private static final String KEY = "Driver_%(driverName)s_Formato_de_fecha_incorrecto";
+
+	    private static final String MESSAGE = "Driver %(driverName)s: Formato de fecha incorrecto";
+
+		public BadDateException(String driverName, Throwable cause) {
+            super(driverName, MESSAGE, cause, KEY, serialVersionUID);
+		}
+	}
+	
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/DriverException.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DriverException extends BaseException {
+	
+	private static final long serialVersionUID = -8985920349210629999L;
+	
+    private static final String KEY = "Error_in_the_driver_%(driverName)s";
+
+    private static final String MESSAGE = "Error in the driver %(driverName)s";
+	
+	private String driverName;
+	
+	public DriverException(String driverName) {
+		super(MESSAGE, KEY, serialVersionUID);
+		this.driverName = driverName;
+	}
+	
+	public DriverException(String driverName, Throwable cause) {
+        super(MESSAGE, cause, KEY, serialVersionUID);
+		this.driverName = driverName;
+	}
+    
+    public DriverException(String driverName, String message, Throwable cause,
+            String key, long code) {
+        super(message, cause, key, code);
+        this.driverName = driverName;
+    }
+
+	public String getDriverName() {
+		return driverName;
+	}
+	
+	protected Map values() {
+		HashMap values = new HashMap();
+		values.put("driverName",this.driverName);
+		return values;
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/AllTests.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/AllTests.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/exception/AllTests.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Test for org.gvsig.tools.exceptions");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(ListBaseExceptionTest.class);
+		suite.addTestSuite(BaseExceptionTest.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractVisitableTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractVisitableTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractVisitableTest.java	(revision 1235)
@@ -0,0 +1,132 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.visitor.impl;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Unit tests for the class {@link AbstractVisitable}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class AbstractVisitableTest extends TestCase {
+
+	private static final int COUNT = 10;
+
+	private AbstractVisitable visitable;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		visitable = new TestVisitable();
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.tools.visitor.impl.AbstractVisitable#accept(org.gvsig.tools.visitor.Visitor)}.
+	 */
+	public void testAccept() throws Exception {
+		// Check the visitable visits all elements
+		CountVisitor count = new CountVisitor();
+		visitable.accept(count);
+		assertEquals(COUNT, count.getCount());
+
+		// Check the visitable takes into account the VisitCancelException
+		final int limit = 3;
+		CountLimitVisitor limitCount = new CountLimitVisitor(limit);
+		visitable.accept(limitCount);
+		assertEquals(limit, limitCount.getCount());
+	}
+
+	private class TestVisitable extends AbstractVisitable {
+		protected void doAccept(Visitor visitor) throws VisitCanceledException,
+				BaseException {
+			for (int i = 0; i < COUNT; i++) {
+				visitor.visit("test");
+			}
+		}
+
+	}
+
+	public class CountVisitor implements Visitor {
+		private int count = 0;
+
+		public void visit(Object obj) throws VisitCanceledException,
+				BaseException {
+			count++;
+		}
+
+		public int getCount() {
+			return count;
+		}
+	}
+
+	public class CountLimitVisitor extends CountVisitor {
+		private final int limit;
+
+		public CountLimitVisitor(int limit) {
+			this.limit = limit;
+		}
+
+		public void visit(Object obj) throws VisitCanceledException,
+				BaseException {
+			super.visit(obj);
+			if (getCount() == getLimit()) {
+				throw new VisitCanceledException();
+			}
+		}
+
+		public int getLimit() {
+			return limit;
+		}
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitableTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitableTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitableTest.java	(revision 1235)
@@ -0,0 +1,101 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.visitor.impl;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Unit tests for the class {@link AbstractIndexedVisitable}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class AbstractIndexedVisitableTest extends AbstractVisitableTest {
+
+	private static final int COUNT = 10;
+
+	private AbstractIndexedVisitable visitable;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		visitable = new TestIndexedVisitable();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.visitor.impl.AbstractIndexedVisitable#accept(Visitor, long)
+	 * .
+	 */
+	public void testAccept() throws Exception {
+		final int index = 2;
+		final int limit = 3;
+		// Check the visitable visits all elements
+		CountVisitor count = new CountVisitor();
+		visitable.accept(count, index);
+		assertEquals(COUNT - index, count.getCount());
+
+		// Check the visitable takes into account the VisitCancelException
+		CountLimitVisitor limitCount = new CountLimitVisitor(limit);
+		visitable.accept(limitCount, index);
+		assertEquals(limit, limitCount.getCount());
+	}
+
+	public class TestIndexedVisitable extends AbstractIndexedVisitable {
+		protected void doAccept(Visitor visitor, long index)
+				throws VisitCanceledException,
+				BaseException {
+			for (int i = (int) index; i < COUNT; i++) {
+				visitor.visit("test");
+			}
+		}
+
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectSetTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectSetTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectSetTest.java	(revision 1235)
@@ -0,0 +1,184 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dynobject;
+
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Tests for the {@link DynObjectSet} interface.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class DynObjectSetTest extends AbstractLibraryAutoInitTestCase {
+
+	protected void doSetUp() throws Exception {
+		// Nothing to do
+	}
+
+	public void testIterator() throws Exception {
+		DynObjectSet dynObjectSet = createDynObjectSet();
+		testIterator(dynObjectSet);
+		dynObjectSet.dispose();
+	}
+
+	private void testIterator(DynObjectSet dynObjectSet) throws Exception {
+		try {
+			DisposableIterator iter = dynObjectSet.iterator(-5);
+			iter.dispose();
+			fail("Iterator index accepted with a value < 0");
+		} catch (Exception ex) {
+			// Good
+		}
+
+		try {
+			DisposableIterator iter = dynObjectSet.iterator(dynObjectSet
+					.getSize() + 2);
+			iter.dispose();
+			fail("Iterator index accepted with a value > collection size");
+		} catch (Exception ex) {
+			// Good
+		}
+
+		long index = dynObjectSet.getSize() - 3l;
+		DisposableIterator iter = dynObjectSet.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 = dynObjectSet.iterator(0);
+		iterations = 0;
+		while (iter.hasNext()) {
+			iter.next();
+			iterations++;
+		}
+		assertEquals("The number of iterations is not the "
+				+ "total size of the collection", dynObjectSet.getSize(),
+				iterations);
+		iter.dispose();
+	}
+
+	public void testVisitable() throws Exception {
+		DynObjectSet dynObjectSet = createDynObjectSet();
+		testVisitable(dynObjectSet);
+		dynObjectSet.dispose();
+	}
+
+	private void testVisitable(DynObjectSet dynObjectSet) throws Exception {
+		long size = dynObjectSet.getSize();
+
+		TestCountVisitor visitor = new TestCountVisitor();
+		dynObjectSet.accept(visitor);
+		
+		assertEquals("The number of iterations performed is not correct", size,
+				visitor.getCount());
+
+		visitor = new TestCountVisitor();
+		dynObjectSet.accept(visitor, 2);
+		
+		assertEquals("The number of iterations performed is not correct",
+				size - 3, visitor.getCount());
+	}
+
+	public void testSize() throws Exception {
+		DynObjectSet dynObjectSet = createDynObjectSet();
+		testSize(dynObjectSet);
+		dynObjectSet.dispose();
+	}
+
+	private void testSize(DynObjectSet dynObjectSet) throws Exception {
+		long size = dynObjectSet.getSize();
+		
+		assertTrue("Set size cannot be less than zero", (size >= 0l));
+
+		if (size == 0) {
+			assertTrue(
+					"An empty set does not return true in the isEmpty method",
+					dynObjectSet.isEmpty());
+		} else {
+			assertFalse(
+					"An non empty set does return true in the isEmpty method",
+					dynObjectSet.isEmpty());
+		}
+	}
+
+	private class TestCountVisitor implements Visitor {
+		private long count = 0;
+
+		public void visit(Object obj) throws VisitCanceledException,
+				BaseException {
+			count++;
+		}
+		
+		/**
+		 * @return the count
+		 */
+		public long getCount() {
+			return count;
+		}
+	}
+
+	/**
+	 * Creates a {@link DynObjectSet} with at least 4 elements.
+	 * 
+	 * @return the {@link DynObjectSet}
+	 * @throws Exception
+	 *             if there is an error creating the {@link DynObjectSet}
+	 */
+	protected abstract DynObjectSet createDynObjectSet() throws Exception;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynFieldTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynFieldTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynFieldTest.java	(revision 1235)
@@ -0,0 +1,76 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dynobject.impl;
+
+import junit.framework.TestCase;
+import org.gvsig.tools.dataTypes.DataTypes;
+
+/**
+ * Unit tests for the class {@link DefaultDynField}.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultDynFieldTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    public void testEquals() {
+        DefaultDynField field1 = new DefaultDynField("field1", DataTypes.STRING);
+        DefaultDynField field2 = new DefaultDynField("field2", DataTypes.STRING);
+        DefaultDynField field1b = new DefaultDynField("field1", DataTypes.STRING);
+
+        assertTrue(field1.equals(field1b));
+        assertFalse(field1.equals(field2));
+        assertFalse(field1.equals(null));
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynClassTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynClassTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynClassTest.java	(revision 1235)
@@ -0,0 +1,460 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.easymock.MockControl;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+
+/**
+ * Unit tests for the class {@link DefaultDynClass}.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultDynClassTest extends AbstractLibraryAutoInitTestCase {
+
+	private MockControl managerControl;
+	private DynObjectManager manager;
+	private DefaultDynClass dynClass;
+
+	protected void doSetUp() throws Exception {
+		managerControl = MockControl.createNiceControl(DynObjectManager.class);
+		manager = (DynObjectManager) managerControl.getMock();
+		dynClass = new DefaultDynClass(manager, new DefaultDynClassName(
+				"dynclass"), "description");
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#newInstance()}.
+	 */
+	// public void testNewInstance() {
+	// TODO: solve
+	// MockControl dynObjControl = MockControl
+	// .createNiceControl(DynObject.class);
+	// DynObject dynObj = (DynObject) dynObjControl.getMock();
+	// dynObjControl.expectAndReturn(dynObj.getDynClass(), dynClass);
+	// dynObjControl.replay();
+	//
+	// managerControl.expectAndReturn(manager.createDynObject(dynClass),
+	// dynObj);
+	// managerControl.replay();
+	//
+	// DynObject newDynObj = dynClass.newInstance();
+	// assertTrue(dynClass.isInstance(newDynObj));
+	// }
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#extend(org.gvsig.tools.dynobject.DynClass)}
+	 * .
+	 */
+	public void testExtendDynClass() {
+		final String parent = "parent";
+
+		DefaultDynClassName name = new DefaultDynClassName(parent);
+
+		DefaultDynClass parentDynClass = new DefaultDynClass(manager, name,
+				"parent description");
+
+		managerControl.expectAndReturn(manager.has(parent), true);
+		managerControl.expectAndReturn(manager.get(parent), parentDynClass);
+		managerControl.replay();
+
+		dynClass.extend(parentDynClass);
+
+		DynClass[] parents = dynClass.getSuperDynClasses();
+		assertEquals(parentDynClass, parents[0]);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#extend(java.lang.String)}
+	 * .
+	 */
+	public void testExtendString() {
+		final String parent = "parent";
+
+		DefaultDynClassName name = new DefaultDynClassName(parent);
+
+		DefaultDynClass parentDynClass = new DefaultDynClass(manager, name,
+				"parent description");
+
+		managerControl.expectAndReturn(manager.has(parent), true);
+		managerControl.expectAndReturn(manager.get(parent), parentDynClass);
+		managerControl.replay();
+
+		dynClass.extend(parent);
+
+		DynClass[] parents = dynClass.getSuperDynClasses();
+		assertEquals(parentDynClass, parents[0]);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#getDynField(java.lang.String)}
+	 * ,
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#addDynField(java.lang.String)}
+	 * ,
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#removeDynField(java.lang.String)}
+	 * ,
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#getDeclaredDynFields()}
+	 * .
+	 */
+	public void testDynFields() {
+		final String field1 = "field1";
+		final String field2 = "field2";
+
+		DynField dynField1 = dynClass.addDynField(field1);
+		assertEquals(dynField1, dynClass.getDynField(field1));
+
+		DynField dynField2 = dynClass.addDynField(field2);
+		assertEquals(dynField2, dynClass.getDynField(field2));
+
+		DynField[] fields = dynClass.getDeclaredDynFields();
+		assertEquals(2, fields.length);
+
+		dynClass.removeDynField(field1);
+		assertNull(dynClass.getDynField(field1));
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynClass#equals(Object)}.
+	 */
+	public void testEquals() {
+		DefaultDynClass dynClass2 = new DefaultDynClass(manager,
+				new DefaultDynClassName("dynclass2"), "description2");
+		DefaultDynClass dynClassB = new DefaultDynClass(manager,
+				new DefaultDynClassName("dynclass"), "description");
+
+		assertTrue(dynClass.equals(dynClassB));
+		assertFalse(dynClass.equals(dynClass2));
+		assertFalse(dynClass.equals(null));
+	}
+
+	/**
+	 * Validation test: DynObjects as dynfields within a dynObject.
+	 * 
+	 * Metadata A will have metadata B as porperty. for each dynField, a
+	 * validate function will be triggered with the current
+	 * 
+	 * @throws Exception
+	 * 
+	 */
+	public void testValidate() throws Exception {
+
+		/**
+		 * Creating and registering both dynClasses
+		 */
+		DynObjectManager dynManager = ToolsLocator.getDynObjectManager();
+
+		DynClass dynClassA = new DefaultDynClass(manager,
+				new DefaultDynClassName("metadata", "DynclassA"),
+				"descriptionA");
+		dynManager.add(dynClassA);
+
+		DynClass dynClassB = new DefaultDynClass(manager,
+				new DefaultDynClassName("metadata", "DynclassB"),
+				"descriptionB");
+		dynManager.add(dynClassB);
+
+		/**
+		 * Filling dynClass B with "Name" and "Street"
+		 */
+		dynClassB.addDynFieldString("name");
+		dynClassB.addDynFieldString("street");
+
+		/**
+		 * Filling dynClass A with "Name" and the dynClass B named "dynObjB"
+		 */
+		dynClassA.addDynFieldString("name");
+		dynClassA.addDynField("dynObjB").setType(DataTypes.DYNOBJECT)
+				.setSubtype(dynClassB.getFullName());
+
+		/**
+		 * Creating dynObjects for current dynClasses and applying dynObject B
+		 * as a property of A
+		 */
+		DynObject dynObjA = new DefaultDynObject(dynClassA);
+		DynObject dynObjB = new DefaultDynObject(dynClassB);
+
+		// TODO: Note that even specified a subType, if we set a different
+		// dynObject, it will not check if the subType is correct.
+		dynObjA.setDynValue("dynObjB", dynObjB);
+
+		/**
+		 * Once the structure has been created, we will validate each field of
+		 * dynObject A, which also contains B as a property.
+		 */
+		DynField[] fields = dynObjA.getDynClass().getDynFields();
+		DynField field;
+		Object value;
+		for (int i = 0; i < fields.length; ++i) {
+			field = fields[i];
+			value = dynObjA.getDynValue(field.getName());
+
+			// Checking that it actually contains the DynObject B as a
+			// property
+			if (field.getType() == DataTypes.DYNOBJECT) {
+				assertTrue(dynClassB.equals(((DynObject) value).getDynClass()));
+			}
+
+			// Performing validation
+			field.validate(value);
+		}
+	}
+
+	/**
+	 * 
+	 * Duplicate test: checking if, given two dynClasses A and B, dynFields from
+	 * class A can be duplicated into dynClass B by using setters in B with the
+	 * returned values of getters of A as input.
+	 * 
+	 */
+	public void testSetters() {
+		/**
+		 * Creating and registering both dynClasses
+		 */
+		DynObjectManager dynManager = ToolsLocator.getDynObjectManager();
+
+		DynClass dynClassA = new DefaultDynClass(manager,
+				new DefaultDynClassName("metadata", "DynclassA"),
+				"descriptionA");
+
+		DynClass dynClassB = new DefaultDynClass(manager,
+				new DefaultDynClassName("metadata", "DynclassB"),
+				"descriptionB");
+
+		/**
+		 * Filling dynClass B with "Name" and "Street"
+		 */
+		dynClassB.addDynFieldString("name");
+		dynClassB.addDynFieldString("street");
+
+		fillInitialDynfields(dynClassA, dynClassB.getFullName());
+
+		// /**
+		// * Creating dynObjects for current dynClasses and applying dynObject B
+		// * as a property of A
+		// */
+		// DynObject dynObjA = new DefaultDynObject(dynClassA);
+		// DynObject dynObjB = new DefaultDynObject(dynClassB);
+
+		copyDefinitions(dynClassA, dynClassB);
+
+		checkValues(dynClassA, dynClassB);
+	}
+
+	private List createList(Object[] values) {
+		DynObjectValueItem[] valueItems = new DynObjectValueItem[values.length];
+		for (int i = 0; i < values.length; i++) {
+			valueItems[i] = new DynObjectValueItem(values[i]);
+		}
+		return Arrays.asList(valueItems);
+	}
+
+	/**
+	 * Filling dynClass A with different parameters that will be duplicated into
+	 * dynClass B afterwards.
+	 */
+	private void fillInitialDynfields(DynClass definition,
+			String dynClassBFullName) {
+
+		List items = new ArrayList();
+
+		definition.addDynFieldString("name");
+		definition.addDynField("dynObjB").setType(DataTypes.DYNOBJECT)
+				.setSubtype(dynClassBFullName);
+
+		definition.addDynFieldString("id").setReadOnly(true); // optional
+
+		definition.addDynFieldString("language").setMandatory(true);
+
+		definition.addDynFieldString("charachterset").setMandatory(true)
+				.setAvailableValues(createList(new String[] { "a", "b", "c" }));
+
+		definition
+				.addDynFieldList("hierarchyLevels")
+				.setElementsType(DataTypes.STRING)
+				.setMandatory(true)
+				.setAvailableValues(
+						createList(new String[] { "hier1", "hier2", "hier3" }));
+
+		definition.addDynFieldDate("date").setMandatory(true);
+
+		definition.addDynFieldList("keywords")
+				.setElementsType(DataTypes.STRING);
+
+//		definition.addDynFieldList("dynObjects")
+//				.setElementsType(DataTypes.DYNOBJECT).setMandatory(true)
+//				.setSubtype(dynClassBFullName);
+
+	}
+
+	private void copyDefinitions(DynClass dynClassA, DynClass dynClassB) {
+		DynField field;
+		DynField fields[] = dynClassA.getDynFields();
+		for (int i = 0; i < fields.length; i++) {
+			field = fields[i];
+			;
+//			if (dynClassB.getDynField(field.getName()) == null) {
+//				addDynField(dynClassB, field);
+//			}
+		}
+
+		// dynFields must have the same number of items or more if some items
+		// have been previously defined.
+		assertTrue(dynClassB.getDynFields().length >= fields.length);
+	}
+
+	private void copyValues(DynObject oldDefinition, DynObject newDefinition) {
+		Object value;
+		DynField field;
+		DynField fields[] = oldDefinition.getDynClass().getDynFields();
+		for (int i = 0; i < fields.length; i++) {
+			field = fields[i];
+			value = oldDefinition.getDynValue(field.getName());
+//			if (newDefinition.getDynClass().getDynField(field.getName()) == null) {
+//				addDynField(newDefinition.getDynClass(), field);
+//			}
+			if (value == null) {
+				continue;
+			}
+			if (value instanceof DynObject) {
+				DynObject parent = (DynObject) value;
+				DynStruct parentDefinition = parent.getDynClass();
+				DynClass childDefinition = manager.get(
+						parentDefinition.getName(),
+						parentDefinition.getNamespace());
+				DynObject child = manager.createDynObject(childDefinition);
+
+				copyValues(child, parent);
+				newDefinition.setDynValue(field.getName(), child);
+
+			} else {
+				newDefinition.setDynValue(field.getName(), value);
+			}
+		}
+	}
+
+	private void addDynField(DynStruct definition, DynField_v2 field) {
+		DynField dynField = definition.addDynField(field.getName())
+				.setType(field.getType()).setSubtype(field.getSubtype())
+				.setAvailableValues(field.getAvailableValues())
+				.setClassOfItems(field.getClassOfItems())
+				.setClassOfValue(field.getClassOfValue())
+				.setDefaultFieldValue(field.getDefaultValue())
+				.setDescription(field.getDescription())
+				.setGroup(field.getGroup()).setHidden(field.isHidden())
+				.setMandatory(field.isMandatory())
+				.setMaxValue(field.getMaxValue())
+				.setMinValue(field.getMinValue()).setOrder(field.getOder())
+				.setPersistent(field.isPersistent())
+				.setReadOnly(field.isReadOnly());
+
+		// PETO copyElementsType(dynField, XXXX);
+	}
+
+	private void copyElementsType(DynField dynField, DynField elementsType) {
+		if (elementsType == null) {
+			return;
+		}
+//
+//		dynField.setElementsType(elementsType.getType());
+//		dynField.getElementsType().setSubtype(elementsType.getSubtype())
+//				.setAvailableValues(elementsType.getAvailableValues())
+//				.setClassOfItems(elementsType.getClassOfItems())
+//				.setClassOfValue(elementsType.getClassOfValue())
+//				.setDefaultFieldValue(elementsType.getDefaultValue())
+//				.setDescription(elementsType.getDescription())
+//				.setGroup(elementsType.getGroup())
+//				.setHidden(elementsType.isHidden())
+//				.setMandatory(elementsType.isMandatory())
+//				.setMaxValue(elementsType.getMaxValue())
+//				.setMinValue(elementsType.getMinValue())
+//				.setOrder(elementsType.getOder())
+//				.setPersistent(elementsType.isPersistent())
+//				.setReadOnly(elementsType.isReadOnly());
+	}
+
+	private void checkValues(DynClass dynObjA, DynClass dynObjB) {
+		DynField[] dynFieldsA = dynObjA.getDynFields();
+		DynField[] dynFieldsB = dynObjB.getDynFields();
+
+		DynField field;
+		boolean done = false;
+		for (int i = 0; i < dynFieldsA.length; ++i) {
+			field = dynFieldsA[i];
+			for (int j = 0; j < dynFieldsB.length; ++j) {
+				if (dynFieldsB[j].getName().equals(field.getName())) {
+					checkDynField(field, dynFieldsB[j]);
+					done = true;
+				}
+			}
+			// dynField must be defined in both lists.
+			assertTrue(done);
+
+		}
+	}
+
+	private void checkDynField(DynField fieldA, DynField fieldB) {
+
+		assertEquals(fieldA.getName(), fieldA.getName());
+		assertEquals(fieldA.getType(), fieldB.getType());
+		assertEquals(fieldA.getSubtype(), fieldB.getSubtype());
+		assertEquals(fieldA.getAvailableValues(), fieldB.getAvailableValues());
+		assertEquals(fieldA.getClassOfItems(), fieldB.getClassOfItems());
+		assertEquals(fieldA.getClassOfValue(), fieldB.getClassOfValue());
+		assertEquals(fieldA.getDefaultValue(), fieldB.getDefaultValue());
+		assertEquals(fieldA.getDescription(), fieldB.getDescription());
+		assertEquals(fieldA.getGroup(), fieldB.getGroup());
+		assertEquals(fieldA.isHidden(), fieldB.isHidden());
+		assertEquals(fieldA.isMandatory(), fieldB.isMandatory());
+		assertEquals(fieldA.getMaxValue(), fieldB.getMaxValue());
+		assertEquals(fieldA.getMinValue(), fieldB.getMinValue());
+		assertEquals(fieldA.getOder(), fieldB.getOder());
+		assertEquals(fieldA.isPersistent(), fieldB.isPersistent());
+		assertEquals(fieldA.isReadOnly(), fieldB.isReadOnly());
+
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectTest.java	(revision 1235)
@@ -0,0 +1,156 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/**
+ *
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import org.easymock.MockControl;
+
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DefaultDynObjectTest extends AbstractLibraryAutoInitTestCase {
+
+    private MockControl managerControl;
+	private DynObjectManager manager;
+	private DefaultDynClass dynClass;
+
+	/* (non-Javadoc)
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void doSetUp() throws Exception {
+		managerControl = MockControl.createNiceControl(DynObjectManager.class);
+		manager = (DynObjectManager) managerControl.getMock();
+		dynClass = new DefaultDynClass(manager, new DefaultDynClassName(
+				"dynclass"), "description");
+	}
+
+
+    /**
+     * Test method for {@link org.gvsig.tools.dynobject.impl.DefaultDynObject#hasDynValue(String)}.
+     */
+    public void testHasDynValueStringTest() {
+    	final String fieldName = "myField";
+		dynClass.addDynField(fieldName);
+
+		DefaultDynObject obj = new DefaultDynObject(dynClass);
+
+		assertFalse(obj.hasDynValue(fieldName));
+
+		obj.setDynValue(fieldName, "Value");
+
+		assertTrue(obj.hasDynValue(fieldName));
+
+    }
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynObject#hasDynValue(String)}
+	 * from extended class.
+	 */
+	public void testHasDynValueStringExtendedTest() {
+
+        final String parent = "parent";
+
+		DefaultDynClassName name = new DefaultDynClassName(parent);
+
+		DefaultDynClass parentDynClass = new DefaultDynClass(manager, name,
+				"parent description");
+
+		managerControl.expectAndReturn(manager.has(parent), true);
+		managerControl.expectAndReturn(manager.get(parent), parentDynClass);
+		managerControl.replay();
+
+		final String fieldName = "myField";
+		parentDynClass.addDynField(fieldName);
+
+		dynClass.extend(parent);
+
+		DefaultDynObject obj = new DefaultDynObject(dynClass);
+
+		assertFalse(obj.hasDynValue(fieldName));
+
+		obj.setDynValue(fieldName, "Value");
+
+		assertTrue(obj.hasDynValue(fieldName));
+
+    }
+
+
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.impl.DefaultDynObject#hasDynValue(String)}
+	 * from extended class.
+	 */
+	public void testHasDynValueStringDelegatedTest() {
+
+		final String delegated = "delegated";
+
+
+		DefaultDynClassName name = new DefaultDynClassName(delegated);
+
+		DefaultDynClass delegatedDynClass = new DefaultDynClass(manager, name,
+				"parent description");
+
+		managerControl.expectAndReturn(manager.has(delegated), true);
+		managerControl.expectAndReturn(manager.get(delegated),
+				delegatedDynClass);
+		managerControl.replay();
+
+		final String fieldName = "myField";
+		delegatedDynClass.addDynField(fieldName);
+
+		dynClass.addDynField(fieldName);
+
+		DefaultDynObject delegatedObj = new DefaultDynObject(delegatedDynClass);
+
+		DefaultDynObject obj = new DefaultDynObject(dynClass);
+
+		assertFalse(obj.hasDynValue(fieldName));
+
+		delegatedObj.setDynValue(fieldName, "DelegatedValue");
+
+		obj.delegate(delegatedObj);
+
+		assertTrue(obj.hasDynValue(fieldName));
+
+		Object v1 = delegatedObj.getDynValue(fieldName); 
+		Object v2 = obj.getDynValue(fieldName);
+		assertEquals(v1,v2);
+
+
+		obj.setDynValue(fieldName, "Value");
+
+		assertTrue(obj.hasDynValue(fieldName));
+		assertEquals("Value", obj.getDynValue(fieldName));
+
+
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectPagingHelperTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectPagingHelperTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/DynObjectPagingHelperTest.java	(revision 1235)
@@ -0,0 +1,134 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+
+/**
+ * Tests for the {@link DynObjectPagingHelper} interface.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class DynObjectPagingHelperTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private DynObjectPagingHelper helper;
+
+	protected void doSetUp() throws Exception {
+		helper = createDynObjectPagingHelper();
+	}
+
+	/**
+	 * Test method for the max page size setting.
+	 */
+	public void testMaxPageSize() throws Exception {
+
+		helper.setMaxPageSize(2);
+		helper.setCurrentPage(0);
+
+		long numPages = helper.getNumPages();
+		if (numPages == 0) {
+			fail("The provided helper can't have 0 pages, "
+					+ "please provide one with some data for the test");
+		}
+		for (long i = numPages; i < numPages - 1; i++) {
+			assertEquals("Number of elements of page " + i
+					+ " is not the same as the maximum page size", numPages,
+					helper.getCurrentPageDynObjects().length);
+			helper.setCurrentPage(i + 1);
+		}
+		assertTrue(
+				"Last page is not less than or equal to the maximum page size",
+				numPages >= helper.getCurrentPageDynObjects().length);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.DynObjectPagingHelper#getNumPages()}.
+	 */
+	public void testGetNumPages() throws Exception {
+		double numDOs = helper.getTotalSize();
+		double pageSize = helper.getMaxPageSize();
+
+		long numPages = (long) Math.ceil(numDOs / pageSize);
+		assertEquals(numPages, helper.getNumPages());
+
+		pageSize = 2;
+		helper.setMaxPageSize((int) pageSize);
+
+		numPages = (long) Math.ceil(numDOs / pageSize);
+		assertEquals(numPages, helper.getNumPages());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.DynObjectPagingHelper#setCurrentPage(long)}
+	 * .
+	 */
+	public void testSetCurrentPage() throws Exception {
+		try {
+			helper.setCurrentPage(helper.getNumPages() + 1);
+			fail("Helper allows to set a page which does not exist");
+		} catch (Exception e) {
+			// Works as excepted
+		}
+
+		try {
+			helper.setCurrentPage(-1);
+			fail("Helper allows to set a negative page");
+		} catch (Exception e) {
+			// Works as excepted
+		}
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.tools.dynobject.DynObjectPagingHelper#getCurrentPageDynObjects()}
+	 * .
+	 */
+	public void testGetCurrentPageDynObjects() throws Exception {
+		helper.setMaxPageSize(2);
+		long numPages = helper.getNumPages();
+
+		if (numPages < 2) {
+			fail("The provided helper can't have 0 or 1 page, "
+					+ "please provide one with some more data for the test");
+		}
+
+		helper.setCurrentPage(0);
+		DynObject[] values = helper.getCurrentPageDynObjects();
+		assertTrue(values != null && values.length == 2);
+	}
+
+	protected DynObjectPagingHelper getHelper() {
+		return helper;
+	}
+
+	protected abstract DynObjectPagingHelper createDynObjectPagingHelper()
+			throws Exception;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/ImportDynClassTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/ImportDynClassTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/ImportDynClassTest.java	(revision 1235)
@@ -0,0 +1,259 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.XmlPullParserException;
+
+public class ImportDynClassTest extends AbstractLibraryAutoInitTestCase {
+
+	private final static Logger LOG = LoggerFactory
+			.getLogger(ImportDynClassTest.class);
+	private DynObjectManager manager;
+
+	protected void doSetUp() throws Exception {
+		this.manager = ToolsLocator.getDynObjectManager();
+	}
+
+	public void testTagBasedBasicTypes() throws InstantiationException,
+			XmlPullParserException, IOException {
+		try {
+			InputStream stream = this.getClass().getResourceAsStream(
+					"tagBasedImportDynClassTest.xml");
+
+			Map dynClasses = this.manager.importDynClassDefinitions(stream,
+					null);
+
+			checkDynClassValues(dynClasses);
+		} catch (BaseRuntimeException ex) {
+			LOG.error(ex.getMessageStack());
+			throw ex;
+		}
+	}
+
+	public void testAttrBasedBasicTypes() throws InstantiationException,
+			XmlPullParserException, IOException {
+		try {
+			InputStream stream = this.getClass().getResourceAsStream(
+					"attrBasedImportDynClassTest.xml");
+
+			Map dynClasses = this.manager.importDynClassDefinitions(stream,
+					null);
+
+			checkDynClassValues(dynClasses);
+		} catch (BaseRuntimeException ex) {
+			LOG.error(ex.getMessageStack());
+			throw ex;
+		}
+	}
+
+	private void checkDynClassValues(Map dynClasses) {
+		DynField field;
+
+		if (dynClasses.isEmpty()) {
+			fail("No ha cargado ninguna clase.");
+		}
+		if (dynClasses.size() != 4) {
+			fail("Ha cargado ms clases de las esperadas");
+		}
+		DynClass dynClass = (DynClass) dynClasses.get("MyObjectBasicTypes");
+		assertNotNull("No se ha recuperado la clase 'MyObjectBasicTypes'",
+				dynClass);
+		assertEquals("La descripcion no es la esperada",
+				"MyObjectBasicTypes test definition", dynClass.getDescription());
+
+		field = dynClass.getDynField("a");
+		assertNotNull("No se ha encontrado el campo 'a'", field);
+		assertEquals("type para el campo 'a' no tiene el valor esperado.",
+				DataTypes.INT, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'a' no tiene el valor esperado.",
+				true, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'a' no tiene el valor esperado.",
+				true, field.isPersistent());
+		assertEquals("minValue para el campo 'a' no tiene el valor esperado.",
+				0, ((Integer) field.getMinValue()).intValue());
+		assertEquals("maxValue para el campo 'a' no tiene el valor esperado.",
+				100, ((Integer) field.getMaxValue()).intValue());
+		assertEquals(
+				"defaultValue para el campo 'a' no tiene el valor esperado.",
+				1, ((Integer) field.getDefaultValue()).intValue());
+		assertEquals("group para el campo 'a' no tiene el valor esperado.",
+				"Numbers", field.getGroup());
+		assertEquals("order para el campo 'a' no tiene el valor esperado.", 12,
+				field.getOder());
+
+		field = dynClass.getDynField("b");
+		assertNotNull("No se ha encontrado el campo 'b'", field);
+		assertEquals("type para el campo 'b' no tiene el valor esperado.",
+				DataTypes.LONG, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'b' no tiene el valor esperado.",
+				true, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'b' no tiene el valor esperado.",
+				true, field.isPersistent());
+		assertEquals(
+				"defaultValue para el campo 'b' no tiene el valor esperado.",
+				2, ((Long) field.getDefaultValue()).longValue());
+		assertEquals("group para el campo 'b' no tiene el valor esperado.",
+				"Numbers", field.getGroup());
+
+		field = dynClass.getDynField("c");
+		assertNotNull("No se ha encontrado el campo 'c'", field);
+		assertEquals("type para el campo 'c' no tiene el valor esperado.",
+				DataTypes.DOUBLE, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'c' no tiene el valor esperado.",
+				false, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'c' no tiene el valor esperado.",
+				true, field.isPersistent());
+		assertEquals("minValue para el campo 'c' no tiene el valor esperado.",
+				0.0, ((Double) field.getMinValue()).doubleValue(), 0.001);
+		assertEquals("maxValue para el campo 'c' no tiene el valor esperado.",
+				100.0, ((Double) field.getMaxValue()).doubleValue(), 0.001);
+		assertEquals(
+				"defaultValue para el campo 'c' no tiene el valor esperado.",
+				1.1, ((Double) field.getDefaultValue()).doubleValue(), 0.001);
+		assertEquals("group para el campo 'c' no tiene el valor esperado.",
+				"Numbers", field.getGroup());
+
+		field = dynClass.getDynField("d");
+		assertNotNull("No se ha encontrado el campo 'd'", field);
+		assertEquals("type para el campo 'd' no tiene el valor esperado.",
+				DataTypes.FLOAT, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'd' no tiene el valor esperado.",
+				false, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'd' no tiene el valor esperado.",
+				true, field.isPersistent());
+		assertEquals(
+				"defaultValue para el campo 'd' no tiene el valor esperado.",
+				1.2, ((Float) field.getDefaultValue()).floatValue(), 0.001);
+		assertEquals("group para el campo 'd' no tiene el valor esperado.",
+				"Numbers", field.getGroup());
+
+		field = dynClass.getDynField("e");
+		assertNotNull("No se ha encontrado el campo 'e'", field);
+		assertEquals("type para el campo 'e' no tiene el valor esperado.",
+				DataTypes.BOOLEAN, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'e' no tiene el valor esperado.",
+				true, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'e' no tiene el valor esperado.",
+				false, field.isPersistent());
+		assertEquals(
+				"defaultValue para el campo 'e' no tiene el valor esperado.",
+				true, ((Boolean) field.getDefaultValue()).booleanValue());
+		assertEquals(
+				"availableValues[0].value para el campo 'e' no tiene el valor esperado.",
+				true, ((Boolean) (field.getAvailableValues()[0].getValue()))
+						.booleanValue());
+		assertEquals(
+				"availableValues[0].label para el campo 'e' no tiene el valor esperado.",
+				"True", field.getAvailableValues()[0].getLabel());
+		assertEquals(
+				"availableValues[1].value para el campo 'e' no tiene el valor esperado.",
+				false, ((Boolean) (field.getAvailableValues()[1].getValue()))
+						.booleanValue());
+		assertEquals(
+				"availableValues[1].label para el campo 'e' no tiene el valor esperado.",
+				"False", field.getAvailableValues()[1].getLabel());
+
+		field = dynClass.getDynField("f");
+		assertNotNull("No se ha encontrado el campo 'f'", field);
+		assertEquals("type para el campo 'f' no tiene el valor esperado.",
+				DataTypes.STRING, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'f' no tiene el valor esperado.",
+				true, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'f' no tiene el valor esperado.",
+				true, field.isPersistent());
+		assertEquals(
+				"defaultValue para el campo 'f' no tiene el valor esperado.",
+				"red", field.getDefaultValue());
+		assertEquals(
+				"availableValues[0].value para el campo 'f' no tiene el valor esperado.",
+				"red", field.getAvailableValues()[0].getValue());
+		assertEquals(
+				"availableValues[0].label para el campo 'f' no tiene el valor esperado.",
+				"Red", field.getAvailableValues()[0].getLabel());
+		assertEquals(
+				"availableValues[1].value para el campo 'f' no tiene el valor esperado.",
+				"green", field.getAvailableValues()[1].getValue());
+		assertEquals(
+				"availableValues[1].label para el campo 'f' no tiene el valor esperado.",
+				"Green", field.getAvailableValues()[1].getLabel());
+		assertEquals(
+				"availableValues[2].value para el campo 'f' no tiene el valor esperado.",
+				"blue", field.getAvailableValues()[2].getValue());
+		assertEquals(
+				"availableValues[2].label para el campo 'f' no tiene el valor esperado.",
+				"Blue", field.getAvailableValues()[2].getLabel());
+
+		field = dynClass.getDynField("g");
+		assertNotNull("No se ha encontrado el campo 'g'", field);
+		assertEquals("type para el campo 'g' no tiene el valor esperado.",
+				DataTypes.DATE, field.getType());
+		assertEquals(
+				"isMandatory para el campo 'g' no tiene el valor esperado.",
+				true, field.isMandatory());
+		assertEquals(
+				"isPersistent para el campo 'g' no tiene el valor esperado.",
+				true, field.isPersistent());
+
+		dynClass = (DynClass) dynClasses.get("MyObjectBasicTypes4");
+		assertNotNull("No se ha recuperado la clase 'MyObjectBasicTypes4'",
+				dynClass);
+	
+		field = dynClass.getDynField("obj");
+		assertNotNull("No se ha encontrado el campo 'obj'", field);
+		assertEquals("type para el campo 'obj' no tiene el valor esperado.",
+				DataTypes.OBJECT, field.getType());
+		assertTrue("El valor de classOfValue del campo obj no es el esperado.", Evaluator.class.isAssignableFrom(field.getClassOfValue()) ) ;
+		
+		field = dynClass.getDynField("objs");
+		assertNotNull("No se ha encontrado el campo 'objs'", field);
+		assertEquals("type para el campo 'objs' no tiene el valor esperado.",
+				DataTypes.LIST, field.getType());
+		assertTrue("El valor de classOfItems del campo objs no es el esperado.", Visitor.class.isAssignableFrom(field.getClassOfValue()) ) ;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/dynobject/ImportDynClassTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/log4j.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/log4j.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/log4j.xml	(revision 1235)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- 
+Log4J configuration file for unit tests execution.
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<!-- Appender configuration to show logging messages through the console -->
+	<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()]  %m%n" />
+		</layout>
+	</appender>
+
+	<!-- 
+	Activate logging messages of DEBUG level of higher only for the
+	org.gvsig.tools packages.
+	You can put full classes names or packages instead, to configure
+	logging for all the classes and subpackages of the package.
+	-->
+	<category name="org.gvsig.tools">
+		<priority value="TRACE" />
+	</category>
+
+	<!-- 
+	By default, show only logging messages of INFO level or higher, 
+	through the previously configured CONSOLE appender. 
+	-->
+	<root>
+		<priority value="TRACE" />
+		<appender-ref ref="CONSOLE" />
+	</root>
+</log4j:configuration>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/packageutils/package1.info
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/packageutils/package1.info	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/packageutils/package1.info	(revision 1235)
@@ -0,0 +1,8 @@
+code=org.gvsig.myplugin
+name=myplugin
+description=Test
+version=1.0.0
+build=1
+state=RC1
+official=true
+type=plugin
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/DynClassTemplate.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/DynClassTemplate.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/DynClassTemplate.xml	(revision 1235)
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class>
+      <name></name>
+      <namespace></namespace>
+      <description></description>
+      <superClassNames>
+        <superClassName></superClassName>
+        <superClassName></superClassName>
+      </superClassNames>
+      <fields>
+        <field>
+          <name></name>
+          <type></type>
+          <subtype></subtype>
+          <description></description>
+          <isMandatory></isMandatory>
+          <isPersistent></isPersistent>
+          <minValue></minValue>
+          <maxValue></maxValue>
+          <classOfValue></classOfValue>
+          <defaultValue></defaultValue>
+          <group></group>
+          <availableValues>
+            <valueItem>
+              <label></label>
+              <value></value>
+            </valueItem>
+            <valueItem>
+              <label></label>
+              <value></value>
+            </valueItem>
+          </availableValues>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/DynClassTemplate.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/attrBasedImportDynClassTest.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/attrBasedImportDynClassTest.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/attrBasedImportDynClassTest.xml	(revision 1235)
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions version="1.0.0">
+  <classes>
+    <class name="MyObjectBasicTypes">
+      <description>MyObjectBasicTypes test definition</description>
+      <fields>
+        <field	name="a" type="integer" mandatory="true" persistent="true" 
+        		minValue="0x0" maxValue="100" defaultValue="1"
+          		group="Numbers" order="12">
+        </field>
+        <field	name="b" type="long" mandatory="true" persistent="true" 
+        		defaultValue="2"
+          		group="Numbers"/>
+        <field	name="c" type="double" mandatory="false" persistent="true" 
+        		defaultValue="1.1" minValue="0.0" maxValue="100.0" 
+          		group="Numbers"/>
+        <field	name="d" type="float" mandatory="false" 
+        		minValue="0.0" maxValue="100.0" 
+          		group="Numbers">
+          <persistent>true</persistent>
+          <defaultValue>1.2</defaultValue>
+        </field>
+
+        <field	name="e" type="boolean" mandatory="true"> 
+          <persistent>false</persistent>
+          <defaultValue>true</defaultValue>
+          <availableValues>
+            <value label="True">true</value>
+            <value label="False">false</value>
+          </availableValues>
+        </field>
+
+        <field name="f" type="string" mandatory="true" persistent="true" defaultValue="red">
+          <availableValues>
+            <value label="Red">red</value>
+            <value label="Green">green</value>
+            <value label="Blue">blue</value>
+          </availableValues>
+        </field>
+        <field name="g" type="date" mandatory="true" persistent="true"/>
+      </fields>
+    </class>
+
+    <class name="MyObjectBasicTypes2" namespace="test1">
+      <extends>
+        <class name="MyObjectBasicTypes"/>
+      </extends>
+      <fields>
+      </fields>
+    </class>
+
+    <class name="MyObjectBasicTypes3">
+      <extends>
+        <class name="MyObjectBasicTypes2" namespace="test1"/>
+      </extends>
+      <fields>
+      </fields>
+    </class>
+
+    <class name="MyObjectBasicTypes4">
+      <extends>
+        <class name="MyObjectBasicTypes2" namespace="test1"/>
+      </extends>
+      <fields>
+        <field	name="obj" type="Object" classOfValue="org.gvsig.tools.evaluator.Evaluator"/>
+        <field	name="objs" type="List" classOfItems="org.gvsig.tools.visitor.Visitor"/>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/attrBasedImportDynClassTest.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/tagBasedImportDynClassTest.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/tagBasedImportDynClassTest.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/tagBasedImportDynClassTest.xml	(revision 1235)
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class>
+      <name>MyObjectBasicTypes</name>
+      <description>MyObjectBasicTypes test definition</description>
+      <fields>
+        <field>
+          <name>a</name>
+          <type>integer</type>
+          <mandatory>true</mandatory>
+          <persistent>true</persistent>
+          <minValue>0</minValue>
+          <maxValue>100</maxValue>
+          <defaultValue>1</defaultValue>
+          <group>Numbers</group>
+          <order>12</order>
+        </field>
+        <field>
+          <name>b</name>
+          <type>long</type>
+          <mandatory>true</mandatory>
+          <persistent>true</persistent>
+          <defaultValue>2</defaultValue>
+          <group>Numbers</group>
+        </field>
+        <field>
+          <name>c</name>
+          <type>double</type>
+          <mandatory>false</mandatory>
+          <persistent>true</persistent>
+          <minValue>0.0</minValue>
+          <maxValue>100.0</maxValue>
+          <defaultValue>1.1</defaultValue>
+          <group>Numbers</group>
+        </field>
+        <field>
+          <name>d</name>
+          <type>float</type>
+          <mandatory>false</mandatory>
+          <persistent>true</persistent>
+          <defaultValue>1.2</defaultValue>
+          <group>Numbers</group>
+        </field>
+        <field>
+          <name>e</name>
+          <type>boolean</type>
+          <mandatory>true</mandatory>
+          <persistent>false</persistent>
+          <defaultValue>true</defaultValue>
+          <availableValues>
+            <valueItem>
+              <label>True</label>
+              <value>true</value>
+            </valueItem>
+            <valueItem>
+              <label>False</label>
+              <value>false</value>
+            </valueItem>
+          </availableValues>
+        </field>
+        <field>
+          <name>f</name>
+          <type>string</type>
+          <mandatory>true</mandatory>
+          <persistent>true</persistent>
+          <defaultValue>red</defaultValue>
+          <availableValues>
+            <valueItem>
+              <label>Red</label>
+              <value>red</value>
+            </valueItem>
+            <valueItem>
+              <label>Green</label>
+              <value>green</value>
+            </valueItem>
+            <valueItem>
+              <label>Blue</label>
+              <value>blue</value>
+            </valueItem>
+          </availableValues>
+        </field>
+        <field>
+          <name>g</name>
+          <type>date</type>
+          <mandatory>true</mandatory>
+          <persistent>true</persistent>
+        </field>
+      </fields>
+    </class>
+
+
+    <class name="MyObjectBasicTypes2" namespace="test1">
+      <extends>
+        <class>MyObjectBasicTypes</class>
+      </extends>
+      <fields>
+      </fields>
+    </class>
+
+    <class name="MyObjectBasicTypes3">
+      <extends>
+        <class namespace="test1">MyObjectBasicTypes2</class> 
+      </extends>
+      <fields>
+      </fields>
+    </class>
+
+    <class name="MyObjectBasicTypes4">
+      <extends>
+        <class name="MyObjectBasicTypes2" namespace="test1"/>
+      </extends>
+      <fields>
+        <field>
+          <name>obj</name>
+          <type>Object</type>
+          <classOfValue>org.gvsig.tools.evaluator.Evaluator</classOfValue>
+        </field>
+        <field>
+          <name>objs</name>
+          <type>List</type>
+          <classOfItems>org.gvsig.tools.visitor.Visitor</classOfItems>
+        </field>
+      </fields>
+    </class>
+
+
+  </classes>
+</definitions>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/tagBasedImportDynClassTest.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/BasicTypes2Test.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/BasicTypes2Test.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/BasicTypes2Test.xml	(revision 1235)
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions version="1.0.0">
+  <classes>
+    <class name="MyObjectBasicTypes">
+      <description>MyObjectBasicTypes Persistence definition</description>
+      <fields>
+        <field name="a" type="integer"/>
+        <field name="b" type="long"/>
+        <field name="c" type="double"/>
+        <field name="d" type="float"/>
+        <field name="e" type="boolean"/>
+        <field name="f" type="string"/>
+        <field name="g" type="date"/>
+      </fields>
+    </class>
+    <class name="Extends1Test">
+      <description>Test the extends with namespace</description>
+      <extends>
+      	<class name="MyObjectBasicTypes"/>
+      </extends>
+      <fields>
+      </fields>
+    </class>
+    <class name="MyObjectComplexTypes">
+      <description>Test the extends with namespace</description>
+      <extends>
+      	<class name="MyObjectBasicTypes"/>
+      </extends>
+      <fields>
+      	<field name="child" type="dynObject" subtype="MyObjectBasicTypes"></field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/BasicTypes2Test.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/DynTypesTest.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/DynTypesTest.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/DynTypesTest.xml	(revision 1235)
@@ -0,0 +1,59 @@
+<?xml version= "1.0 "?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<definitions version="1.0.0">
+  <classes>
+    <class name="MyObjectDynTypes">
+      <description>MyObjectMapType Persistence definition</description>
+      <fields>
+      	<field>
+          <name>mapa</name>
+          <type>Map</type>
+          <mandatory>true</mandatory>
+          <classOfItems>java.lang.String</classOfItems>
+        </field>
+      	<field>
+          <name>conjunto</name>
+          <type>Set</type>
+          <mandatory>true</mandatory>
+          <classOfItems>java.lang.String</classOfItems>
+        </field>
+      	<field>
+          <name>lista</name>
+          <type>List</type>
+          <mandatory>true</mandatory>
+          <classOfItems>java.lang.String</classOfItems>
+        </field>
+      	<field>
+          <name>viewPort</name>
+          <type>Object</type>
+          <mandatory>true</mandatory>
+          <classOfItems>org.gvsig.tools.persistence.case1.model.ViewPort</classOfItems>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</definitions>  

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/DynTypesTest.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/test/resources/README.txt	(revision 1235)
@@ -0,0 +1,35 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+Put into this folder the resources needed by your test classes.
+
+This folder is added to the Tests classpath, so you can load any resources 
+through the ClassLoader.
+
+By default, in this folder you can find an example of log4j configuration,
+prepared to log messages through the console, so logging works when you
+run your tests classes.
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependencies.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependencies.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependencies.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.installer.lib.api;
+
+import java.util.List;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.packageutils.StringWithAlias;
+
+/**
+ * 
+ * Este interface se mantiene aqui por compatibilidad con versiones anteriores.
+ * 
+ * @see #org.gvsig.tools.packageutils.Dependencies
+ * @deprecated use #org.gvsig.tools.packageutils.Dependencies
+ */
+public interface Dependencies extends List, Cloneable  {
+    
+	public Dependencies parse(String dependenies);
+
+	public boolean match(String type, String code, Version version);
+	public boolean match(String type, StringWithAlias code, Version version);
+
+    public Dependency find(String type, String code, Version version);
+    public Dependency find(String type, StringWithAlias code, Version version);
+    public List findAll(String type, String code, Version version);
+    public List findAll(String type, StringWithAlias code, Version version);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependencies.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/PackageInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/PackageInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/PackageInfo.java	(revision 1235)
@@ -0,0 +1,416 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.installer.lib.api;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.gvsig.tools.packageutils.StringWithAlias;
+import org.gvsig.tools.packageutils.PackageManager.ARCH;
+import org.gvsig.tools.packageutils.PackageManager.JVM;
+import org.gvsig.tools.packageutils.PackageManager.OS;
+import org.gvsig.tools.packageutils.PackageManager.STATE;
+
+/**
+ * @deprecated use instead #org.gvsig.tools.packageutils.PackageInfo
+ */
+public interface PackageInfo extends Cloneable{
+
+
+	/**
+	 * @return Gets the code of the package.
+	 */
+	public String getCode();
+
+	public void setCode(String code);
+
+	public StringWithAlias getAllCodes();	
+    
+    public boolean hasThisCode(String code);
+    public boolean hasThisCode(StringWithAlias code);
+	
+	
+	public String getID();
+
+	/**
+	 * @return Gets the name of the package.
+	 */
+	public String getName();
+
+	public void setName(String name);
+
+	/**
+	 * @return Gets the description of the package.
+	 */
+	public String getDescription();
+
+	public void setDescription(String description);
+
+	/**
+	 * @return Gets the version of the package.
+	 */
+	public Version getVersion();
+
+	public void setVersion(Version version);
+
+	/**
+	 * @return Gets the state of the package.
+	 * @see STATE
+	 */
+	public String getState();
+
+	/**
+	 * Sets the state of the package
+	 * 
+	 * @param state
+	 * @see STATE
+	 */
+	public void setState(String state);
+
+	/**
+	 * @return Gets if the package is official.
+	 */
+	public boolean isOfficial();
+
+	public void setOfficial(boolean official);
+
+	/**
+	 * @return Gets the type of the package.
+	 */
+	public String getType();
+
+	public void setType(String type);
+
+	/**
+	 * Returns the supported operating system.
+	 * 
+	 * @return the supported operating system
+	 * @see OS
+	 */
+	public String getOperatingSystem();
+
+	/**
+	 * Sets the supported operating system.
+	 * 
+	 * @param operatingSystem
+	 *            the supported operating system
+	 * @see OS
+	 */
+	public void setOperatingSystem(String operatingSystem);
+
+	/**
+	 * Returns the supported hardware architecture.
+	 * 
+	 * @return the supported hardware architecture
+	 * @see ARCH
+	 */
+	public String getArchitecture();
+
+	/**
+	 * Sets the supported hardware architecture.
+	 * 
+	 * @param architecture
+	 *            the supported hardware architecture
+	 * @see ARCH
+	 */
+	public void setArchitecture(String architecture);
+
+	/**
+	 * Returns the supported java vm version.
+	 * 
+	 * @return the supported java vm version
+	 * @see JVM
+	 */
+	public String getJavaVM();
+
+	/**
+	 * Sets the supported java vm version.
+	 * 
+	 * @param javaVM
+	 *            the supported java vm version
+	 * @see JVM
+	 */
+	public void setJavaVM(String javaVM);
+
+	/**
+	 * Returns the supported application version.
+	 * 
+	 * @return the supported application version
+	 */
+	public Version getApplicationVersion();
+
+	/**
+	 * Sets the supported application version.
+	 * 
+	 * @param verion
+	 *            the supported application version
+	 */
+	public void setApplicationVersion(Version version);
+
+	/**
+	 * Returns the package bundle download {@link URL}.
+	 *  
+	 * May be null if there is no remote URL to download the bundle.
+	 * 
+	 * @return the package bundle download {@link URL}
+	 */
+	public URL getDownloadURL();
+
+	public String getDownloadURLAsString();
+
+	/**
+	 * Sets the package bundle download {@link URL}. Optional.
+	 * 
+	 * @param defaultURL
+	 *            the package bundle download {@link URL}
+	 */
+	public void setDownloadURL(URL defaultURL);
+
+	public void setDownloadURL(String defaultDownloadURL);
+
+	/**
+	 * Returns the package info model version.
+	 * 
+	 * @return the package info model version
+	 */
+	public String getModelVersion();
+
+	/**
+	 * Sets the package info model version.
+	 * 
+	 * @param modelVersion
+	 *            the package info model version
+	 */
+	public void setModelVersion(String modelVersion);
+
+	public String getOwner();
+
+	/**
+	 * Sets the package owner.
+	 * 
+	 * @param owner
+	 *            the package owner
+	 */
+	public void setOwner(String owner);
+
+	/**
+	 * Returns the owner's url {@link URL}.
+	 * 
+	 * @return the owner's url {@link URL}
+	 */
+	public URL getOwnerURL();
+
+	/**
+	 * Sets the package owner's url.
+	 * 
+	 * @param sources
+	 *            the package owner's url
+	 */
+	public void setOwnerURL(URL sources);
+
+	/**
+	 * Returns the package source files url {@link URL}.
+	 * 
+	 * @return the package source files url {@link URL}
+	 */
+	public URL getSourcesURL();
+
+	/**
+	 * Sets the package sources.
+	 * 
+	 * @param sources
+	 *            the package sources
+	 */
+	public void setSourcesURL(URL sources);
+
+	/**
+	 * Returns the package web url {@link URL}.
+	 * 
+	 * @return the package web url {@link URL}
+	 */
+	public URL getWebURL();
+
+	/**
+	 * Sets the package web url {@link URL}.
+	 * 
+	 * @param webURL
+	 *            the package web url {@link URL}
+	 */
+	public void setWebURL(URL webURL);
+
+	/**
+	 * @param string
+	 * @return
+	 */
+	public boolean matchID(String string);
+
+	public Dependencies getDependencies();
+
+	public void setDependencies(String dependencies);
+
+	public void setDependencies(Dependencies dependencies);
+
+	public String toStringCompact();
+
+	public List getCategories();
+
+	public void setCategories(List categoriesList);
+
+	public String getCategoriesAsString();
+
+	public void addCategoriesAsString(String categoriesString);
+
+	public boolean isBroken();
+
+
+
+	
+	
+	
+	
+
+	/**
+	 * 
+	 * @param version
+	 * @deprecated Use {@link #setVersion(Version)}
+	 */
+	public void setVersion(String version);
+
+	
+	/**
+	 * @return Gets the build number of the package.
+	 * @deprecated use {@link #getVersion()}.getBuild()
+	 */
+	public int getBuild();
+
+	/**
+	 * @deprecated use {@link #getVersion()}
+	 */
+	public void setBuild(int build);
+
+	/**
+	 * Returns the supported gvSIG version.
+	 * 
+	 * @return the supported gvSIG version
+	 * @deprecated use {@link #getApplicationVersion()}
+	 */
+	public String getGvSIGVersion();
+
+	/**
+	 * Sets the supported gvSIG version.
+	 * 
+	 * @param gvSIGVersion the supported gvSIG version
+	 * @deprecated use {@link #setApplicationVersion(org.gvsig.tools.packageutils.Version)}
+	 */
+	public void setGvSIGVersion(String gvSIGVersion);
+
+
+	 /**
+	 * Returns the package bundle download {@link URL}.
+	 *
+	 * May be null if there is no remote URL to download the bundle.
+	 *
+	 * @return the package bundle download {@link URL}
+	 * @deprecated use InstallManager
+	 *
+	 */
+	public URL getDownloadURL(URL baseURL);
+
+	/**
+	 * Gets the ant script that has to be executed in the installation process.
+	 * 
+	 * @return the script.
+	 * @deprecated use {@link #getPostInstallScript()} 
+	 */
+	public String getAntScript();
+
+	/**
+	 * Sets the ant script that can be executed in the installation process.
+	 * 
+	 * @param antScript The ant script to copy.
+	 * @deprecated use {@link #setPostInstallScript(String)}
+	 */
+	public void setAntScript(String antScript);
+
+	/**
+	 * @deprecated use InstallManager
+	 */
+	public File downloadFile() throws BaseException;
+
+	/**
+	 * @deprecated use InstallManager
+	 */
+	public File downloadFile(SimpleTaskStatus taskStatus) throws BaseException;
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public void addFileToCopy(File file);
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public File getFileToCopy(int i);
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public void removeFileToCopy(File file);
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public void clearFilesToCopy();
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public List getFilesToCopy();
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public boolean removeInstallFolder(File folder);
+
+	/**
+	 * @deprecated use InstallManager.getPackageInfoFiles
+	 */
+	public boolean removeFilesFolder(File folder);
+
+	/**
+	 * @deprecated always return true
+	 */
+	public boolean isSigned();
+
+	/**
+	 * @deprecated do nothing
+	 */
+	public void checkSignature(byte[] pkgdata);
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/PackageInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependency.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependency.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependency.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.installer.lib.api;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.packageutils.StringWithAlias;
+
+
+/**
+ * 
+ * Este interface se mantiene aqui por compatibilidad con versiones anteriores.
+ * 
+ * @see #org.gvsig.tools.packageutils.Dependency
+ * @deprecated use #org.gvsig.tools.packageutils.Dependency
+ */
+public interface Dependency extends Cloneable  {
+
+	public final String REQUIRED = "required";
+	public final String CONFLICT = "conflict";
+	public final String RECOMMENDED = "recommended";
+
+	public Dependency parse(String dependency);
+
+	public String getType();
+
+	public String getCode();
+
+	public String getOp();
+
+	public Version getVersion();
+
+	public boolean match(String type, String code, Version version);
+	public boolean match(String type, StringWithAlias code, Version version);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Dependency.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Version.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Version.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Version.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.installer.lib.api;
+
+import org.gvsig.tools.lang.Cloneable;
+
+
+/**
+ * 
+ * Este interface se mantiene aqui por compatibilidad con versiones anteriores.
+ * 
+ * @see #org.gvsig.tools.packageutils.Version
+ * @deprecated use #org.gvsig.tools.packageutils.Version
+ * 
+ */
+public interface Version  extends Cloneable, Comparable {
+
+	public Version parse(String version);
+
+	public int getMajor();
+	
+	/**
+	 * @deprecated Use {@link #getMajor()}
+	 */
+    public int getMayor();
+
+	public int getMinor();
+
+	public int getRevision();
+
+	public String getClassifier();
+
+	public int getBuild();
+
+	public boolean check(String op, Version other);
+
+	public String fullFormat();
+	
+	/**
+	 * Return the version formated as string with the format specified as fmt.
+	 * It replace in fmt:
+	 * - %M by the major number of the version
+	 * - %m by the minor number of the version
+	 * - %r by the revision number of the version
+	 * - %c by the classifier of the version
+	 * - %b by the build number of the version
+	 * 
+	 * @param fmt, string used as format
+	 * @return the version formated as string 
+	 */
+	public String format(String fmt);
+
+	/**
+	 * @deprecated don't use, set only in parse 
+	 */
+	public Version setBuild(int build);
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/installer/lib/api/Version.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorReferenceException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorReferenceException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorReferenceException.java	(revision 1235)
@@ -0,0 +1,119 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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 base Locator implementation}
+*/
+package org.gvsig.tools.locator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Exception for errors related to the retrieval of references through a
+ * Locator.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class LocatorReferenceException extends LocatorException {
+
+    private static final long serialVersionUID = -6623935035803501270L;
+
+    private static final String KEY = "locator_exception";
+
+    private static final String MESSAGE = "Error getting a reference to %(referenceName), "
+            + "through the Locator %(locatorName)";
+    
+    private String referenceName;
+
+    private String locatorName;
+    
+    public LocatorReferenceException(String referenceName, Locator locator) {
+        this(MESSAGE, KEY, serialVersionUID, referenceName, locator);
+    }
+    
+    public LocatorReferenceException(Throwable cause, String referenceName,
+            Locator locator) {
+        this(MESSAGE, cause, KEY, serialVersionUID, referenceName, locator);
+    }
+    
+    public LocatorReferenceException(String message, String key, long code,
+            String referenceName, Locator locator) {
+        super(message, key, code);
+        setReferenceName(referenceName);
+        setLocatorName(locator.getLocatorName());
+    }
+
+    public LocatorReferenceException(String message, Throwable cause, String key,
+            long code, String referenceName, Locator locator) {
+        super(message, cause, key, code);
+        setReferenceName(referenceName);
+        setLocatorName(locator.getLocatorName());
+    }
+    
+    protected Map values() {
+        Map values = new HashMap(2);
+        values.put("referenceName", getReferenceName());
+        values.put("locatorName", getLocatorName());
+        return values;
+    }
+    
+    private String getReferenceName() {
+        return referenceName;
+    }
+    
+    private void setReferenceName(String name) {
+        this.referenceName = name;
+    }
+    
+    private String getLocatorName() {
+        return locatorName;
+    }
+
+    private void setLocatorName(String name) {
+        this.locatorName = name;
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorException.java	(revision 1235)
@@ -0,0 +1,80 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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 base Locator implementation}
+*/
+package org.gvsig.tools.locator;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+/**
+ * Exception for errors related to the retrieval of references through a
+ * Locator.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class LocatorException extends BaseRuntimeException {
+
+    private static final long serialVersionUID = -5512585241517866168L;
+    
+    /**
+     * @see BaseException#BaseException(String, String, long)
+     */
+    public LocatorException(String message, String key, long code) {
+        super(message, key, code);
+    }
+
+    /**
+     * @see BaseException#BaseException(String, Throwable, String, long)
+     */
+    public LocatorException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorObjectFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorObjectFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/LocatorObjectFactory.java	(revision 1235)
@@ -0,0 +1,62 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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 base Locator implementation}
+*/
+package org.gvsig.tools.locator;
+
+import org.gvsig.tools.extensionpoint.ExtensionBuilder;
+
+
+/**
+ * Interface for factories of objects to be registered in a Locator.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface LocatorObjectFactory extends ExtensionBuilder {
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator.java	(revision 1235)
@@ -0,0 +1,118 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.locator;
+
+/**
+ * Manages references to the objects of a Library or module.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface Locator {
+
+    /**
+     * Returns a reference to the object with the given name.
+     *
+     * @param name
+     *            of the object to return
+     * @return an instance of an object, or null if not found
+     * @throws LocatorException
+     *             if there is no access to the class or the class cannot be
+     *             instantiated
+     */
+    Object get(String name) throws LocatorException;
+
+    /**
+     * Returns the list of names of references available through this Locator.
+     * Must return null if there are not any registered names.
+     *
+     * @return the list of names of references
+     */
+    String[] getNames();
+
+    /**
+     * Registers a class related to a name. The class is used to create an
+     * instance of the object to return in the {@link #get(String)} method.
+     *
+     * @param name
+     *            of the object to register
+     * @param clazz
+     *            the Class of the object to register
+     */
+    void register(String name, Class clazz);
+
+    void registerDefault(String name, Class clazz);
+
+    /**
+     * Registers a class related to a name. The class is used to create an
+     * instance of the object to return in the {@link #get(String)} method.
+     *
+     * @param name
+     *            of the object to register
+     * @param description
+     *            of the object to register
+     * @param clazz
+     *            the Class of the object to register
+     */
+    void register(String name, String description, Class clazz);
+
+    void registerDefault(String name, String description, Class clazz);
+
+    /**
+     * Registers an object factory related to a name. The factory is used to
+     * create an instance of the object to return in the {@link #get(String)}
+     * method.
+     *
+     * @param name
+     *            of the object to register
+     * @param factory
+     *            the factory of objects to register
+     */
+    void register(String name, LocatorObjectFactory factory);
+
+    /**
+     * Registers an object factory related to a name. The factory is used to
+     * create an instance of the object to return in the {@link #get(String)}
+     * method.
+     *
+     * @param name
+     *            of the object to register
+     * @param description
+     *            of the object to register
+     * @param factory
+     *            the factory of objects to register
+     */
+    void register(String name, String description, LocatorObjectFactory factory);
+
+    /**
+     * Returns the name of the Locator, for registration, logging, and other
+     * uses.
+     *
+     * @return the name of the Locator
+     */
+    String getLocatorName();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/AbstractLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/AbstractLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/AbstractLocator.java	(revision 1235)
@@ -0,0 +1,168 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.locator;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.extensionpoint.impl.DefaultExtensionPointManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Locator implementation based on the use of the ExtensionPoints.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public abstract class AbstractLocator implements Locator, Locator_withExists {
+
+    private Map      instances  = new HashMap();
+    private Logger   logger     = LoggerFactory.getLogger(AbstractLocator.class);
+    private Object   lock       = new Object();
+
+    public Object get(String name) throws LocatorException {
+        Object instance = null;
+
+        // Synchronize the creation and storage of instances
+        synchronized (lock) {
+            instance = instances.get(name);
+            if (instance == null) {
+                try {
+                    instance = getExtensionPoint().create(name);
+                } catch (Exception ex) {
+                    throw new LocatorReferenceException(ex, name, this);
+                }
+                if( instance == null ) {
+                 	logger.info("Can't locate class of '" + name + "', may be it is not registered in this locator '"+this.getLocatorName() +"'.");
+                 	throw new ReferenceNotRegisteredException(name, this);
+                }
+                instances.put(name, instance);
+                if( logger.isInfoEnabled() ) {
+                	logger.info("Created and stored the instance of " + name + " in the singleton table (" + instance.getClass().getName() + "/" + instance.toString()+ ").");
+                }
+            }
+        }
+
+        return instance;
+    }
+
+    public boolean exists(String name) {
+    	Extension extension = getExtensionPoint().get(name);
+    	return extension != null;
+    }
+
+    private void removeFromInstances(String name) {
+    	synchronized (lock) {
+			Object instance = instances.get(name);
+    		if( instance!=null ) {
+    			logger.warn("Removing the instance of " + name + " from the singleton table.(" + instance.getClass().getName() + "/" + instance.toString()+ ") ");
+    			instances.remove(name);
+    		}
+    	}
+    }
+
+    public String[] getNames() {
+        ExtensionPoint extensionPoint = getExtensionPoint();
+        List names = extensionPoint.getNames();
+        return names == null || names.size() == 0 ? null
+                : (String[]) names
+                .toArray(new String[names.size()]);
+    }
+
+    public void register(String name, Class clazz) {
+    	DefaultExtensionPointManager.getManager().add(getLocatorName())
+				.append(name, null, clazz);
+		logger.info("Registered class " + clazz.getName() + " in locator " + name + ".");
+    	removeFromInstances(name);
+    }
+
+    public void registerDefault(String name, Class clazz) {
+		ExtensionPoint ep = getExtensionPoint();
+		if (ep.get(name) == null) {
+			register(name, clazz);
+		}
+	}
+
+    public void register(String name, String description, Class clazz) {
+    	DefaultExtensionPointManager.getManager().add(getLocatorName())
+				.append(name,
+                description, clazz);
+		logger.info("Registered class " + clazz.getName() + " in locator " + name + ".");
+    	removeFromInstances(name);
+    }
+
+    public void registerDefault(String name, String description, Class clazz) {
+    	ExtensionPoint ep = getExtensionPoint();
+    	if( ep.get(name) == null ) {
+    		register(name,description, clazz);
+    		removeFromInstances(name);
+    	}
+    }
+
+    public void register(String name, LocatorObjectFactory factory) {
+    	DefaultExtensionPointManager.getManager().add(getLocatorName()).append(
+				name, null,
+                factory);
+		logger.info("Registered factory " + factory.getClass().getName() + "/" + factory.toString() + " in locator " + name + ".");
+    	removeFromInstances(name);
+    }
+
+    public void register(String name, String description,
+            LocatorObjectFactory factory) {
+    	DefaultExtensionPointManager.getManager().add(getLocatorName()).append(
+				name,
+                description, factory);
+		logger.info("Registered factory " + factory.getClass().getName() + "/" + factory.toString() + " in locator " + name + ".");
+    	removeFromInstances(name);
+    }
+
+    public String toString() {
+        return getLocatorName();
+    }
+
+    /**
+     * Returns the ExtensionPoint to use for the Locator values.
+     */
+    private ExtensionPoint getExtensionPoint() {
+        ExtensionPointManager manager = DefaultExtensionPointManager
+				.getManager();
+        String moduleName = getLocatorName();
+        // synchronize the retrieval of the ExtensionPoint
+        synchronized (lock) {
+            ExtensionPoint extensionPoint = manager.get(moduleName);
+            if (extensionPoint == null) {
+                extensionPoint = manager.add(moduleName);
+            }
+            return extensionPoint;
+        }
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/ReferenceNotRegisteredException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/ReferenceNotRegisteredException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/ReferenceNotRegisteredException.java	(revision 1235)
@@ -0,0 +1,54 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.locator;
+
+/**
+ * Exception for errors related to the initialization of a Library.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class ReferenceNotRegisteredException extends LocatorReferenceException {
+
+    private static final long serialVersionUID = 2459965470774180326L;
+
+    private static final String KEY = "reference_not_registered_exception";
+
+    private static final String MESSAGE = "A Class or Factory has not been " +
+    		"registered for the reference %(referenceName) " +
+    		"in the Locator %(locatorName)";
+
+    public ReferenceNotRegisteredException(String referenceName, Locator locator) {
+        super(MESSAGE, KEY, serialVersionUID, referenceName, locator);
+    }
+
+    public ReferenceNotRegisteredException(Throwable cause,
+            String referenceName, Locator locator) {
+        super(MESSAGE, cause, KEY, serialVersionUID, referenceName, locator);
+    }
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/BaseLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/BaseLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/BaseLocator.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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 base Locator implementation}
+ */
+package org.gvsig.tools.locator;
+
+/**
+ * Base Locator implementation using the Java class name as the Locator name.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class BaseLocator extends AbstractLocator {
+
+    public String getLocatorName() {
+        // Return the full name of the class
+        return getClass().getName();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator_withExists.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator_withExists.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator_withExists.java	(revision 1235)
@@ -0,0 +1,47 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.locator;
+
+/**
+ * Add method exists to the Locator API
+ * 
+ * This interface is to maintain compatility with the interface Locator.
+ *
+ */
+public interface Locator_withExists extends Locator {
+
+    /**
+     * Returns true if exists a manager registered for this name.
+     * The manager can be created or no.
+     *
+     * @param name
+     *            of the object to return
+     * @return true if a manager is registered for this name.
+     */
+    boolean exists(String name);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/Locator_withExists.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/package.html
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/package.html	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/package.html	(revision 1235)
@@ -0,0 +1,457 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<!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.tools.locator package documentation</title>
+</head>
+<body>
+
+<p>Proporciona una implementación base del patrón Locator, así como un mecanismo 
+de inicialización que permita registrar las implementaciones que aporte en su 
+Locator cada módulo o librería.</p>
+
+<p>Se ha creado un interfaz {@link org.gvsig.tools.locator.Locator}, que define
+ los métodos de uso general del Locator, así como una implementación abstracta, 
+ {@link org.gvsig.tools.locator.AbstractLocator} basada en el uso de los puntos 
+ de extensión:</p>
+
+<h2>Locator</h2>
+
+<p>El interfaz del <em>Locator</em> se han definido métodos que permiten 
+registrar clases, o factorías, así cómo obtener instancias de los mismos.
+Hay que tener en cuenta que el comportamiento del Locator no es como factoría, 
+es decir, se espera que el método <em>get</em> devuelva cada vez la misma 
+instancia de objeto. Es decir, actúa como un contenedor de referencias a 
+objetos que funcionan como <em>Singleton</em>.</p>
+
+<p>La implementación abstracta la aporta la clase 
+{@link org.gvsig.tools.locator.AbstractLocator}. 
+La idea es que cada librería implemente su <em>Locator</em> extendiendo 
+esta clase, y aportando métodos que registren y obtengan referencias a 
+sus tipos de objetos directamente. Más adelante, se muestra un ejemplo 
+de implementación que aporta este tipo de métodos. Además, cada implementación
+de <em>Locator</em> deberá hacerse empleando el patrón <em>Singleton</em>, 
+para facilitar el acceso al <em>Locator</em>.</p>
+
+<p>Las librerías de gvSIG deberán usar el Locator en los siguientes casos:</p>
+
+<ul class="simple">
+<li>Para soportar implementaciones alternativas: como por ejemplo para Java SE
+y Java ME, o cuando haya una implementación básica, y el usuario pueda instalar 
+una implementación extendida.</li>
+<li>Para soportar múltiples implementaciones: si existen distintas 
+implementaciones para un mismo interfaz o componente, que se usan dependiendo 
+de distintas opciones, como acciones del usuario, tipos de datos, etc.</li>
+</ul>
+
+<h2>Library</h2>
+
+<p>Con el mecanismo de los <em>Locator</em> queda un tema pendiente por 
+resolver: cúando se realiza el registro e inicialización de los objetos. 
+Dado que podemos tener una serie de relaciones de dependencia entre distintas 
+librerías que empleen el mecanismo de los Locator, así como éstas con las 
+Extensiones, es necesario que se registren todas las implementaciones antes 
+de que se usen dentro de la aplicación.</p>
+
+<p>Para ello se ha definido el <em>Library</em>. Los objetos de este tipo se 
+encargarán de registrar las implementaciones disponibles a través de los 
+<em>Locator</em>, así como de validar que, para una librería de tipo API, 
+se haya registrado alguna implementación.</p>
+
+<p>Se define un interfaz {@link org.gvsig.tools.locator.Library} con dos 
+métodos que permitan realizar las acciones planteadas anteriormente</p> 
+
+<p>Se ha empleado la misma nomenclatura que en las Extensiones de gvSIG, 
+ya que cada uno de los métodos de un Library se invocará desde una 
+Extensión, en el método correspondiente. Es decir, primero se invocan 
+todos los métodos <em>initialize()</em> de las extensiones, y desde 
+estos los de las librerías, y luego los métodos <em>postInitialize()</em></p>
+<p>Cada librería que emplee el mecanismo del <em>Locator</em> deberá 
+implementar un <em>Library</em>, y aportar una extensión de gvSIG que
+se encargue de invocarla. Distinguiremos dos tipos de librería 
+(aunque pueden coincidir en algunos casos con sublibrerías): librerías 
+de API y librerías de implementación.</p>
+
+<dl class="docutils">
+<dt>Librerías de API:</dt>
+<dd>Su <em>Library</em> implementará el método <em>postInitialize()</em>, 
+dentro del cuál se hará la comprobación de que alguna implementación 
+haya sido registrada.</dd>
+
+<dt>Librerías de implementación:</dt>
+<dd>El <em>Library</em>, en su método <em>initialize()</em>, se 
+encargará de registrar las implementaciones que aporta la librería a 
+través del locator de su correspondiente librería de API.</dd>
+</dl>
+
+<p>En ambos casos, los métodos del <em>Library</em> también podrán 
+ser usados para realizar otros tipos de inicializaciones, como definir 
+variables de librería, cargar configuraciones, obtener recursos, etc.</p>
+
+<p>Se ha creado una clase <em>org.gvsig.locator.BaseLibrary</em> que 
+facilita la implementación, al tener implementados ya los métodos, 
+aunque sólo para hacer logging. Si la librería es de tipo API o 
+implementación, bastará con implementar uno de los dos métodos.</p>
+
+<h3>Ejemplos</h3>
+<p>A continuación se plantea un ejemplo, basado en la librería 
+<em>libCompat</em>. Esta librería plantea el caso de implementaciones 
+alternativas para Java SE y Java ME, por lo que requerirá una estructura 
+de proyectos que permita organizar la librería en tres componentes de 
+instalación:</p>
+
+<dl class="docutils">
+<dt>libCompat:</dt>
+<dd>Será la librería de API. Contendrá los APIs de la librería, en 
+forma de interfaces de las distintas utilidades que aporta (StringUtils, 
+FileUtils, etc.), así como un <em>CompatLocator</em> que dé acceso a 
+las implementaciones correspondientes de dichas utilidades. También 
+puede contener algunas implementaciones Base o Abstractas, que se 
+empleen de forma común en las implementaciones por entorno.</dd>
+
+<dt>libCompatSE:</dt>
+<dd>Incluirá las implementaciones para Java SE.</dd>
+
+<dt>libCompatME:</dt>
+<dd>Proporciona las implementaciones para Java ME.</dd>
+</dl>
+
+<p>A continuación se muestran ejemplos de código, centrándonos en 
+el uso de una de las utilidades de <em>libCompat</em>: <em>StringUtils</em>.
+</p>
+
+<p>Primero, en <em>libCompat</em> se incluirá la definición del interfaz de 
+<em>StringUtils</em>:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">interface</span> StringUtils <span style="color: rgb(102, 102, 102);">{</span>
+
+    String<span style="color: rgb(102, 102, 102);">[]</span> split<span style="color: rgb(102, 102, 102);">(</span>String input<span style="color: rgb(102, 102, 102);">,</span> String regex<span style="color: rgb(102, 102, 102);">);</span>
+
+    <span style="color: rgb(102, 102, 102);">...</span>
+
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>En <em>libCompatSE</em>, tendremos una implementación:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>se<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">.</span>StringUtils<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">StandardStringUtils</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">implements</span> StringUtils <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> String<span style="color: rgb(102, 102, 102);">[]</span> split<span style="color: rgb(102, 102, 102);">(</span>String input<span style="color: rgb(102, 102, 102);">,</span> String regex<span style="color: rgb(102, 102, 102);">)</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> input <span style="color: rgb(102, 102, 102);">==</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">null</span> <span style="color: rgb(102, 102, 102);">?</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">null</span> <span style="color: rgb(102, 102, 102);">:</span> input<span style="color: rgb(102, 102, 102);">.</span>split<span style="color: rgb(102, 102, 102);">(</span>regex<span style="color: rgb(102, 102, 102);">);</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    <span style="color: rgb(102, 102, 102);">...</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>En <em>libCompatME</em>, la implementación alternativa:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>me<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> java<span style="color: rgb(102, 102, 102);">.</span>util<span style="color: rgb(102, 102, 102);">.</span>regex<span style="color: rgb(102, 102, 102);">.</span>Pattern<span style="color: rgb(102, 102, 102);">;</span>
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">.</span>StringUtils<span style="color: rgb(102, 102, 102);">;</span>    
+
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">MobileStringUtils</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">implements</span> StringUtils <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> String<span style="color: rgb(102, 102, 102);">[]</span> split<span style="color: rgb(102, 102, 102);">(</span>String input<span style="color: rgb(102, 102, 102);">,</span> String regex<span style="color: rgb(102, 102, 102);">)</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> input <span style="color: rgb(102, 102, 102);">==</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">null</span> <span style="color: rgb(102, 102, 102);">?</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">null</span> <span style="color: rgb(102, 102, 102);">:</span> Pattern<span style="color: rgb(102, 102, 102);">.</span>compile<span style="color: rgb(102, 102, 102);">(</span>regex<span style="color: rgb(102, 102, 102);">).</span>split<span style="color: rgb(102, 102, 102);">(</span>input<span style="color: rgb(102, 102, 102);">,</span> <span style="color: rgb(102, 102, 102);">0);</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    <span style="color: rgb(102, 102, 102);">...</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>Con este esquema, las implementaciones no incorporan nada en lo que respecta
+a cómo se crean o se obtienen, lo que mejora su extensibilidad y la creación 
+de tests unitarios. Además, se facilita la programación con interfaces y la 
+definición de APIs.</p>
+
+<p>En <em>libCompat</em> tenemos la implementación del <em>Locator</em> de la 
+librería, que quedaría como sigue:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">.</span>StringUtils<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">CompatLocator</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> AbstractLocator <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(0, 136, 0); font-style: italic;">/** The name of the StringUtils reference. */</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">final</span> String STRINGUTILS_NAME <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"StringUtils"</span><span style="color: rgb(102, 102, 102);">;</span>
+
+    
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">private</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">final</span> String LOCATOR_NAME <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"CompatLocator"</span><span style="color: rgb(102, 102, 102);">;</span>
+
+    <span style="color: rgb(0, 136, 0); font-style: italic;">/** Unique instance. */</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">private</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">final</span> CompatLocator instance <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">new</span> CompatLocator<span style="color: rgb(102, 102, 102);">();</span>
+
+    <span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * Return the singleton instance.</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * @return the singleton instance</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     */</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> CompatLocator getInstance<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> instance<span style="color: rgb(102, 102, 102);">;</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    <span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * Return a reference to StringUtils.</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * @return a reference to StringUtils</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * @throws LocatorException</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     *             if there is no access to the class or the class cannot be</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     *             instantiated</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * @see Locator#get(String)</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     */</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> StringUtils <span style="color: rgb(0, 160, 0);">getStringUtils</span><span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">throws</span> LocatorException <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> <span style="color: rgb(102, 102, 102);">(</span>StringUtils<span style="color: rgb(102, 102, 102);">)</span> getInstance<span style="color: rgb(102, 102, 102);">().</span>get<span style="color: rgb(102, 102, 102);">(</span>STRINGUTILS_NAME<span style="color: rgb(102, 102, 102);">);</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    
+    <span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * Registers the Class implementing the StringUtils interface.</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     * @param clazz</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     *            implementing the StringUtils interface</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;">     */</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">static</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> registerStringUtils<span style="color: rgb(102, 102, 102);">(</span>Class clazz<span style="color: rgb(102, 102, 102);">)</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        getInstance<span style="color: rgb(102, 102, 102);">()</span>
+          <span style="color: rgb(102, 102, 102);">.</span>register<span style="color: rgb(102, 102, 102);">(</span>STRINGUTILS_NAME<span style="color: rgb(102, 102, 102);">,</span> STRINGUTILS_DESCRIPTION<span style="color: rgb(102, 102, 102);">,</span> clazz<span style="color: rgb(102, 102, 102);">);</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">protected</span> String getLocatorName<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> LOCATOR_NAME<span style="color: rgb(102, 102, 102);">;</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>En esta implementación de Locator, se han añadido métodos estáticos que 
+facilitan el uso del mismo, y manejan referencias de los tipos de la librería 
+en concreto, como el <em>StringUtils</em>. Así, por ejemplo, los clientes no 
+tienen porqué usar el método <em>get(name)</em> genérico del <em>Locator</em>, 
+sino que pueden usar un método <em>getStringUtils()</em> directamente.</p>
+
+<p>Una clase cliente que quiera usar, por ejemplo, el <em>StringUtils</em>, 
+podrá hacerlo de la siguiente forma:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">SampleClient</span> <span style="color: rgb(102, 102, 102);">{</span>
+  <span style="color: rgb(170, 34, 255); font-weight: bold;">private</span> StringUtils stringUtils <span style="color: rgb(102, 102, 102);">=</span> CompatLocator<span style="color: rgb(102, 102, 102);">.</span>getStringUtils<span style="color: rgb(102, 102, 102);">();</span>
+
+  <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> doSomething<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+     String text <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"one,two,three"</span><span style="color: rgb(102, 102, 102);">;</span>
+
+     String<span style="color: rgb(102, 102, 102);">[]</span> words <span style="color: rgb(102, 102, 102);">=</span> stringUtils<span style="color: rgb(102, 102, 102);">.</span>split<span style="color: rgb(102, 102, 102);">(</span>text<span style="color: rgb(102, 102, 102);">,</span> <span style="color: rgb(187, 68, 68);">","</span><span style="color: rgb(102, 102, 102);">);</span>
+
+  
+     <span style="color: rgb(102, 102, 102);">...</span>
+  <span style="color: rgb(102, 102, 102);">}</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>En cuanto a las librerías, <em>libCompatSE</em> y <em>libCompatME</em> 
+tendrán cada una su <em>Library</em> que registre la implementación 
+correspondiente de StringUtils.</p>
+
+<p>SECompatLibrary:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>se<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>CompatLocator<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * Initialization of the libCompat library, Java Standard Edition</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * implementation.</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * @author &lt;a href="mailto:cordin@disid.com"&gt;Cèsar Ordiñana&lt;/a&gt;</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> */</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">SECompatLibrary</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> BaseLibrary <span style="color: rgb(102, 102, 102);">{</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> initialize<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">super</span><span style="color: rgb(102, 102, 102);">.</span>initialize<span style="color: rgb(102, 102, 102);">();</span>
+        CompatLocator<span style="color: rgb(102, 102, 102);">.</span>registerStringUtils<span style="color: rgb(102, 102, 102);">(</span>StandardStringUtils<span style="color: rgb(102, 102, 102);">.</span>class<span style="color: rgb(102, 102, 102);">);</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>MECompatLibrary:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>me<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>CompatLocator<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * Initialization of the libCompat library, Java Mobile Edition implementation.</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * @author &lt;a href="mailto:cordin@disid.com"&gt;Cèsar Ordiñana&lt;/a&gt;</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> */</span>
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">MECompatLibrary</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> BaseLibrary <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> initialize<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">super</span><span style="color: rgb(102, 102, 102);">.</span>initialize<span style="color: rgb(102, 102, 102);">();</span>
+        CompatLocator<span style="color: rgb(102, 102, 102);">.</span>registerStringUtils<span style="color: rgb(102, 102, 102);">(</span>MobileStringUtils<span style="color: rgb(102, 102, 102);">.</span>class<span style="color: rgb(102, 102, 102);">);</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p>La librería de API <em>libCompat</em>, tiene un Library que comprueba si se 
+ha registrado alguna de las implementaciones:</p>
+
+<p>CompatLibrary:</p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">package</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(170, 34, 255); font-weight: bold;">import</span> org<span style="color: rgb(102, 102, 102);">.</span>gvsig<span style="color: rgb(102, 102, 102);">.</span>compat<span style="color: rgb(102, 102, 102);">.</span>lang<span style="color: rgb(102, 102, 102);">.</span>StringUtils<span style="color: rgb(102, 102, 102);">;</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;">/**</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * Initialization of the libCompat library.</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> * @author &lt;a href="mailto:cordin@disid.com"&gt;Cèsar Ordiñana&lt;/a&gt;</span>
+<span style="color: rgb(0, 136, 0); font-style: italic;"> */</span>
+<span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">CompatLibrary</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> BaseLibrary <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> postInitialize<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">super</span><span style="color: rgb(102, 102, 102);">.</span>postInitialize<span style="color: rgb(102, 102, 102);">();</span>
+        <span style="color: rgb(0, 136, 0); font-style: italic;">// Validate there is any implementation registered.</span>
+
+<span style="color: rgb(0, 136, 0); font-style: italic;"></span>        StringUtils stringUtils <span style="color: rgb(102, 102, 102);">=</span> CompatLocator<span style="color: rgb(102, 102, 102);">.</span>getStringUtils<span style="color: rgb(102, 102, 102);">();</span>
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">if</span> <span style="color: rgb(102, 102, 102);">(</span>stringUtils <span style="color: rgb(102, 102, 102);">==</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">null</span><span style="color: rgb(102, 102, 102);">)</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+            <span style="color: rgb(170, 34, 255); font-weight: bold;">throw</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">new</span> ReferenceNotRegisteredException<span style="color: rgb(102, 102, 102);">(</span>CompatLocator<span style="color: rgb(102, 102, 102);">.</span>STRINGUTILS_NAME<span style="color: rgb(102, 102, 102);">,</span>
+                CompatLocator<span style="color: rgb(102, 102, 102);">.</span>getInstance<span style="color: rgb(102, 102, 102);">());</span>
+
+        <span style="color: rgb(102, 102, 102);">}</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<h2>Tests Unitarios</h2>
+
+<p>Dado que con el uso de los Locator estamos reforzando el uso de interfaces, 
+y la separación de implementaciones alternativas u opcionales, podemos 
+aprovechar esto a la hora de realizar los tests unitarios.</p>
+
+<p>La forma de aprovecharlo consiste en crear los tests unitarios que 
+comprueben el funcionamiento correcto a nivel de API, dentro del proyecto que 
+incluya la definición de los interfaces. Dichos tests pueden crearse como 
+clases abstractas, que definan métodos para crear los objetos que implementan 
+los interfaces a probar. Así, cada implementación particular podrá crear sus 
+tests unitarios, símplemente heredando de los tests del API, e implementando 
+el método de creación de sus clases propias.</p>
+
+<p>Con esta estructura de tests unitarios podemos definir los tests unitarios 
+a nivel de API, y lanzarlos de forma sencilla para cada implementación.</p>
+
+<p>Basándonos en el ejemplo anterior, la distribución de tests unitarios 
+quedaría de la siguiente forma en las tres librerías del ejemplo:</p>
+
+<p><em>libCompat:</em></p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">abstract</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">StringUtilsTestAbstract</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> TestCase <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">private</span> StringUtils utils<span style="color: rgb(102, 102, 102);">;</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">protected</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> <span style="color: rgb(0, 160, 0);">setUp</span><span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">throws</span> Exception <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">super</span><span style="color: rgb(102, 102, 102);">.</span>setUp<span style="color: rgb(102, 102, 102);">();</span>
+        utils <span style="color: rgb(102, 102, 102);">=</span> createUtils<span style="color: rgb(102, 102, 102);">();</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">protected</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">abstract</span> StringUtils createUtils<span style="color: rgb(102, 102, 102);">();</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">void</span> testReplaceAll<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        String testString <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"En un lugar de la Mancha"</span><span style="color: rgb(102, 102, 102);">;</span>
+        String resultString <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"En_un_lugar_de_la_Mancha"</span><span style="color: rgb(102, 102, 102);">;</span>
+        String regex <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">" "</span><span style="color: rgb(102, 102, 102);">;</span>
+
+        String replacement <span style="color: rgb(102, 102, 102);">=</span> <span style="color: rgb(187, 68, 68);">"_"</span><span style="color: rgb(102, 102, 102);">;</span>
+
+        assertEquals<span style="color: rgb(102, 102, 102);">(</span>resultString<span style="color: rgb(102, 102, 102);">,</span> 
+            utils<span style="color: rgb(102, 102, 102);">.</span>replaceAll<span style="color: rgb(102, 102, 102);">(</span>testString<span style="color: rgb(102, 102, 102);">,</span> regex<span style="color: rgb(102, 102, 102);">,</span> replacement<span style="color: rgb(102, 102, 102);">));</span>
+
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p><em>libCompatSE:</em></p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">StandardStringUtilsTest</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> StringUtilsTestAbstract <span style="color: rgb(102, 102, 102);">{</span>
+
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">protected</span> StringUtils createUtils<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">new</span> StandardStringUtils<span style="color: rgb(102, 102, 102);">();</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<p><em>libCompatME:</em></p>
+
+<div class="highlight"><pre><span style="color: rgb(170, 34, 255); font-weight: bold;">public</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">class</span> <span style="color: rgb(0, 0, 255);">MobileStringUtilsTest</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">extends</span> StringUtilsTestAbstract <span style="color: rgb(102, 102, 102);">{</span>
+    <span style="color: rgb(170, 34, 255); font-weight: bold;">protected</span> StringUtils createUtils<span style="color: rgb(102, 102, 102);">()</span> <span style="color: rgb(102, 102, 102);">{</span>
+
+        <span style="color: rgb(170, 34, 255); font-weight: bold;">return</span> <span style="color: rgb(170, 34, 255); font-weight: bold;">new</span> MobileStringUtils<span style="color: rgb(102, 102, 102);">();</span>
+    <span style="color: rgb(102, 102, 102);">}</span>
+<span style="color: rgb(102, 102, 102);">}</span>
+</pre></div>
+
+<h2>Notas adicionales</h2>
+
+<ul>
+<li><p class="first">Las excepciones del Locator y del Library son de tipo 
+<em>RuntimeException</em> por lo que, aunque declaradas en su API, no obligan 
+a ser capturadas mediante un <em>try ... catch</em>. A nivel de aplicación, si
+que habrá que hacer un tratamiento de estas excepciones, para mostrar al 
+usuario algún tipo de información sobre el error producido.</p>
+<p>No se han definido excepciones normales, ya que son errores graves y no se 
+puedan tratar desde código. Así no obligamos a capturarlas en cada lugar dónde 
+se use un <em>Locator</em> o <em>Library</em>, y se pueden tratar en un nivel 
+superior.</p>
+</li>
+</ul>
+
+</body>
+</html>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLocator.java	(revision 1235)
@@ -0,0 +1,541 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools;
+
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dispose.DisposableManager;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.extensionpoint.impl.DefaultExtensionPointManager;
+import org.gvsig.tools.firewall.FirewallConfiguration;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.identitymanagement.SimpleIdentityManager;
+import org.gvsig.tools.locator.AbstractLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+import org.gvsig.tools.operations.OperationManager;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.task.TaskStatusManager;
+import org.gvsig.tools.util.ServiceLoader;
+import org.gvsig.tools.util.impl.DefaultServiceLoader;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.v1.XmlSerializer;
+
+public class ToolsLocator extends AbstractLocator {
+
+	private static final String LOCATOR_NAME = "ToolsLocator";
+
+	public static final String PERSISTENCE_MANAGER_NAME =
+			"org.gvsig.tools.persistence.manager";
+
+	private static final String PERSISTENCE_MANAGER_DESCRIPTION =
+			"Persistence Manager of gvSIG";
+
+	public static final String OPERATION_MANAGER_NAME =
+			"org.gvsig.tools.operation.manager";
+
+	private static final String OPERATION_MANAGER_DESCRIPTION =
+			"Operation Manager of gvSIG";
+
+	public static final String DYNOBJECT_MANAGER_NAME =
+			"org.gvsig.tools.dynobject.manager";
+
+	private static final String DYNOBJECT_MANAGER_DESCRIPTION =
+			"DynObject Manager of gvSIG";
+
+	public static final String DISPOSABLE_MANAGER_NAME =
+			"org.gvsig.tools.dispose.manager";
+
+	private static final String DISPOSABLE_MANAGER_DESCRIPTION =
+		"Disposable Manager";
+
+	public static final String DATATYPES_MANAGER_NAME =
+		"org.gvsig.tools.datatypes.manager";
+
+	private static final String DATATYPES_MANAGER_DESCRIPTION =
+		"Datatypes Manager";
+
+	public static final String SERVICE_LOADER_NAME =
+			"org.gvsig.tools.service.loader";
+
+	private static final String SERVICE_LOADER_DESCRIPTION =
+			"Default Service Loader";
+
+	public static final String I18N_MANAGER_NAME =
+		"org.gvsig.tools.i18n.manager";
+
+	private static final String I18N_MANAGER_DESCRIPTION =
+		"Default I18n Manager";
+
+	public static final String TASKSTATUS_MANAGER_NAME =
+		"org.gvsig.tools.taststatus.manager";
+
+	private static final String TASKSTATUS_MANAGER_DESCRIPTION =
+		"Default Tast Status Manager";
+
+	public static final String PACKAGE_MANAGER_NAME =
+			"org.gvsig.tools.package.manager";
+
+	private static final String PACKAGE_MANAGER_DESCRIPTION =
+			"Default Package Manager";
+
+    public static final String IDENTITY_MANAGER_NAME =
+			"org.gvsig.tools.identity.manager";
+
+	private static final String IDENTITY_MANAGER_DESCRIPTION =
+			"Default Identity Manager";
+
+    public static final String FIREWALL_MANAGER_NAME =
+			"org.gvsig.tools.firewall.manager";
+
+	private static final String FIREWALL_MANAGER_DESCRIPTION =
+			"Default Firewall Manager";
+/**
+	 * Unique instance.
+	 */
+	private static final ToolsLocator instance = new ToolsLocator();
+
+	// Comma list of xml pull parser factories, parsers or serializers
+	private String xmlPullParserFactoryClassNames = ""
+			+ "org.xmlpull.mxp1.MXParserFactory," + // MXP1 (XPP3) factory
+			"org.kxml2.io.KXmlParser," + // KXML2 parser
+			"org.kxml2.io.KXmlSerializer"; // KXML2 serializer
+
+	private ToolsLocator() {
+		// Register default ServiceLoader
+		registerDefault(SERVICE_LOADER_NAME, SERVICE_LOADER_DESCRIPTION,
+				DefaultServiceLoader.class);
+	}
+
+	/**
+	 * Return the singleton instance.
+	 *
+	 * @return the singleton instance
+	 */
+	public static ToolsLocator getInstance() {
+		return instance;
+	}
+
+	public String getLocatorName() {
+		return LOCATOR_NAME;
+	}
+
+	/**
+	 * Return a reference to PersistenceManager.
+	 *
+	 * @return a reference to PersistenceManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static PersistenceManager getPersistenceManager()
+			throws LocatorException {
+		return (PersistenceManager) getInstance().get(PERSISTENCE_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the PersistenceManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the PersistenceManager interface
+	 */
+	public static void registerPersistenceManager(Class clazz) {
+		getInstance().register(PERSISTENCE_MANAGER_NAME,
+				PERSISTENCE_MANAGER_DESCRIPTION, clazz);
+	}
+
+	public static void registerDefaultPersistenceManager(Class clazz) {
+		getInstance().registerDefault(PERSISTENCE_MANAGER_NAME,
+				PERSISTENCE_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to OperationManager.
+	 *
+	 * @return a reference to OperationManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static OperationManager getOperationManager()
+			throws LocatorException {
+		return (OperationManager) getInstance().get(OPERATION_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the OperationManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the OperationManager interface
+	 */
+	public static void registerOperationManager(Class clazz) {
+		getInstance().register(OPERATION_MANAGER_NAME,
+				OPERATION_MANAGER_DESCRIPTION, clazz);
+	}
+
+	public static void registerDefaultOperationManager(Class clazz) {
+		getInstance().registerDefault(OPERATION_MANAGER_NAME,
+				OPERATION_MANAGER_DESCRIPTION, clazz);
+	}
+
+	public static ExtensionPointManager getExtensionPointManager() {
+		return DefaultExtensionPointManager.getManager();
+	}
+
+	/**
+	 * Return a reference to DynObjectManager.
+	 *
+	 * @return a reference to DynObjectManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DynObjectManager getDynObjectManager()
+			throws LocatorException {
+		return (DynObjectManager) getInstance().get(DYNOBJECT_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the DynObjectManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link DynObjectManager} interface
+	 */
+	public static void registerDynObjectManager(Class clazz) {
+		getInstance().register(DYNOBJECT_MANAGER_NAME,
+				DYNOBJECT_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to DisposableManager.
+	 *
+	 * @return a reference to {@link DisposableManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DisposableManager getDisposableManager()
+			throws LocatorException {
+		return (DisposableManager) getInstance().get(DISPOSABLE_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the DisposableManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link DisposableManager} interface
+	 */
+	public static void registerDisposableManager(Class clazz) {
+		getInstance().register(DISPOSABLE_MANAGER_NAME,
+				DISPOSABLE_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link ServiceLoader}.
+	 *
+	 * @return a reference to {@link ServiceLoader}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static ServiceLoader getServiceLoader() throws LocatorException {
+		return (ServiceLoader) getInstance().get(SERVICE_LOADER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the {@link ServiceLoader} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link ServiceLoader} interface
+	 */
+	public static void registerServiceLoader(Class clazz) {
+		getInstance().register(SERVICE_LOADER_NAME, SERVICE_LOADER_DESCRIPTION,
+				clazz);
+	}
+
+	/**
+	 * Return a reference to {@link I18nManager}.
+	 *
+	 * @return a reference to {@link I18nManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static I18nManager getI18nManager() throws LocatorException {
+		return (I18nManager) getInstance().get(I18N_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the {@link I18nManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link I18nManager} interface
+	 */
+	public static void registerI18nManager(Class clazz) {
+		getInstance().register(I18N_MANAGER_NAME, I18N_MANAGER_DESCRIPTION,
+				clazz);
+	}
+
+	/**
+	 * Registers the default Class implementing the {@link I18nManager}
+	 * interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link I18nManager} interface
+	 */
+	public static void registerDefaultI18nManager(Class clazz) {
+		getInstance().registerDefault(I18N_MANAGER_NAME,
+				I18N_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Registers the Class implementing the DataTypesManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link DataTypesManag} interface
+	 */
+	public static void registerDataTypesManager(Class clazz) {
+		getInstance().register(DATATYPES_MANAGER_NAME,
+				DATATYPES_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Registers the default Class implementing the DataTypesManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link DataTypesManager} interface
+	 */
+	public static void registerDefaultDataTypesManager(Class clazz) {
+		getInstance().registerDefault(DATATYPES_MANAGER_NAME,
+				DATATYPES_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link DataTypesManager}.
+	 *
+	 * @return a reference to {@link DataTypesManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DataTypesManager getDataTypesManager()
+			throws LocatorException {
+		return (DataTypesManager) getInstance().get(DATATYPES_MANAGER_NAME);
+	}
+
+	/**
+	 * Returns the comma separated list of XmlPullParserFactory, XmlPullParser
+	 * or XmlSerializer implementations to be used.
+	 * <p>
+	 * This parameter must be passed to the {@link XmlPullParserFactory} class
+	 * to get an instance of the factory with an available implementation. That
+	 * class will use the list to try to instance the classes included, and will
+	 * use the first one available in the list order.
+	 * </p>
+	 * <p>
+	 * <strong>Example getting an {@link XmlPullParser}:</strong>
+	 *
+	 * <pre>
+	 * XmlPullParserFactory factory = XmlPullParserFactory.newInstance(ToolsLocator
+	 * 		.getInstance().getXmlPullParserFactoryClassNames(), null);
+	 *
+	 * XmlPullParser xpp = factory.newPullParser();
+	 * </pre>
+	 *
+	 * </p>
+	 * <p>
+	 * <strong>Example getting an {@link XmlSerializer}:</strong>
+	 *
+	 * <pre>
+	 * XmlPullParserFactory factory = XmlPullParserFactory.newInstance(ToolsLocator
+	 * 		.getInstance().getXmlPullParserFactoryClassNames(), null);
+	 *
+	 * XmlSerializer serializer = factory.newSerializer();
+	 * </pre>
+	 *
+	 * </p>
+	 *
+	 * @return the xmlPullParserFactoryClassNames
+	 * @see XmlPullParserFactory#newInstance(String, Class).
+	 */
+	public String getXmlPullParserFactoryClassNames() {
+		return xmlPullParserFactoryClassNames;
+	}
+
+	/**
+	 * Sets a comma separated list of XmlPullParserFactory, XmlPullParser or
+	 * XmlSerializer implementations to be used.
+	 *
+	 * @param xmlPullParserFactoryClassNames
+	 *            the comma separated list of XmlPullParserFactory class name
+	 */
+	public void setXmlPullParserFactoryClassNames(
+			String xmlPullParserFactoryClassNames) {
+		this.xmlPullParserFactoryClassNames = xmlPullParserFactoryClassNames;
+	}
+
+	/**
+	 * Registers the Class implementing the {@link TaskStatusManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link TaskStatusManager} interface
+	 */
+	public static void registerTaskStatusManager(Class clazz) {
+		getInstance().register(TASKSTATUS_MANAGER_NAME,
+				TASKSTATUS_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Registers the default Class implementing the {@link TaskStatusManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link TaskStatusManager} interface
+	 */
+	public static void registerDefaultTaskStatusManager(Class clazz) {
+		getInstance().registerDefault(TASKSTATUS_MANAGER_NAME,
+				TASKSTATUS_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link TaskStatusManager}.
+	 *
+	 * @return a reference to {@link TaskStatusManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static TaskStatusManager getTaskStatusManager()
+			throws LocatorException {
+		return (TaskStatusManager) getInstance().get(TASKSTATUS_MANAGER_NAME);
+	}
+
+
+
+	/**
+	 * Registers the Class implementing the {@link PackageManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link PackageManager} interface
+	 */
+	public static void registerPackageManager(Class clazz) {
+		getInstance().register(PACKAGE_MANAGER_NAME,
+				PACKAGE_MANAGER_DESCRIPTION, clazz);
+	}
+	/**
+	 * Registers the default Class implementing the {@link PackageManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link PackageManager} interface
+	 */
+	public static void registerDefaultPackageManager(Class clazz) {
+		getInstance().registerDefault(PACKAGE_MANAGER_NAME,
+				PACKAGE_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link PackageManager}.
+	 *
+	 * @return a reference to {@link PackageManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static PackageManager getPackageManager()
+			throws LocatorException {
+		return (PackageManager) getInstance().get(PACKAGE_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the {@link SimpleIdentityManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link SimpleIdentityManager} interface
+	 */
+	public static void registerIdentityManager(Class clazz) {
+		getInstance().register(IDENTITY_MANAGER_NAME,
+				IDENTITY_MANAGER_DESCRIPTION, clazz);
+	}
+	/**
+	 * Registers the default Class implementing the {@link SimpleIdentityManager} interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link SimpleIdentityManager} interface
+	 */
+	public static void registerDefaultIdentityManager(Class clazz) {
+		getInstance().registerDefault(IDENTITY_MANAGER_NAME,
+				IDENTITY_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link SimpleIdentityManager}.
+	 *
+	 * @return a reference to {@link SimpleIdentityManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static SimpleIdentityManager getIdentityManager()
+			throws LocatorException {
+		return (SimpleIdentityManager) getInstance().get(IDENTITY_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the default Class implementing the FirewallManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the {@link FirewallManager} interface
+	 */
+	public static void registerDefaultFirewallManager(Class clazz) {
+		getInstance().registerDefault(FIREWALL_MANAGER_NAME,
+				FIREWALL_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to {@link FirewallManager}.
+	 *
+	 * @return a reference to {@link FirewallManager}
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static FirewallConfiguration getFirewallManager()
+			throws LocatorException {
+		return (FirewallConfiguration) getInstance().get(FIREWALL_MANAGER_NAME);
+	}
+
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibraryException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibraryException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibraryException.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.library;
+
+import java.util.List;
+
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.exception.ListBaseException;
+
+/**
+ * Exception for errors in the initialization of a Library.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class LibraryException extends BaseRuntimeException {
+
+	private static final long serialVersionUID = 4041519920390133009L;
+
+	private static final String KEY = "library_exception";
+
+	private static final String MESSAGE = "Error in the initialization of the Library: %(library)";
+
+	private static class ListExceptions extends ListBaseException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = -1621810010494819633L;
+		
+		public ListExceptions(List causes) {
+			super(MESSAGE, KEY, serialVersionUID);
+			this.addAll(causes);
+		}
+
+	}
+	
+	/**
+	 * Creates a new exception from a cause exception.
+	 * 
+	 * @param cause
+	 *            the original cause exception
+	 */
+	public LibraryException(String library, Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+		setValue("library", library);
+	}
+
+	/**
+	 * Creates a new exception from a cause exception.
+	 * 
+	 * @param cause
+	 *            the original cause exception
+	 */
+	public LibraryException(Class libraryClass, Throwable cause) {
+		this(libraryClass.getName(), cause);
+	}
+
+	public LibraryException(Class libraryClass, ListBaseException causes) {
+		this(libraryClass.getName(), causes);
+	}
+
+	public LibraryException(Class libraryClass, List causes) {
+		this(libraryClass.getName(), new ListExceptions(causes));
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrariesInitializer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrariesInitializer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrariesInitializer.java	(revision 1235)
@@ -0,0 +1,392 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.library;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.library.AbstractLibrary.Required;
+
+/**
+ * Base implementation of an {@link LibrariesInitializer} with the
+ * initialization of Libraries already implemented, delegating on child classes
+ * the finding of available {@link Library} objects.
+ * <p>
+ * This class is NOT thread safe.
+ * </p>
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class AbstractLibrariesInitializer implements
+    LibrariesInitializer, Library.TYPE {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(AbstractLibrariesInitializer.class);
+
+    private Collection libs;
+
+    private boolean libsLoaded = false;
+
+    private final ClassLoader[] classLoaders;
+
+    public AbstractLibrariesInitializer() {
+        classLoaders = null;
+    }
+
+    public AbstractLibrariesInitializer(ClassLoader classLoader) {
+        this(new ClassLoader[] { classLoader });
+    }
+
+    public AbstractLibrariesInitializer(ClassLoader[] classLoaders) {
+        this.classLoaders = classLoaders;
+    }
+
+    public void initialize() {
+        this.initialize(false);
+    }
+
+    public void initialize(boolean ignoreerrors) {
+        if (!libsLoaded) {
+            loadLibraries(classLoaders, ignoreerrors);
+            libsLoaded = true;
+        }
+        if (libs != null && libs.size() > 0) {
+            // Call all initialize()
+            initializeLibraries(libs, false, ignoreerrors);
+        }
+    }
+
+    public void postInitialize() {
+        this.postInitialize(false);
+    }
+
+    public void postInitialize(boolean ignoreerrors) {
+        if (!libsLoaded) {
+            loadLibraries(classLoaders, ignoreerrors);
+            libsLoaded = true;
+        }
+        if (libs != null && libs.size() > 0) {
+            // Call all postInitialize()
+            initializeLibraries(libs, true, ignoreerrors);
+        }
+    }
+
+    public void fullInitialize() {
+        initialize();
+        postInitialize();
+    }
+
+    public void fullInitialize(boolean ignoreerrors) {
+        initialize(ignoreerrors);
+        postInitialize(ignoreerrors);
+    }
+
+    public List getLibraries() {
+        if (!libsLoaded) {
+            loadLibraries(classLoaders, false);
+            libsLoaded = true;
+        }
+
+        return new ArrayList(this.libs);
+    }
+
+    private void loadLibraries(ClassLoader[] classLoaders, boolean ignoreerrors) {
+        // Find the available Library instances
+        Set libs = new HashSet();
+        LOG.info("Loading libraries of classloaders:");
+        if (classLoaders == null) {
+            addLibrariesOfClassLoader(libs, null, ignoreerrors);
+        } else {
+            for (int i = 0; i < classLoaders.length; i++) {
+                addLibrariesOfClassLoader(libs, classLoaders[i], ignoreerrors);
+            }
+        }
+
+        int fullSize = libs.size();
+        this.libs = new OrderedLibs(libs);
+
+        if (LOG.isInfoEnabled()) {
+            logLibraries(this.libs, fullSize);
+        }
+    }
+
+    private void addLibrariesOfClassLoader(Set previousFoundLibs,
+        ClassLoader classLoader, boolean ignoreerrors) {
+        StringBuffer logBuf = new StringBuffer();
+        Library library = null;
+        try {
+            Set foundLibs = findLibraries(Library.class, classLoader);
+            foundLibs.removeAll(previousFoundLibs);
+            logBuf
+                .append(new Integer(foundLibs.size()))
+                .append(" new libraries found in the classloader ")
+                .append(
+                    classLoader == null ? "DEFAULT" : classLoader.toString())
+                .append(":");
+
+            for (Iterator iterator = foundLibs.iterator(); iterator.hasNext();) {
+                library = (Library) iterator.next();
+                try {
+                    library.doRegistration();
+                } catch (Throwable e) {
+                    manageLibraryException(ignoreerrors, "doRegistration",
+                        library, e);
+                }
+                previousFoundLibs.add(library);
+                logBuf.append("\n- ").append(library);
+            }
+            
+        } catch (Exception e) {
+            String msg =
+                MessageFormat.format(
+                    "Error finding libraries of classloader {0}. Last procesed library {1}.",
+                    new String[] { 
+                        classLoader == null ? "DEFAULT" : classLoader.toString(),
+                        library == null ? "(no-library)" : library.toString(),
+                    }
+                );
+            manageLibraryException(ignoreerrors, msg, e);
+        } finally {
+            try {
+                LOG.info(logBuf.toString());
+            } catch(Throwable th) {
+                // Ignore errors.
+            }
+        }
+    }
+
+    protected abstract Set findLibraries(Class libraryClass,
+        ClassLoader classLoader);
+
+    private void initializeLibraries(Collection libs, boolean post,
+        boolean ignoreerrors) {
+        String label;
+        if (post) {
+            label = "postInitialize";
+        } else {
+            label = "initialize";
+        }
+
+        for (Iterator iterator = libs.iterator(); iterator.hasNext();) {
+            Library lib = (Library) iterator.next();
+            try {
+                if (post) {
+                    LOG.trace("Calling {}.postInitialize()", lib.getClass()
+                        .getName());
+                    lib.postInitialize();
+                } else {
+                    LOG.trace("Calling {}.initialize()", lib.getClass()
+                        .getName());
+                    lib.initialize();
+                }
+            } catch (Throwable e) {
+                manageLibraryException(ignoreerrors, label, lib, e);
+            }
+        }
+    }
+
+    private void manageLibraryException(boolean ignoreerrors, String label,
+        Library lib, Throwable e) {
+        String msg;
+        if (e instanceof BaseRuntimeException) {
+            msg = ((BaseRuntimeException) e).getLocalizedMessageStack();
+        } else {
+            msg = e.getLocalizedMessage();
+        }
+        String formattedMsg =
+            MessageFormat.format("Error in {0} of library {1}. {2}",
+                new String[] { label, lib.getClass().getName(), msg });
+        manageLibraryException(ignoreerrors, formattedMsg, e);
+    }
+
+    private void manageLibraryException(boolean ignoreerrors, String message,
+        Throwable e) {
+        if (ignoreerrors) {
+            LOG.error(message, e);
+        } else {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException) e;
+            } else if (e instanceof Error) {
+                throw (Error) e;
+            }
+        }
+    }
+
+    private void logLibraries(Collection libs, int fullSize) {
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("Total libraries to initialize (")
+            .append(libs == null ? 0 : libs.size()).append(" of ")
+            .append(fullSize).append("):");
+        if (libs != null) {
+            for (Iterator iterator = libs.iterator(); iterator.hasNext();) {
+                buffer.append("\n- ").append(iterator.next());
+            }
+        }
+        LOG.info(buffer.toString());
+    }
+
+    private static class OrderedLibs extends ArrayList {
+
+        private static final long serialVersionUID = -8546268624773345053L;
+
+        // By default order alphabetically
+        private Map apis;
+
+        public OrderedLibs(Set libs) {
+            apis = new TreeMap(new Comparator() {
+
+                public int compare(Object o1, Object o2) {
+                    Class class1 = (Class) o1;
+                    Class class2 = (Class) o2;
+                    return class1.getName().compareTo(class2.getName());
+                }
+            });
+            orderLibs(libs);
+        }
+
+        private void orderLibs(Set libs) {
+            // First create the groups of libraries, internally ordered:
+            // 1: api, 2: impl, 3: serv1, 4: serv2, ...
+            // (servs ordered by dependency)
+            for (Iterator iterator = libs.iterator(); iterator.hasNext();) {
+                Library library = (Library) iterator.next();
+                Class API = library.getLibrary();
+                if (API == null) {
+                    API = library.getClass();
+                }
+                List libraryGroup = (List) apis.get(API);
+                if (libraryGroup == null) {
+                    libraryGroup = new LinkedList();
+                    apis.put(API, libraryGroup);
+                }
+                addLibraryToGroup(libraryGroup, library);
+            }
+
+            Set alreadyAddedGroups = new HashSet();
+            for (Iterator iterator = apis.keySet().iterator(); iterator
+                .hasNext();) {
+                Class APIRequired = (Class) iterator.next();
+                addFromLibraryGroup(APIRequired, alreadyAddedGroups);
+            }
+        }
+
+        private void addLibraryToGroup(List libraryGroup, Library library) {
+            String type = library.getType();
+
+            // If first, don't look anything else and add it
+            if (libraryGroup.size() == 0) {
+                libraryGroup.add(library);
+                return;
+            }
+
+            if (API.equals(type)) {
+                // API library must go first
+                libraryGroup.add(0, library);
+            } else if (IMPL.equals(type)) {
+                // Look for other implementation an replace it if priority
+                // is higher, or discard
+                for (int i = 0; i < libraryGroup.size(); i++) {
+                    Library current = (Library) libraryGroup.get(i);
+                    if (IMPL.equals(current.getType())) {
+                        if (current.getPriority() < library.getPriority()) {
+                            libraryGroup.set(i, library);
+                            return;
+                        } else {
+                            return;
+                        }
+                    }
+                }
+                // If it is the first implementation, insert it after the API
+                // and before the services, if any.
+                Library first = (Library) libraryGroup.get(0);
+                if (API.equals(first.getType())) {
+                    if (libraryGroup.size() == 1) {
+                        libraryGroup.add(library);
+                    } else {
+                        libraryGroup.add(1, library);
+                    }
+                    return;
+                } else {
+                    libraryGroup.add(0, library);
+                    return;
+                }
+            } else { // It is a service type
+
+                // Look for other services and insert by dependency order
+                for (int i = 0; i < libraryGroup.size(); i++) {
+                    Library current = (Library) libraryGroup.get(i);
+                    if (SERVICE.equals(current.getType())) {
+                        if (current.isRequired(library)) {
+                            libraryGroup.add(i, library);
+                            return;
+                        }
+                    }
+                }
+                // Otherwise add the last
+                libraryGroup.add(library);
+            }
+        }
+
+        private void addFromLibraryGroup(Class APIRequired,
+            Set alreadyAddedGroups) {
+            Collection libraryGroup = (Collection) apis.get(APIRequired);
+            if (libraryGroup != null
+                && !alreadyAddedGroups.contains(APIRequired)) {
+                alreadyAddedGroups.add(APIRequired);
+
+                // Add all group libraries, taking into account dependencies
+                // with other library groups
+                for (Iterator iterator = libraryGroup.iterator(); iterator
+                    .hasNext();) {
+                    Library library = (Library) iterator.next();
+                    Set requireds = library.getRequireds();
+                    if (requireds != null) {
+                        for (Iterator requiredsIter = requireds.iterator(); requiredsIter
+                            .hasNext();) {
+                            Required required = (Required) requiredsIter.next();
+                            addFromLibraryGroup(required.getLibrary(),
+                                alreadyAddedGroups);
+                        }
+                    }
+                    add(library);
+                }
+            }
+        }
+
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/Library.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/Library.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/Library.java	(revision 1235)
@@ -0,0 +1,117 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.library;
+
+import java.util.Set;
+
+/**
+ * Library initialization and registration.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface Library {
+
+	/**
+	 * Constant definitions for library types.
+	 * @author gvSIG team
+	 */
+	public static interface TYPE {
+		public static final String API = "api";
+		public static final String IMPL = "impl";
+		public static final String SERVICE = "service";
+	}
+	
+    /**
+     * Performs all the initializations of the library, only related to himself:
+     * register implementation classes through the Locator, start services, etc.
+     * 
+     * @throws LibraryException
+     *             if there is an error while performing the initialization of
+     *             the library
+     */
+    void initialize() throws LibraryException;
+
+    /**
+     * Performs all the initializations or validations related to the library
+     * dependencies, as getting references to objects through other libraries
+     * Locators.
+     * 
+     * @throws LibraryException
+     *             if there is an error while loading an implementation of the
+     *             library
+     */
+    void postInitialize() throws LibraryException;
+
+	/**
+	 * Returns the {@link Library} class this library is related to.
+	 * @return the {@link Library} class this library is related to
+	 */
+	public Class getLibrary();
+	
+	/**
+	 * Returns the type of the Library.
+	 * @see TYPE.
+	 * @return
+	 */
+	public String getType();
+	
+	/**
+	 * Returns a Set of required libraries and their types.
+	 * @return a Set of required libraries
+	 */
+	public Set getRequireds();
+    
+    /**
+     * Returns if a given library is required.
+     * 
+     * @param lib
+     *            the library to check if it is required
+     * @return if is required
+     */
+    public boolean isRequired(Library lib);
+
+    /**
+     * Returns if a given library class is required.
+     * 
+     * @param libClass
+     *            the library Class to check if it is required
+     * @return if is required
+     */
+    public boolean isRequired(Class libClass);
+
+    /**
+     * Returns a priority number to range this implementation
+     * in case multiple ones are within the libraries initialization.
+     * 
+     * @return a priority number, 0 by default.
+     */
+    public int getPriority();
+    
+    public void doRegistration();
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrary.java	(revision 1235)
@@ -0,0 +1,387 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools.library;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base Library implementation, checking that a Library is initialized and
+ * postInitialized only once.
+ * 
+ * Also adds initialization logging.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ * @author jjdelcerro
+ */
+public abstract class AbstractLibrary implements Library {
+
+    private static Set initialized = new HashSet();
+    private static Set postInitialized = new HashSet();
+
+    private static final int DEFAULT_PRIORITY = 0;
+
+    private Set requireds = null;
+    private Class library;
+    private String type;
+    private int priority = DEFAULT_PRIORITY;
+
+    /**
+     * Association between a library class and its type.
+     * 
+     * @author gvSIG team
+     */
+    public static class Required {
+
+        Class library;
+        String type;
+        private boolean added = false;
+
+        Required(Class library, String type) {
+            this.library = library;
+            this.type = type;
+        }
+
+        public Class getLibrary() {
+            return this.library;
+        }
+
+        public String getType() {
+            return this.type;
+        }
+
+        public String toString() {
+            return this.library.toString() + ":"
+                + (this.type == null ? "UNDEFINED" : this.type.toUpperCase());
+        }
+
+        /**
+         * @return the added
+         */
+        public boolean isAdded() {
+            return added;
+        }
+
+        /**
+         * @param added
+         *            the added to set
+         */
+        public void setAdded(boolean added) {
+            this.added = added;
+        }
+    }
+
+    /**
+     * Empty constructor.
+     */
+    protected AbstractLibrary() {
+        // Nothing to do
+    }
+
+    /**
+     * Creates a new library registering with type of library it is: API or
+     * implementation of a library.
+     * <p>
+     * When it is an API library, the class will be itself.
+     * </p>
+     * 
+     * @param library
+     *            the library class we relate to
+     * @param type
+     *            the library type. See {@link TYPE}.
+     * @deprecated to be removed in the 4.x version. Use the
+     *             {@link #AbstractLibrary()} empty constructor and override the
+     *             {@link #doRegistration()} method instead.
+     * @see #AbstractLibrary()
+     */
+    protected AbstractLibrary(Class library, String type) {
+        registerAs(library, type);
+    }
+
+    /**
+     * Creates a new library registering it as an implementation.
+     * A priority is also provided just in case there is another
+     * implementation available, so the one with the highest priority
+     * will be the one used.
+     * 
+     * @param library
+     *            the library class we relate to
+     * @param priority
+     *            the priority of the library against other implementations
+     *            of the same library
+     * @deprecated to be removed in the 4.x version. Use the
+     *             {@link #AbstractLibrary()} empty constructor and override the
+     *             {@link #doRegistration()} method instead.
+     * @see #AbstractLibrary()
+     */
+    protected AbstractLibrary(Class library, int priority) {
+        registerAsImplementationOf(library, priority);
+    }
+
+    public Set getRequireds() {
+        return this.requireds;
+    }
+
+    /**
+     * Returns the name of the current Library
+     */
+    public Class getLibrary() {
+        return this.library;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public int getPriority() {
+        return this.priority;
+    }
+
+    /**
+     * Adds a required library, so it is initialized before the current one.
+     * 
+     * @param library
+     *            the required library
+     * @param type
+     *            the type of the required library
+     * @deprecated use the {@link #require(Class)} method instead, as you may
+     *             have problems if the type specified is not correct. Moreover,
+     *             this is not needed.
+     */
+    public synchronized final void require(Class library, String type) {
+        doRequire(library, type);
+    }
+
+    /**
+     * Adds a required library, so it is initialized before the current one.
+     * 
+     * @param library
+     *            the required library
+     */
+    public synchronized final void require(Class library) {
+        doRequire(library, null);
+    }
+
+    private void doRequire(Class library, String type) {
+        if (requireds == null) {
+            this.requireds = new HashSet();
+        }
+        this.requireds.add(new Required(library, type));
+    }
+
+    /**
+     * Registers the library with type of library it is: API or
+     * implementation of a library.
+     * <p>
+     * When it is an API library, the class will be itself.
+     * </p>
+     * 
+     * @param library
+     *            the library class we relate to
+     * @param type
+     *            the library type. See {@link TYPE}.
+     */
+    protected synchronized final void registerAs(Class library, String type) {
+        this.library = library;
+        this.type = type;
+        if (this.library != null) {
+            if (!Library.class.isAssignableFrom(library)) {
+                throw new IllegalArgumentException(
+                "Invalid argument in registerAs(library:'"+library+"', type:"+type+") of class '"+this.getClass().getName()+"', the library argument don't implement the interface Library.");
+            }
+            // Add default dependencies between services, implementation and API
+            if (!Library.TYPE.API.equals(type)) {
+                doRequire(this.library, Library.TYPE.API);
+                if (Library.TYPE.SERVICE.equals(type)) {
+                    doRequire(this.library, Library.TYPE.IMPL);
+                }
+            }
+        }
+    }
+
+    /**
+     * Registers the library as an API one.
+     * 
+     * @param library
+     *            the library class we relate to
+     */
+    protected synchronized final void registerAsAPI(Class library) {
+        registerAs(library, TYPE.API);
+    }
+
+    /**
+     * Registers the library as an implementation of an API library, with the
+     * default priority.
+     * 
+     * @param library
+     *            the library class we relate to
+     */
+    protected synchronized final void registerAsImplementationOf(Class library) {
+        registerAsImplementationOf(library, DEFAULT_PRIORITY);
+    }
+
+    /**
+     * Registers the library as an implementation of an API library.
+     * A priority is also provided just in case there is another
+     * implementation available, so the one with the highest priority
+     * will be the one used.
+     * 
+     * @param library
+     *            the library class we relate to
+     * @param priority
+     *            the priority of the library against other implementations
+     *            of the same library
+     */
+    protected synchronized final void registerAsImplementationOf(Class library,
+        int priority) {
+
+        registerAs(library, Library.TYPE.IMPL);
+        this.priority = priority;
+    }
+
+    /**
+     * Registers the library as a service or provider of an API library.
+     * 
+     * @param library
+     *            the library class we relate to
+     */
+    protected synchronized final void registerAsServiceOf(Class library) {
+        registerAs(library, TYPE.SERVICE);
+    }
+
+    public synchronized final void initialize() throws LibraryException {
+        Logger logger = null;
+
+        // Check if we have been already initialized
+        String name = getClass().getName();
+        if (initialized.contains(name)) {
+            return;
+        }
+
+        logger = LoggerFactory.getLogger(this.getClass());
+        logger
+            .info("Initializing library '" + this.getClass().getName() + "'.");
+
+        // Set the current Library as initialized
+        initialized.add(name);
+
+        try {
+        	doInitialize();
+        } catch(Throwable t) {
+            logger.info("Can't initialize library '" + this.getClass().getName() + "'.", t);
+        }
+    }
+
+    public synchronized final void postInitialize() throws LibraryException {
+        Logger logger = null;
+
+        // Check if we have been already postInitialized
+        String name = getClass().getName();
+        if (postInitialized.contains(name)) {
+            return;
+        }
+
+        logger = LoggerFactory.getLogger(this.getClass());
+        logger.info("PostInitializing library '" + this.getClass().getName()
+            + "'.");
+        try {
+            doPostInitialize();
+        } catch(Throwable t) {
+            logger.info("Can't postinitialize library '" + this.getClass().getName() + "'.", t);
+        }
+
+        // Set the current Library as postInitialized
+        postInitialized.add(name);
+    }
+
+    public void doRegistration() {
+        // Empty implementation so child classes may still use the registration
+        // in its constructor
+    }
+
+    public boolean equals(Object obj) {
+        return obj != null
+            && getClass().getName().equals(obj.getClass().getName());
+    }
+
+    public int hashCode() {
+        return getClass().getName().hashCode();
+    }
+
+    public String toString() {
+        if (getType() == null) {
+            return getClass().getName();
+        }
+        String relatedLibName =
+            library == null ? getClass().getName() : library.getName();
+        return getClass().getName() + " (" + getType().toUpperCase() + " of "
+            + relatedLibName + ")";
+    }
+
+    public boolean isRequired(Library lib) {
+        return isRequired(lib.getClass());
+    }
+
+    public boolean isRequired(Class libClass) {
+        if (requireds != null) {
+            for (Iterator iterator = requireds.iterator(); iterator.hasNext();) {
+                Required req = (Required) iterator.next();
+                if (libClass.equals(req.getLibrary())) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Performs all the initializations of the library, only related to himself:
+     * register implementation classes through the Locator, start services, etc.
+     * 
+     * @throws LibraryException
+     *             if there is an error while performing the initialization of
+     *             the library
+     */
+    protected abstract void doInitialize() throws LibraryException;
+
+    /**
+     * Performs all the initializations or validations related to the library
+     * dependencies, as getting references to objects through other libraries
+     * Locators.
+     * 
+     * @throws LibraryException
+     *             if there is an error while loading an implementation of the
+     *             library
+     */
+    protected abstract void doPostInitialize() throws LibraryException;
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibrariesInitializer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibrariesInitializer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/LibrariesInitializer.java	(revision 1235)
@@ -0,0 +1,89 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.library;
+
+/**
+ * Initializes the libraries of the application by finding the available
+ * {@link Library} implementations to instance and call them.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface LibrariesInitializer {
+
+    /**
+     * Initializes all available {@link Library} objects. The initialization
+     * process will stop if any exception is thrown by any of the libraries.
+     */
+    void initialize();
+
+    /**
+     * Initializes all available {@link Library} objects. The initialization
+     * process will stop or not if any exception is thrown by any of the
+     * libraries depending on the ignoreerrors parameter.
+     * 
+     * @param ignoreerrors
+     *            if library initialization errors will stop de process
+     */
+    void initialize(boolean ignoreerrors);
+
+    /**
+     * Post-initializes all available {@link Library} objects. The
+     * initialization
+     * process will stop if any exception is thrown by any of the libraries.
+     */
+    void postInitialize();
+
+    /**
+     * Post-initializes all available {@link Library} objects. The
+     * initialization
+     * process will stop or not if any exception is thrown by any of the
+     * libraries depending on the ignoreerrors parameter.
+     * 
+     * @param ignoreerrors
+     *            if library initialization errors will stop de process
+     */
+    void postInitialize(boolean ignoreerrors);
+
+    /**
+     * Initializes and post-initializes all available {@link Library} objects.
+     * The initialization
+     * process will stop if any exception is thrown by any of the libraries.
+     */
+    void fullInitialize();
+
+    /**
+     * Initializes and post-initializes all available {@link Library} objects.
+     * The initialization
+     * process will stop or not if any exception is thrown by any of the
+     * libraries depending on the ignoreerrors parameter.
+     * 
+     * @param ignoreerrors
+     *            if library initialization errors will stop de process
+     */
+    void fullInitialize(boolean ignoreerrors);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/impl/DefaultLibrariesInitializer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/impl/DefaultLibrariesInitializer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/impl/DefaultLibrariesInitializer.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.library.impl;
+
+import java.util.Set;
+
+import org.gvsig.tools.library.AbstractLibrariesInitializer;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.util.ServiceLoader;
+import org.gvsig.tools.util.impl.DefaultServiceLoader;
+
+/**
+ * Loads the {@link Library} implementation object instances through a
+ * {@link DefaultServiceLoader} or a provided {@link ServiceLoader}.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultLibrariesInitializer extends AbstractLibrariesInitializer {
+
+	private final ServiceLoader serviceLoader;
+
+	public DefaultLibrariesInitializer() {
+		this(new DefaultServiceLoader());
+	}
+
+    public DefaultLibrariesInitializer(ClassLoader classLoader) {
+        this(classLoader, new DefaultServiceLoader());
+    }
+
+    public DefaultLibrariesInitializer(ClassLoader[] classLoaders) {
+        this(classLoaders, new DefaultServiceLoader());
+    }
+
+	public DefaultLibrariesInitializer(ServiceLoader serviceLoader) {
+		super();
+		this.serviceLoader = serviceLoader;
+	}
+
+    public DefaultLibrariesInitializer(ClassLoader classLoader,
+        ServiceLoader serviceLoader) {
+        super(classLoader);
+        this.serviceLoader = serviceLoader;
+    }
+
+    public DefaultLibrariesInitializer(ClassLoader[] classLoaders,
+        ServiceLoader serviceLoader) {
+        super(classLoaders);
+        this.serviceLoader = serviceLoader;
+    }
+
+	protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
+		return serviceLoader.load(libraryClass, classLoader);
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoException.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.undo;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Exception thrown when there is an error while performing an undo.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class UndoException extends BaseException {
+
+    private static final long serialVersionUID = -2530153193164534637L;
+
+    private final static String MESSAGE_FORMAT = "The element %(undoredo) could not be undone";
+    private final static String MESSAGE_KEY = "_UndoException";
+
+    private UndoRedoInfo undoRedoInfo;
+
+    /**
+     * Creates a new exception of an error while performing an undo operation.
+     * 
+     * @param undoRedoInfo
+     *            the information of the element that could not be undone
+     */
+    public UndoException(UndoRedoInfo undoRedoInfo) {
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+        this.undoRedoInfo = undoRedoInfo;
+    }
+
+    /**
+     * Creates a new exception of an error while performing an undo operation.
+     * 
+     * @param undoRedoInfo
+     *            the information of the element that could not be undone
+     * @param cause
+     *            the original cause of the exception
+     */
+    public UndoException(UndoRedoInfo undoRedoInfo, Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+        this.undoRedoInfo = undoRedoInfo;
+    }
+
+    protected Map values() {
+        return Collections
+                .singletonMap("undoredo", undoRedoInfo
+                .getDescription());
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoStack.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoStack.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoStack.java	(revision 1235)
@@ -0,0 +1,126 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.undo;
+
+import java.util.List;
+
+import org.gvsig.tools.observer.WeakReferencingObservable;
+
+/**
+ * An Stack of Undo/Redo operations.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface UndoRedoStack extends WeakReferencingObservable {
+
+    /**
+     * Undoes the following undoable elements.
+     * 
+     * @throws UndoException
+     *             if there is an error performing de undo element
+     */
+    void undo() throws UndoException;
+
+    /**
+     * Undoes a number of the following undoable elements.
+     * 
+     * @param num
+     *            the number of elements to undo
+     * @throws UndoException
+     *             if there is an error performing de undo element
+     */
+    void undo(int num) throws UndoException;
+
+    /**
+     * Re-does the following redoable elements.
+     * 
+     * @throws RedoException
+     *             if there is an error performing de redo element
+     */
+    void redo() throws RedoException;
+
+    /**
+     * Re-does a number of the following redoable element.
+     * 
+     * @param num
+     *            the number of elements to redo
+     * @throws RedoException
+     *             if there is an error performing de redo element
+     */
+    void redo(int num) throws RedoException;
+
+    /**
+     * Returns the list of UndoRedoInfo in the UNDO stack
+     * 
+     * @return list of UndoRedoInfo in the UNDO stack
+     */
+    List getUndoInfos();
+
+    /**
+     * Returns the list of UndoRedoInfo in the REDO stack
+     * 
+     * @return list of UndoRedoInfo in the REDO stack
+     */
+    List getRedoInfos();
+
+    /**
+     * If an undo can be performed on the stack.
+     * 
+     * @return an undo can be performed
+     */
+    boolean canUndo();
+
+    /**
+     * If a redo can be performed on the stack.
+     * 
+     * @return a redo can be performed
+     */
+    boolean canRedo();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/RedoException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/RedoException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/RedoException.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.undo;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Exception thrown when there is an error while performing an redo.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class RedoException extends BaseException {
+
+    private static final long serialVersionUID = 6635654940071716308L;
+    
+    private final static String MESSAGE_FORMAT = "The element %(undoredo) could not be redone";
+    private final static String MESSAGE_KEY = "_RedoException";
+
+    private UndoRedoInfo undoRedoInfo;
+
+    /**
+     * Creates a new exception of an error while performing a redo operation.
+     * 
+     * @param undoRedoInfo
+     *            the information of the element that could not be redone
+     */
+    public RedoException(UndoRedoInfo undoRedoInfo) {
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+        this.undoRedoInfo = undoRedoInfo;
+    }
+
+    /**
+     * Creates a new exception of an error while performing a redo operation.
+     * 
+     * @param undoRedoInfo
+     *            the information of the element that could not be redone
+     * @param cause
+     *            the original cause of the exception
+     */
+    public RedoException(UndoRedoInfo undoRedoInfo, Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+        this.undoRedoInfo = undoRedoInfo;
+    }
+
+    protected Map values() {
+        return Collections
+                .singletonMap("undoredo", undoRedoInfo
+                .getDescription());
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/UndoRedoInfo.java	(revision 1235)
@@ -0,0 +1,66 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.undo;
+
+import java.util.Date;
+
+/**
+ * Information about a undoable or redoable element.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface UndoRedoInfo {
+    
+    public final static int DELETE = 0;
+    public final static int INSERT = 1;
+    public final static int UPDATE = 2;
+
+    /**
+     * Returns this command description
+     * 
+     * @return a String with this command description
+     */
+    public String getDescription();
+
+    /**
+     * Returns a String with the date in which this command was created or
+     * redone.
+     * 
+     * @return a String with the date in which this command was created or
+     *         redone
+     */
+    public Date getDate();
+    
+    /**
+     * Returns the type of action related to data: insertion, deletion or
+     * update.
+     * 
+     * @return the type of action related to data: insertion, deletion or update
+     */
+    public int getType();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/Command.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/Command.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/Command.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.undo.command;
+
+import org.gvsig.tools.undo.UndoRedoInfo;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+
+/**
+ * Undo/Redoable command interface.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface Command extends UndoRedoInfo {
+
+    /**
+     * Undoes the following undoable command.
+     * 
+     * @throws UndoException
+     *             if there is an error performing de undo action
+     */
+    void undo() throws UndoException;
+
+    /**
+     * Re-does the following redoable command.
+     * 
+     * @throws RedoException
+     *             if there is an error performing de redo action
+     */
+    void redo() throws RedoException;
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultUndoRedoCommandStack.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultUndoRedoCommandStack.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultUndoRedoCommandStack.java	(revision 1235)
@@ -0,0 +1,180 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.undo.command.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.Command;
+import org.gvsig.tools.undo.command.CommandNotification;
+import org.gvsig.tools.undo.command.UndoRedoCommandStack;
+
+/**
+ * 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 DefaultUndoRedoCommandStack implements UndoRedoCommandStack {
+	private Stack undos = new Stack();
+    private Stack redos = new Stack();
+    private DelegateWeakReferencingObservable delegateObservable = new DelegateWeakReferencingObservable(
+            this);
+    private boolean complex = false;
+    private CompoundCommand collection = null;
+
+	public void add(Command command) {
+		if (complex) {
+            collection.add(command);
+        } else {
+            undos.add(command);
+            redos.clear();
+            delegateObservable.notifyObservers(new DefaultCommandNotification(
+                    command, CommandNotification.ADD));
+        }
+    }
+
+	public void undo() throws UndoException {
+		AbstractCommand command = (AbstractCommand) undos.pop();
+        command.undo();
+        redos.add(command);
+        delegateObservable.notifyObservers(new DefaultCommandNotification(
+                command, CommandNotification.UNDO));
+    }
+
+	public void redo() throws RedoException {
+		AbstractCommand command = (AbstractCommand) redos.pop();
+        command.redo();
+        undos.add(command);
+        delegateObservable.notifyObservers(new DefaultCommandNotification(
+                command, CommandNotification.REDO));
+    }
+
+    public void redo(int commands) throws RedoException {
+        for (int i = 0; i < commands; i++) {
+            redo();
+        }
+    }
+
+    public void undo(int commands) throws UndoException {
+        for (int i = 0; i < commands; i++) {
+            undo();
+        }
+    }
+
+	public boolean canUndo() {
+        return (!undos.isEmpty());
+    }
+
+	public boolean canRedo() {
+        return (!redos.isEmpty());
+    }
+
+	public List getUndoInfos() {
+        Stack clonedUndos = (Stack) undos.clone();
+
+		ArrayList commands = new ArrayList();
+        while (!clonedUndos.isEmpty()) {
+            commands.add(clonedUndos.pop());
+        }
+
+		return commands;
+    }
+
+	public List getRedoInfos() {
+        Stack clonedRedos = (Stack) redos.clone();
+
+		ArrayList commands = new ArrayList();
+        while (!clonedRedos.isEmpty()) {
+            commands.add(clonedRedos.pop());
+        }
+        return commands;
+    }
+
+	public int size() {
+        return undos.size() + redos.size();
+    }
+
+	public void clear() {
+        redos.clear();
+        undos.clear();
+    }
+
+	public Command getNextUndoCommand() {
+        return (Command) undos.peek();
+    }
+
+	public Command getNextRedoCommand() {
+        return (Command) redos.peek();
+    }
+
+	public void addObserver(Observer o) {
+        delegateObservable.addObserver(o);
+
+	}
+
+	public void deleteObserver(Observer o) {
+        delegateObservable.deleteObserver(o);
+    }
+
+	public void deleteObservers() {
+        delegateObservable.deleteObservers();
+    }
+
+	public void endComplex() {
+        if (collection.isEmpty()) {
+            complex = false;
+            return;
+        }
+		complex = false;
+        undos.add(collection);
+        redos.clear();
+        delegateObservable.notifyObservers(new DefaultCommandNotification(
+                collection, CommandNotification.ADD));
+
+	}
+
+	public void startComplex(String description) {
+        collection = new CompoundCommand(description);
+        complex = true;
+    }
+
+	public boolean inComplex() {
+		return complex;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultCommandNotification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultCommandNotification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/DefaultCommandNotification.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.undo.command.impl;
+
+import org.gvsig.tools.undo.command.Command;
+import org.gvsig.tools.undo.command.CommandNotification;
+
+public class DefaultCommandNotification implements CommandNotification {
+	private Command command;
+	private String type;
+
+	public DefaultCommandNotification(Command command, String type) {
+		this.command=command;
+		this.type=type;
+	}
+
+	public Command getCommand() {
+		return this.command;
+	}
+
+	public String getType() {
+		return this.type;
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/AbstractCommand.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/AbstractCommand.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/AbstractCommand.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.undo.command.impl;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.gvsig.tools.undo.command.Command;
+
+/**
+ * Base implementation for Commands.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public abstract class AbstractCommand implements Command {
+
+    private Date date;
+
+    private String description;
+
+    /**
+     * Creates a new AbstractCommand.
+     * 
+     * @param description
+     *            of the command
+     */
+    public AbstractCommand(String description) {
+        this.description = description;
+        updateDate();
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    protected void updateDate() {
+        date = new Date();
+    }
+
+    public String toString() {
+        DateFormat format = DateFormat.getDateTimeInstance();
+        return "Command: ".concat(getDescription()).concat(", date: ").concat(
+                format.format(getDate()));
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/CompoundCommand.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/CompoundCommand.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/impl/CompoundCommand.java	(revision 1235)
@@ -0,0 +1,101 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.undo.command.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.Command;
+
+public class CompoundCommand extends AbstractCommand {
+
+    private List commands = new ArrayList();
+
+    public CompoundCommand(String description) {
+        super(description);
+    }
+
+    public boolean isEmpty() {
+        return commands.size() == 0;
+    }
+
+    public void undo() throws UndoException {
+        for (int i = commands.size() - 1; i >= 0; i--) {
+            ((AbstractCommand) commands.get(i)).undo();
+        }
+    }
+
+    public void redo() throws RedoException {
+        for (int i = 0; i < commands.size(); i++) {
+            ((AbstractCommand) commands.get(i)).redo();
+        }
+    }
+
+    public void add(Command c) {
+        commands.add(c);
+    }
+    
+    public int getType() {
+        if (isEmpty()) {
+            return UPDATE;
+        } else {
+            int adds = getCount(INSERT);
+            int dels = getCount(DELETE);
+            if (adds > 0 && dels == 0) {
+                return INSERT;
+            } else {
+                if (adds == 0 && dels > 0) {
+                    return DELETE;
+                } else {
+                    /*
+                     * mix or other thing
+                     */
+                    return UPDATE;
+                }
+            }
+        }
+    }
+
+    /**
+     * count commands of given type
+     * 
+     * @param insert
+     * @return
+     */
+    private int getCount(int ty) {
+        if (commands == null || commands.size() == 0) {
+            return 0;
+        } else {
+            int resp = 0;
+            for (int i=0; i<commands.size(); i++) {
+                if (((Command) commands.get(i)).getType() == ty) {
+                    resp++;
+                }
+            }
+            return resp;
+        }
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/UndoRedoCommandStack.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/UndoRedoCommandStack.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/UndoRedoCommandStack.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.undo.command;
+
+import org.gvsig.tools.undo.UndoRedoStack;
+
+/**
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface UndoRedoCommandStack extends UndoRedoStack {
+
+    public void add(Command command);
+
+    public int size();
+
+    public void clear();
+
+    public Command getNextUndoCommand();
+
+    public Command getNextRedoCommand();
+
+    public void startComplex(String description);
+
+    public void endComplex();
+
+    public boolean inComplex();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/CommandNotification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/CommandNotification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/undo/command/CommandNotification.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.undo.command;
+
+/**
+ * This interface represents a notification used by 
+ * the commands record to indicate an action over a command.
+ *
+ */
+public interface CommandNotification {
+
+	/** The command has been added to the command record */
+	public static final String ADD = "add_Command";
+	/** The command has been undone */
+	public static final String UNDO = "undo_Command";
+	/** The command has been redone */ 
+	public static final String REDO = "redo_Command";
+
+	/**
+	 * Returns the Command over which the action is executed
+	 * @return Command over which the action is executed
+	 */
+	public Command getCommand();
+
+	/**
+	 * Returns this notification's type. One of the constants defined in this interface.
+	 *
+	 * @return a String containing this notification's type.
+	 */
+	public String getType();
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/DefaultPagingCalculator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/DefaultPagingCalculator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/DefaultPagingCalculator.java	(revision 1235)
@@ -0,0 +1,142 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.paging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Default {@link PagingCalculator} implementation.
+ * 
+ * @author gvSIG team
+ */
+public class DefaultPagingCalculator implements PagingCalculator {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultPagingCalculator.class);
+
+    private int maxPageSize;
+    private long currentPage;
+
+    private final Sizeable sizeable;
+
+    /**
+     * Creates a new {@link DefaultPagingCalculator}, with the default page
+     * size ({@link PagingCalculator#DEFAULT_PAGE_SIZE}), setting the current
+     * page to the first one.
+     */
+    public DefaultPagingCalculator(Sizeable sizeable) {
+        this(sizeable, DEFAULT_PAGE_SIZE);
+    }
+
+    /**
+     * Creates a new {@link DefaultPagingCalculator}, setting the current page
+     * to the first one.
+     * 
+     * @param maxPageSize
+     *            the maximum page size
+     */
+    public DefaultPagingCalculator(Sizeable sizeable, int maxPageSize) {
+        this(sizeable, maxPageSize, 0);
+    }
+
+    /**
+     * Creates a new {@link DefaultPagingCalculator} .
+     * 
+     * @param maxPageSize
+     *            the maximum page size
+     * @param currentPage
+     *            the current page
+     */
+    public DefaultPagingCalculator(Sizeable sizeable, int maxPageSize,
+        long currentPage) {
+        this.sizeable = sizeable;
+        this.maxPageSize = maxPageSize;
+        this.currentPage = currentPage;
+    }
+
+    public int getMaxPageSize() {
+        return maxPageSize;
+    }
+
+    public void setMaxPageSize(int maxPageSize) {
+        if (maxPageSize < 0) {
+            throw new IndexOutOfBoundsException(
+                "Error, unable to set the max page size to a "
+                    + "negative value: " + maxPageSize);
+        }
+        this.maxPageSize = maxPageSize;
+    }
+
+    public long getCurrentPage() {
+        return currentPage;
+    }
+
+    public void setCurrentPage(long currentPage) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Setting current page to: {}", Long.toString(currentPage));
+        }
+
+        if (currentPage < 0) {
+            throw new IndexOutOfBoundsException(
+                "Error, unable to set current page to a " + "negative value: "
+                    + currentPage);
+        }
+        if (currentPage >= getNumPages()) {
+            throw new IndexOutOfBoundsException(
+                "Error, unable to set current page to the page num. "
+                    + currentPage + ", as we have only " + getNumPages()
+                    + " pages of data");
+        }
+
+        this.currentPage = currentPage;
+    }
+
+    public long getInitialIndex() {
+        return getCurrentPage() * getMaxPageSize();
+    }
+
+    protected long getLastIndex() {
+        return getInitialIndex() + getCurrentPageSize() - 1;
+    }
+
+    public long getNumPages() {
+        return ((long) Math.floor(getTotalSize() / (long) getMaxPageSize())) + 1;
+    }
+
+    public int getCurrentPageSize() {
+        long currentPage = getCurrentPage();
+        if (currentPage < (getNumPages() - 1)) {
+            return getMaxPageSize();
+        } else {
+            return (int) (getTotalSize() - (currentPage * getMaxPageSize()));
+        }
+    }
+
+    public long getTotalSize() {
+        return sizeable.getSize();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/PagingCalculator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/PagingCalculator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/paging/PagingCalculator.java	(revision 1235)
@@ -0,0 +1,123 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.paging;
+
+import org.gvsig.tools.exception.BaseException;
+
+
+/**
+ * Calculates all the values needed to perform pagination over a set of data.
+ * 
+ * @author gvSIG team
+ */
+public interface PagingCalculator {
+
+    static final int DEFAULT_PAGE_SIZE = 100;
+
+    /**
+     * Returns the current maximum number of values per page.
+     * 
+     * @return the current maximum page size
+     */
+    int getMaxPageSize();
+
+    /**
+     * Sets the current maximum number of elements per page. As the page size
+     * changes, the current page of data is reloaded.
+     * 
+     * All pages, but maybe the last one, will have this number of elements.
+     * 
+     * @param pageSize
+     *            the maximum number of values per page
+     * @throws BaseException
+     *             if there is an error reloading the current page
+     */
+    void setMaxPageSize(int pageSize) throws BaseException;
+
+    /**
+     * Returns the number of the currently loaded page of data (zero
+     * based).
+     * 
+     * @return the current page number
+     */
+    long getCurrentPage();
+
+    /**
+     * Sets the current page number (zero based), and loads the elements for
+     * that page.
+     * 
+     * @param page
+     *            the page to load
+     * @throws BaseException
+     *             if there is an error setting the current page
+     */
+    void setCurrentPage(long page) throws BaseException;
+
+    /**
+     * Returns the index of the initial element of the current page into all the
+     * elements.
+     * 
+     * @return the index of the initial element
+     */
+    long getInitialIndex();
+
+    /**
+     * Returns the number of pages available, calculated with the total number
+     * of elements and the maximum number of elements per page.
+     * 
+     * @return the number of pages available
+     */
+    long getNumPages();
+
+    /**
+     * Returns the number of elements of the entire set of data.
+     * 
+     * @return the number of elements
+     */
+    long getTotalSize();
+
+    /**
+     * Returns the number of elements of the current page. All the pages, but
+     * maybe the last one, will have the maximum number of elements per page.
+     * 
+     * @return the current page size
+     */
+    int getCurrentPageSize();
+
+    /**
+     * Interface for objects that have a size.
+     * 
+     * @author gvSIG team
+     */
+    public static interface Sizeable {
+
+        /**
+         * Returns the number of elements.
+         * 
+         * @return the number of elements
+         */
+        long getSize();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/ToolsLibrary.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {Create a base Locator implementation}
+ */
+package org.gvsig.tools;
+
+import org.gvsig.tools.dataTypes.impl.DefaultDataTypesManager;
+import org.gvsig.tools.dispose.impl.DefaultDisposableManager;
+import org.gvsig.tools.dynobject.impl.DefaultDynObjectManager;
+import org.gvsig.tools.i18n.impl.DummyI18nManager;
+import org.gvsig.tools.identitymanagement.impl.DumbIdentityManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.operations.impl.DefaultOperationManager;
+import org.gvsig.tools.packageutils.impl.DefaultPackageManager;
+import org.gvsig.tools.task.impl.DefaultTaskStatusManager;
+
+/**
+ * Tools library initialization.
+ * 
+ * @author 2010- Joaquin Jos� del Cerro - gvSIG team
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ * 
+ * @version $Id$
+ */
+public class ToolsLibrary extends AbstractLibrary {
+
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsAPI(ToolsLibrary.class);
+	}
+	
+	protected void doInitialize() throws LibraryException {
+		ToolsLocator
+				.registerDefaultOperationManager(DefaultOperationManager.class);
+		ToolsLocator.registerDefaultTaskStatusManager(DefaultTaskStatusManager.class);
+		ToolsLocator.registerDynObjectManager(DefaultDynObjectManager.class);
+		ToolsLocator.registerDisposableManager(DefaultDisposableManager.class);
+		ToolsLocator.registerDefaultDataTypesManager(DefaultDataTypesManager.class);
+		ToolsLocator.registerDefaultI18nManager(DummyI18nManager.class);
+		ToolsLocator.registerDefaultPackageManager(DefaultPackageManager.class);
+		ToolsLocator.registerDefaultIdentityManager(DumbIdentityManager.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		// Nothing to do
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/firewall/FirewallConfiguration.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/firewall/FirewallConfiguration.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/firewall/FirewallConfiguration.java	(revision 1235)
@@ -0,0 +1,31 @@
+
+
+package org.gvsig.tools.firewall;
+
+import java.net.URL;
+import java.util.List;
+
+public interface FirewallConfiguration {
+
+    public void apply();
+
+    public boolean isAuthenticate();
+
+    public boolean isEnabled();
+    public void setEnabled(boolean enabled);
+
+    public URL getHost();
+    public String getUserName();
+    public String getPassword();
+
+    public void setHost(URL host);
+    public boolean setHost(String host, String port);
+    public void setUserName(String userName);
+    public void setPassword(String password);
+
+    public List<String> getNonProxyHosts();
+    public String getNonProxyHostsAsString();
+    public void setNonProxyHosts(String nonProxyHosts);
+    public void addNonProxyHost(String host);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableInfo.java	(revision 1235)
@@ -0,0 +1,80 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dispose;
+
+/**
+ * Information about a {@link Disposable} object.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface DisposableInfo {
+
+	/**
+	 * Returns the {@link Disposable} whose info belongs to.
+	 * 
+	 * @return the disposable
+	 */
+	Disposable getDisposable();
+
+	/**
+	 * Returns the stack trace of the moment when the {@link Disposable} was
+	 * bound.
+	 * 
+	 * @return the stack trace of the disposable since it was bound
+	 */
+	StackTraceElement[] getBindDisposableStackTrace();
+
+	/**
+	 * Returns the count of references
+	 * 
+	 * @return the count of references
+	 */
+	int getReferencesCount();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableManager.java	(revision 1235)
@@ -0,0 +1,98 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.dispose.impl;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposableManager;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Default implementation for the {@link DisposableManager}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultDisposableManager implements DisposableManager {
+
+	private Map boundDisposables;
+
+	/**
+	 * Creates a new {@link DefaultDisposableManager}.
+	 */
+	public DefaultDisposableManager() {
+		boundDisposables = new LinkedHashMap();
+	}
+
+	public synchronized boolean bind(Disposable disposable) {
+		DefaultDisposableInfo di = (DefaultDisposableInfo) boundDisposables.get(disposable);
+		if (di != null){
+			di.incReferencesCount();
+			return false;
+		}
+		di = new DefaultDisposableInfo(disposable, new Throwable().getStackTrace());
+		di.incReferencesCount();
+		return boundDisposables.put(disposable, di) == null;
+	}
+
+	public synchronized boolean release(Disposable disposable) {
+		DefaultDisposableInfo di = (DefaultDisposableInfo) boundDisposables.get(disposable);
+		if (di!=null){
+			di.decReferencesCount();
+			if (di.getReferencesCount()>0){
+				return false;
+			}
+			boundDisposables.remove(disposable);
+			return true;
+		}
+		return false;
+	}
+
+	public synchronized void releaseAll() throws BaseException {
+		Iterator iterator = boundDisposables.keySet().iterator();
+		boundDisposables = new LinkedHashMap();
+		while (iterator.hasNext()) {
+			Disposable disposable = (Disposable) iterator.next();
+			iterator.remove();
+			disposable.dispose();
+		}
+	}
+
+	public synchronized int getBoundDisposableCount() {
+		return boundDisposables.size();
+	}
+
+	public synchronized Set getBoundDisposables() {
+		Set disposableInfos = new LinkedHashSet(boundDisposables.values());
+		return disposableInfos;
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/DefaultDisposableInfo.java	(revision 1235)
@@ -0,0 +1,96 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.dispose.impl;
+
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposableInfo;
+import org.gvsig.tools.dispose.DisposableManager;
+
+/**
+ * Default {@link DisposableInfo} implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultDisposableInfo implements DisposableInfo {
+
+	private final Disposable disposable;
+	private final StackTraceElement[] stackTrace;
+	private int referencesCount;
+
+	/**
+	 * Creates a new {@link DefaultDisposableInfo} with the {@link Disposable}
+	 * and the stack trace of the moment when the disposable was bound to the
+	 * {@link DisposableManager}.
+	 * 
+	 * @param disposable
+	 *            to info about
+	 * @param stackTrace
+	 *            stack trace of the moment when the {@link Disposable} was
+	 *            bound
+	 */
+	public DefaultDisposableInfo(Disposable disposable,
+			StackTraceElement[] stackTrace) {
+		this.disposable = disposable;
+		this.stackTrace = stackTrace;
+		this.referencesCount = 0;
+	}
+
+	public StackTraceElement[] getBindDisposableStackTrace() {
+		return stackTrace;
+	}
+
+	public Disposable getDisposable() {
+		return disposable;
+	}
+
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append("Disposable:\n\t").append(getDisposable())
+				.append("\nReferencesCount:\n\t").append(this.referencesCount)
+				.append("\nStack trace:");
+
+		StackTraceElement[] stackTrace = getBindDisposableStackTrace();
+		for (int i = 1; i < stackTrace.length; i++) {
+			buffer.append("\n\t").append(stackTrace[i]);
+		}
+
+		return buffer.toString();
+	}
+
+	public void incReferencesCount() {
+		this.referencesCount++;
+	}
+
+	public void decReferencesCount() {
+		this.referencesCount--;
+	}
+
+	public int getReferencesCount() {
+		return this.referencesCount;
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/AbstractDisposable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/AbstractDisposable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/impl/AbstractDisposable.java	(revision 1235)
@@ -0,0 +1,96 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.dispose.impl;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposeUtils;
+import org.gvsig.tools.exception.BaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base implementation for {@link Disposable} classes.
+ * <p>
+ * When an instance of this class is created, it is registered as in use, and it
+ * is removed in the dispose method.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractDisposable implements Disposable {
+
+	private static final Logger LOG =
+			LoggerFactory.getLogger(AbstractDisposable.class);
+
+	private final Object lock = new Object();
+
+	private boolean disposed = false;
+
+	public AbstractDisposable() {
+		if(ToolsLocator.getDisposableManager() != null) {
+			ToolsLocator.getDisposableManager().bind(this);
+		} else {
+			LOG.warn("Can't retrieve the disposable manager,");
+		}
+	}
+
+	public final void dispose() {
+		synchronized (lock) {
+			// Check if we have already been disposed, and don't do it again
+			if (!disposed) {
+				if ( ToolsLocator.getDisposableManager().release(this) ) {
+					try {
+						doDispose();
+					} catch (BaseException ex) {
+						LOG.error("Error performing dispose", ex);
+					}
+					disposed = true;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Utility method to dispose a {@link Disposable}, checking if it is null.
+	 * 
+	 * @param disposable
+	 *            to dispose
+	 */
+	protected void dispose(Disposable disposable) {
+		DisposeUtils.dispose(disposable);
+	}
+
+	/**
+	 * Internal implementation for the {@link #dispose()} method, to be
+	 * implemented by child classes.
+	 * 
+	 * @see #dispose()
+	 */
+	protected abstract void doDispose() throws BaseException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/Disposable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/Disposable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/Disposable.java	(revision 1235)
@@ -0,0 +1,68 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dispose;
+
+/**
+ * Interface for objects that must be disposed after usage.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Disposable {
+
+	/**
+	 * Disposes the current object, to allow it to close and dispose any used
+	 * resources.
+	 * <p>
+	 * <em><strong>NOTE:</strong>After calling this method, the object may 
+	 * not be usable anymore.</em>
+	 * </p>
+	 */
+	void dispose();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposeUtils.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposeUtils.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposeUtils.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dispose;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Dispose related utilities.
+ *
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DisposeUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(DisposeUtils.class);
+
+    /**
+     * Disposes a {@link Disposable} object, checking if it is null.
+     *
+     * @param disposable
+     * to dispose
+     */
+    public static void dispose(Disposable disposable) {
+        if ( disposable != null ) {
+            disposable.dispose();
+        }
+    }
+
+    public static void disposeQuietly(Disposable disposable) {
+        if ( disposable != null ) {
+            try {
+                disposable.dispose();
+            } catch (Throwable th) {
+                logger.warn("Can't dispose", th);
+            }
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableIterator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableIterator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableIterator.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dispose;
+
+import java.util.Iterator;
+
+/**
+ * Interface for Iterators which must be disposed after usage.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface DisposableIterator extends Disposable, Iterator {
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dispose/DisposableManager.java	(revision 1235)
@@ -0,0 +1,102 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.dispose;
+
+import java.util.Set;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Manages the use and dispose of {@link Disposable} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface DisposableManager {
+
+	/**
+	 * Registers a disposable as being in use.
+	 * 
+	 * @param disposable
+	 *            to bind
+	 * @return true if the disposable was not already bound
+	 */
+	boolean bind(Disposable disposable);
+
+	/**
+	 * Marks a disposable as not being used anymore.
+	 * 
+	 * @param disposable
+	 *            to release
+	 * @return true if the disposable has been finally released
+	 */
+	boolean release(Disposable disposable);
+
+	/**
+	 * Releases all bound {@link Disposable}s.
+	 * 
+	 * @throws BaseException
+	 *             if there is an error disposing any of the bound disposables
+	 */
+	void releaseAll() throws BaseException;
+
+	/**
+	 * Returns the number of Disposable objects pending to be released.
+	 * 
+	 * @return the number of Disposable objects pending to be released
+	 */
+	int getBoundDisposableCount();
+
+	/**
+	 * Returns a {@link Set} of {@link Disposable} objects currently bound.
+	 * 
+	 * @return
+	 */
+	Set getBoundDisposables();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultStringWithAlias.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultStringWithAlias.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultStringWithAlias.java	(revision 1235)
@@ -0,0 +1,158 @@
+package org.gvsig.tools.packageutils.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.tools.packageutils.StringWithAlias;
+
+public class DefaultStringWithAlias implements StringWithAlias {
+
+	private String value;
+	private List alias = new ArrayList();
+	
+	public DefaultStringWithAlias(String value) {
+		this.value = value;
+	}
+	
+	public StringWithAlias add(String value) {
+		if( value != null ) {
+			if( ! "".equals(value) ) { //isEpty
+				if( ! this.equals(value) ) {
+					this.alias.add(value);
+				}
+			}
+		}
+		return this;
+	}
+
+	public List getAlias() {
+		return Collections.unmodifiableList(this.alias);
+	}
+	
+	public boolean equals(Object other) {
+		if( other == null ) {
+			return false;
+		}
+		Object theOther = other;
+		if( !(other instanceof StringWithAlias) ) {
+			theOther = other.toString(); 
+		} 
+		if( theOther.equals(this.value) ) {
+			return true;
+		}
+		Iterator it = alias.iterator();
+		while( it.hasNext() ) {
+			String value = (String) it.next();
+			if( theOther.equals(value) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public boolean equalsIgnoreCase(Object other) {
+		if( other == null ) {
+			return false;
+		}
+		if( other instanceof StringWithAlias ) {
+			StringWithAlias theOther1 = (StringWithAlias) other;
+			if( theOther1.equalsIgnoreCase(this.value) ) {
+				return true;
+			}
+			Iterator it = alias.iterator();
+			while( it.hasNext() ) {
+				String value = (String) it.next();
+				if( theOther1.equalsIgnoreCase(value) ) {
+					return true;
+				}
+			}
+		}  else {
+			String theOther2 = other.toString();
+			if( theOther2.equalsIgnoreCase(this.value) ) {
+				return true;
+			}
+			Iterator it = alias.iterator();
+			while( it.hasNext() ) {
+				String value = (String) it.next();
+				if( theOther2.equalsIgnoreCase(value) ) {
+					return true;
+				}
+			}
+		}
+		return false;		
+	}
+
+	public boolean endsWith(Object suffix) {
+		String suffixString = suffix.toString(); 
+		if( this.value.endsWith(suffixString) ) {
+			return true;
+		}
+		Iterator it = alias.iterator();
+		while( it.hasNext() ) {
+			String value = (String) it.next();
+			if( value.endsWith(suffixString) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public boolean startsWith(Object suffix) {
+		return this.startsWith(suffix, 0);
+	}
+	
+	public boolean startsWith(Object suffix, int toffset) {
+		String suffixString = suffix.toString(); 
+		if( this.value.startsWith(suffixString, toffset) ) {
+			return true;
+		}
+		Iterator it = alias.iterator();
+		while( it.hasNext() ) {
+			String value = (String) it.next();
+			if( value.startsWith(suffixString, toffset) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public boolean matches(String regex) {
+		if( this.value.matches(regex) ) {
+			return true;
+		}
+		Iterator it = alias.iterator();
+		while( it.hasNext() ) {
+			String value = (String) it.next();
+			if( value.matches(regex) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public int compareTo(Object other) {
+		if( this.equals(other) ) {
+			return 0;
+		}
+		return this.value.compareTo(other.toString());
+	}
+	
+	public int compareToIgnoreCase(Object other) {
+		if( this.equalsIgnoreCase(other) ) {
+			return 0;
+		}
+		return this.value.compareToIgnoreCase(other.toString());
+	}
+	
+	public String toString() {
+		return value;
+	}
+	
+	public String concat(Object other) {
+		return value.concat(other.toString());
+	}
+	
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultStringWithAlias.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependency.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependency.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependency.java	(revision 1235)
@@ -0,0 +1,208 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils.impl;
+
+import java.text.MessageFormat;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.packageutils.Dependency;
+import org.gvsig.tools.packageutils.PackageInfo;
+import org.gvsig.tools.packageutils.StringWithAlias;
+import org.gvsig.installer.lib.api.Version;
+
+public class DefaultDependency implements Dependency {
+
+	protected String type;
+	protected String code;
+	protected String op;
+	protected Version version;
+
+	public DefaultDependency() {
+		super();
+		clear();
+	}
+
+	public DefaultDependency(org.gvsig.installer.lib.api.PackageInfo packageInfo) {
+		this();
+		this.fromPackageInfo(packageInfo);
+	}
+	
+	public void fromPackageInfo(org.gvsig.installer.lib.api.PackageInfo packageInfo) {
+		this.clear();
+		this.code = packageInfo.getCode();
+		this.type = "required";
+		this.op = ">=";
+		this.version = packageInfo.getVersion();
+	}
+
+	public void clear() {
+		this.type = "required";
+		this.code = "unknow";
+		this.op = "=";
+		this.version = ToolsLocator.getPackageManager().createVersion();
+	}
+
+	public org.gvsig.installer.lib.api.Dependency parse(String dependency) {
+		// Parse a string with the dependency specification
+		// (required|suggested|recommended|conflict)[:] code (=|>|<|>=|<=)
+		// version
+		if (dependency == null) {
+			this.clear();
+			return this;
+		}
+		dependency = dependency.trim();
+		if (dependency.equals("")) {
+			this.clear();
+			return this;
+		}
+		
+		String s = dependency;
+		/*
+		 * Remove special characters, so
+		 * dependency description in pom.xml is not
+		 * so fragile
+		 */
+        s = s.replace('\n', ' ');
+        s = s.replace('\t', ' ');
+        s = s.replace('\r', ' ');
+        s = s.replace(':', ' ');
+		
+        /*
+         * Added loop because replaceAll is not
+         * exhaustive in this case
+         */
+        while (s.indexOf("  ") != -1) {
+            s = s.replaceAll("  ", " ");
+        }
+		
+		String[] x = s.split(" ");
+		if (x.length != 4) {
+			throw new InvalidDependencyFormatException(dependency);
+		}
+		
+		this.type = x[0];
+		this.code = x[1];
+		this.op = x[2];
+		this.version.parse(x[3]);
+		return this;
+	}
+
+	private class InvalidDependencyFormatException extends BaseRuntimeException {
+
+		private static final long serialVersionUID = 2856837862117653856L;
+
+		private static final String message = "Error parsing dependecy '%(dependency)s'";
+
+		private static final String KEY = "_Error_parsing_dependecy_XdependecyX";
+
+		public InvalidDependencyFormatException(String dependency) {
+			super(message, null, KEY, serialVersionUID);
+			setValue("dependency", dependency);
+		}
+	}
+
+	public String getType() {
+		return this.type;
+	}
+
+	public String getCode() {
+		return this.code;
+	}
+
+	public String getOp() {
+		return this.op;
+	}
+
+	public Version getVersion() {
+		return this.version;
+	}
+
+	public boolean match(String type, String code, Version version) {
+		if (!this.type.equalsIgnoreCase(type)) {
+			return false;
+		}
+		if (!this.code.equalsIgnoreCase(code)) {
+			return false;
+		}
+		return version.check(this.op, this.version);
+	}
+	
+	public boolean match(String type, StringWithAlias code, Version version) {
+		if (!this.type.equalsIgnoreCase(type)) {
+			return false;
+		}
+		if (!code.equalsIgnoreCase(this.code)) {
+			return false;
+		}
+		return version.check(this.op, this.version);
+	}
+
+	public String toString() {
+		return MessageFormat.format("{0}: {1} {2} {3}",
+			new Object[] {
+				this.type, 
+				this.code,
+				this.op, 
+				this.version.toString()
+		}
+		);
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		DefaultDependency x = (DefaultDependency) super.clone();
+		x.version = (Version) this.version.clone();
+		return x;
+	}
+
+	public boolean equals(Object obj) {
+		Dependency other;
+		try {
+			other = (Dependency) obj;
+		} catch (Exception ex) {
+			return false;
+		}
+		if (!this.code.equalsIgnoreCase(other.getCode())) {
+			return false;
+		}
+		if (!this.type.equalsIgnoreCase(other.getType())) {
+			return false;
+		}
+		if (!this.op.equalsIgnoreCase(other.getOp())) {
+			return false;
+		}
+		if (!this.version.equals(other.getVersion())) {
+			return false;
+		}
+		return true;
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	public int hashCode() {
+	    return version.hashCode() + code.hashCode()
+	        + type.hashCode() + op.hashCode();
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependency.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileWriter.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileWriter.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileWriter.java	(revision 1235)
@@ -0,0 +1,95 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Properties;
+
+import org.gvsig.tools.packageutils.PackageInfo;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public class PackageInfoFileWriter {
+
+	public void write(PackageInfo packageInfo, String fileName)
+			throws IOException {
+		write(packageInfo, new File(fileName));
+	}
+
+	public void write(PackageInfo packageInfo, File file)
+			throws IOException {
+		write(packageInfo, new FileOutputStream(file));
+	}
+
+	public void write(PackageInfo pkg, OutputStream os) throws IOException {
+		Properties props = new Properties();
+
+		props.setProperty(PackageInfoTags.CODE, pkg.getCode());
+		
+		String codealias1 = null;
+		List codealias2 = pkg.getAllCodes().getAlias();  
+		for( int i=0; i<codealias2.size(); i++ ) {
+			if( codealias1 == null ) {
+				codealias1 = ((String) codealias2.get(i)).trim();
+			} else {
+				codealias1 = codealias1 +","+((String) codealias2.get(i)).trim();
+			}
+		}
+		if( codealias1==null ) {
+			codealias1 = "";
+		}
+		props.setProperty(PackageInfoTags.CODEALIAS, toStr(codealias1));
+		props.setProperty(PackageInfoTags.NAME, toStr(pkg.getName()));
+		props.setProperty(PackageInfoTags.DESCRIPTION, toStr(pkg.getDescription()));
+		props.setProperty(PackageInfoTags.VERSION, pkg.getVersion().toString());
+		props.setProperty(PackageInfoTags.STATE, toStr(pkg.getState()));
+		props.setProperty(PackageInfoTags.OFFICIAL,
+				Boolean.toString(pkg.isOfficial()));
+		props.setProperty(PackageInfoTags.TYPE, toStr(pkg.getType()));
+		props.setProperty(PackageInfoTags.OS, toStr(pkg.getOperatingSystem()));
+		props.setProperty(PackageInfoTags.ARCHITECTURE, toStr(pkg.getArchitecture()));
+		props.setProperty(PackageInfoTags.JVM, toStr(pkg.getJavaVM()));
+		props.setProperty(PackageInfoTags.APPLICATION_VERSION, toStr(pkg.getApplicationVersion()));
+		props.setProperty(PackageInfoTags.OWNER, toStr(pkg.getOwner()));
+		props.setProperty(PackageInfoTags.CATEGORIES, toStr(pkg.getCategoriesAsString()));
+		props.setProperty(PackageInfoTags.DEPENDENCIES, toStr(pkg.getDependencies()));
+		props.setProperty(PackageInfoTags.SOURCES_URL, toStr(pkg.getSourcesURL()));
+		props.setProperty(PackageInfoTags.WEB_URL, toStr(pkg.getWebURL()));
+		props.setProperty(PackageInfoTags.DOWNLOAD_URL, toStr(pkg.getDownloadURLAsString()));
+		props.setProperty(PackageInfoTags.OWNER_URL, toStr(pkg.getOwnerURL()));
+		props.setProperty(PackageInfoTags.MODEL_VERSION, toStr(pkg.getModelVersion()));
+		props.store(os, "");
+		os.close();
+	}
+
+	private String toStr(Object s) {
+		return s == null ? "" : s.toString();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoTags.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoTags.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoTags.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.tools.packageutils.impl;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public class PackageInfoTags {
+
+	public static final String CODE = "code";
+	public static final String CODEALIAS = "code-alias";
+	public static final String NAME = "name";
+	public static final String DESCRIPTION = "description";
+	public static final String VERSION = "version";
+	public static final String BUILD = "buildNumber";
+	public static final String BUILD_OLD = "build";
+	public static final String STATE = "state";
+	public static final String OFFICIAL = "official";
+	public static final String TYPE = "type";
+	public static final String OS = "operating-system";
+	public static final String ARCHITECTURE = "architecture";
+	public static final String JVM = "java-version";
+	/** @deprecated use APPLICATION_VERSION */
+	public static final String GVSIG_VERSION = "gvSIG-version";
+	public static final String APPLICATION_VERSION = "application-version";
+	public static final String DOWNLOAD_URL = "download-url";
+	public static final String MODEL_VERSION = "model-version";
+	public static final String OWNER = "owner";
+	public static final String OWNER_URL = "owner-url";
+	public static final String SOURCES_URL = "sources-url";
+	public static final String WEB_URL = "web-url";
+	public static final String DEPENDENCIES = "dependencies";
+	public static final String CATEGORIES = "categories";
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoTags.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultVersion.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultVersion.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultVersion.java	(revision 1235)
@@ -0,0 +1,275 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils.impl;
+
+import java.security.InvalidParameterException;
+import java.text.MessageFormat;
+
+import org.gvsig.tools.packageutils.Version;
+
+public class DefaultVersion implements Version {
+
+	private int major = 0;
+	private int minor = 0;
+	private int rev = 0;
+	private String classifier = null;
+	private int build = 0;
+
+	public DefaultVersion() {
+		super();
+	}
+
+	protected DefaultVersion(int mayor, int minor, int rev, String classifier,
+			int build) {
+		this();
+		this.major = mayor;
+		this.minor = minor;
+		this.rev = rev;
+		this.classifier = classifier;
+		this.build = build;
+	}
+
+	public org.gvsig.installer.lib.api.Version parse(String version) {
+		try {
+			if( version == null || version.length()==0 ) {
+				this.major = 0;
+				this.minor = 0;
+				this.rev = 0;
+				this.classifier = null;
+				this.build = 0;
+				return this;
+			}
+			// Formato: mayor.minor.rev-classifier-build
+	
+			String[] x = version.split("[.]");
+			int lx = x.length;
+			if (lx == 1) {
+				this.major = parseIntClassifierAndBuild(x[0], version);
+				this.minor = 0;
+				this.rev = 0;
+				this.classifier = null;
+				this.build = 0;
+			} else if (lx == 2) {
+				this.major = Integer.parseInt(x[0]);
+				this.minor = parseIntClassifierAndBuild(x[1], version);
+				this.rev = 0;
+				this.classifier = null;
+				this.build = 0;
+			} else if (lx == 3) {
+				this.major = Integer.parseInt(x[0]);
+				this.minor = Integer.parseInt(x[1]);
+				this.rev = parseIntClassifierAndBuild(x[2], version);
+			} else {
+				throw new InvalidParameterException(version);
+			}
+		} catch(InvalidParameterException ex) {
+			throw ex;
+		} catch(Exception ex) {
+			InvalidParameterException e = new InvalidParameterException(version);
+			e.initCause(ex);
+			throw e;
+		}
+		return this;
+	}
+
+	private int parseIntClassifierAndBuild(String s, String fullversion) {
+		int value;
+
+		String[] y = s.split("[-]");
+		int ly = y.length;
+		if (ly == 1) {
+			value = Integer.parseInt(y[0]);
+			this.classifier = null;
+			this.build = 0;
+		} else if (ly == 2) {
+			value = Integer.parseInt(y[0]);
+			try {
+				this.build = Integer.parseInt(y[1]);
+				this.classifier = null;
+			} catch (NumberFormatException e) {
+				this.build = 0;
+				this.classifier = y[1];
+			}
+		} else if (ly == 3) {
+			value = Integer.parseInt(y[0]);
+			this.classifier = y[1];
+			this.build = Integer.parseInt(y[2]);
+		} else {
+			throw new InvalidParameterException(fullversion);
+		}
+		return value;
+	}
+
+	public int getMajor() {
+		return this.major;
+	}
+	
+
+    public int getMayor() {
+        return getMajor();
+    }
+
+	public int getMinor() {
+		return this.minor;
+	}
+
+	public int getRevision() {
+		return this.rev;
+	}
+
+	public String getClassifier() {
+		return this.classifier;
+	}
+
+	public int getBuild() {
+		return this.build;
+	}
+
+	public boolean check(String op, org.gvsig.installer.lib.api.Version other) {
+		if ("=".equals(op) || "==".equals(op) || "-eq".equals(op)) {
+			return this.fullFormat().compareTo(other.fullFormat()) == 0;
+		}
+		if (">".equals(op) || "-gt".equals(op)) {
+			return this.fullFormat().compareTo(other.fullFormat()) > 0;
+		}
+		if (">=".equals(op) || "-ge".equals(op)) {
+			return this.fullFormat().compareTo(other.fullFormat()) >= 0;
+		}
+		if ("<".equals(op) || "-lt".equals(op)) {
+			return this.fullFormat().compareTo(other.fullFormat()) < 0;
+		}
+		if ("<=".equals(op) || "-le".equals(op)) {
+			return this.fullFormat().compareTo(other.fullFormat()) <= 0;
+		}
+		return false;
+	}
+
+	public String toString() {
+		if (this.classifier == null) {
+			return MessageFormat.format("{0}.{1}.{2}-{3,number,####}", 
+				new Object[] {
+					new Integer(this.major), 
+					new Integer(this.minor), 
+					new Integer(this.rev),
+					new Integer(this.build)
+				}
+			);
+		} else {
+			return MessageFormat.format("{0}.{1}.{2}-{3}-{4,number,####}",
+				new Object[] {
+					new Integer(this.major), 
+					new Integer(this.minor), 
+					new Integer(this.rev),
+					this.classifier,
+					new Integer(this.build)
+				}
+			);
+		}
+	}
+
+	public String fullFormat() {
+		if (this.classifier == null) {
+			// classifier ZZZZ allows compare correctly tow versions
+			return MessageFormat.format(
+				"{0,number,0000}.{1,number,0000}.{2,number,0000}-ZZZZ-{3,number,0000}",
+				new Object[] {
+						new Integer(this.major), 
+						new Integer(this.minor), 
+						new Integer(this.rev),
+						new Integer(this.build)
+					}
+				);
+		} else {
+			return MessageFormat.format(
+				"{0,number,0000}.{1,number,0000}.{2,number,0000}-{3}-{4,number,0000}",
+				new Object[] {
+						new Integer(this.major), 
+						new Integer(this.minor), 
+						new Integer(this.rev),
+						this.classifier,
+						new Integer(this.build)
+					}
+				);
+		}
+	}
+	
+	public int compareTo(Object arg0) {
+		Version other = (Version)arg0;
+		return this.fullFormat().compareTo(other.fullFormat());
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		return super.clone();
+	}
+
+	public boolean equals(Object obj) {
+		if( obj==null ) {
+			return false;
+		}
+		Version other = (Version) obj;
+		if (this.major != other.getMajor()) {
+			return false;
+		}
+		if (this.minor != other.getMinor()) {
+			return false;
+		}
+		if (this.rev != other.getRevision()) {
+			return false;
+		}
+		if (this.build != other.getBuild()) {
+			return false;
+		}
+		if (this.classifier == null) {
+			if (other.getClassifier() == null) {
+				return true;
+			} else {
+				return false;
+			}
+		}
+		if (!this.classifier.equalsIgnoreCase(other.getClassifier())) {
+			return false;
+		}
+		return true;
+	}
+	
+	public int hashCode() {
+	    return (classifier == null ? 0 : classifier.hashCode()) +
+	        (major<<13) + (minor<<19) + (rev<<25) + build;
+	}
+
+	public org.gvsig.installer.lib.api.Version setBuild(int build) {
+		this.build = build;
+		return this;
+	}
+	
+	public String format(String fmt) {
+		String s = fmt;
+		s = s.replaceAll("%M", String.valueOf(this.major));
+		s = s.replaceAll("%m", String.valueOf(this.minor));
+		s = s.replaceAll("%r", String.valueOf(this.rev));
+		s = s.replaceAll("%c", this.classifier);
+		s = s.replaceAll("%b", String.valueOf(this.build));
+		return s;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultVersion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileReader.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileReader.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileReader.java	(revision 1235)
@@ -0,0 +1,133 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.tools.packageutils.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+import org.apache.commons.lang3.StringUtils;
+
+import org.gvsig.tools.packageutils.PackageInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PackageInfoFileReader {
+
+	private static final Logger logger = LoggerFactory
+			.getLogger(PackageInfoFileReader.class);
+
+	public void read(PackageInfo packageInfo, String fileName) throws IOException, FileNotFoundException {
+		this.read(packageInfo, new File(fileName));
+	}
+
+	public void read(PackageInfo packageInfo, File file) throws IOException, FileNotFoundException {
+		this.read(packageInfo, new FileInputStream(file));
+	}
+
+	public void read(PackageInfo packageInfo, InputStream is) throws IOException {
+		Properties properties = new Properties();
+		properties.load(is);
+		is.close();
+		read(packageInfo, properties);
+	}
+	
+	public void read(PackageInfo packageInfo, Properties properties ) {
+
+		packageInfo.setCode(properties.getProperty(PackageInfoTags.CODE));
+		
+		String codealias1 = properties.getProperty(PackageInfoTags.CODEALIAS);
+		if( codealias1 != null ) {
+			String[] s = codealias1.split(",");
+			for( int i=0; i<s.length; i++) {
+				s[i] = s[i].trim();
+				if(! "".equals(s[i]) ) { // isEmpty
+					packageInfo.getAllCodes().add(s[i]);
+				}
+			}
+		}
+		
+		packageInfo.setName(properties.getProperty(PackageInfoTags.NAME));
+		
+		String pkgName = packageInfo.getName();
+		
+		packageInfo.setDescription(properties.getProperty(PackageInfoTags.DESCRIPTION));
+		packageInfo.getVersion().parse(properties.getProperty(PackageInfoTags.VERSION));
+		String build = properties.getProperty(PackageInfoTags.BUILD);
+		if( build!=null ) {
+			try {
+				int buildNumber = Integer.parseInt(build);
+				packageInfo.getVersion().setBuild(buildNumber);
+			} catch(Exception e) {
+				// Ignore
+			}
+		}
+		packageInfo.setType(properties.getProperty(PackageInfoTags.TYPE));
+		packageInfo.setState(properties.getProperty(PackageInfoTags.STATE));
+		packageInfo.setOfficial(Boolean.valueOf(properties.getProperty(PackageInfoTags.OFFICIAL)).booleanValue());
+		packageInfo.setOperatingSystem(properties.getProperty(PackageInfoTags.OS));
+		packageInfo.setArchitecture(properties.getProperty(PackageInfoTags.ARCHITECTURE));
+		packageInfo.setJavaVM(properties.getProperty(PackageInfoTags.JVM));
+		String value = properties.getProperty(PackageInfoTags.APPLICATION_VERSION);
+		if( value == null ) {
+			value = properties.getProperty(PackageInfoTags.GVSIG_VERSION);
+		}
+		packageInfo.getApplicationVersion().parse(value);
+		packageInfo.setDownloadURL(properties.getProperty(PackageInfoTags.DOWNLOAD_URL));
+		packageInfo.setModelVersion(properties.getProperty(PackageInfoTags.MODEL_VERSION));
+		packageInfo.setOwner(properties.getProperty(PackageInfoTags.OWNER));
+		packageInfo.setDependencies(properties.getProperty(PackageInfoTags.DEPENDENCIES));
+		packageInfo.setSourcesURL(getUrl(properties, PackageInfoTags.SOURCES_URL, pkgName));
+		packageInfo.setWebURL(getUrl(properties, PackageInfoTags.WEB_URL, pkgName));
+		packageInfo.setOwnerURL(getUrl(properties, PackageInfoTags.OWNER_URL, pkgName));
+		packageInfo.addCategoriesAsString(properties.getProperty(PackageInfoTags.CATEGORIES));
+	}
+	
+	private URL getUrl(Properties properties, String name, String pkgName) {
+		String s = properties.getProperty(name);
+		if ( !StringUtils.isBlank(s) ) {
+			URL url;
+			try {
+				url = new URL(s);
+			} catch (MalformedURLException e) {
+				logger.info("Malformed url for '"+name+"' in package '"+pkgName+"', url='"+s+"'.");
+				return null;
+			}
+			return url;
+		} else {
+			return null;
+		}
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/PackageInfoFileReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependencies.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependencies.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependencies.java	(revision 1235)
@@ -0,0 +1,192 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.packageutils.Dependencies;
+import org.gvsig.tools.packageutils.StringWithAlias;
+import org.gvsig.installer.lib.api.Dependency;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.installer.lib.api.Version;
+
+public class DefaultDependencies extends ArrayList implements
+		Dependencies {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6743931124069465522L;
+
+	private Dependency createDependency() {
+		PackageManager manager = ToolsLocator.getPackageManager();
+		return manager.createDependency();
+	}
+	
+	public Object clone() {
+		PackageManager manager = ToolsLocator.getPackageManager();
+		Dependencies other = manager.createDependencies();
+		Iterator it = this.iterator();
+		while( it.hasNext() ) {
+			Dependency dependency = (Dependency) it.next();
+			try {
+				other.add(dependency.clone());
+			} catch (CloneNotSupportedException e) {
+				// This exception can by done
+			}
+		}
+		return other;
+	}
+	
+
+	public org.gvsig.installer.lib.api.Dependencies parse(String dependecies) {
+		if (dependecies == null) {
+			this.clear();
+			return this;
+		}
+		dependecies = dependecies.trim();
+		if (dependecies.equals("")) {
+			this.clear();
+			return this;
+		}
+
+		String[] x = dependecies.split(",");
+		for (int i = 0; i < x.length; i++) {
+			this.add(createDependency().parse(x[i]));
+		}
+		return this;
+	}
+
+	public String toString() {
+		StringBuffer s = null;
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			if (s == null) {
+				s = new StringBuffer();
+			} else {
+				s.append(", ");
+			}
+			s.append(it.next().toString());
+		}
+		if (s == null) {
+			return "";
+		}
+		return s.toString();
+	}
+
+	public boolean contains(Object o) {
+		if (!(o instanceof Dependency)) {
+			return false;
+		}
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Dependency dep = (Dependency) it.next();
+			if (dep.equals(o)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public boolean match(String type, String code, Version version) {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Dependency dependency = (Dependency) it.next();
+			if (dependency.match(type, code, version)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public Dependency find(String type, String code, Version version) {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Dependency dependency = (Dependency) it.next();
+			if (dependency.match(type, code, version)) {
+				return dependency;
+			}
+		}
+		return null;
+	}
+	
+    public List findAll(String type, String code, Version version) {
+        
+        List resp = null;
+         Iterator it = this.iterator();
+         while (it.hasNext()) {
+             Dependency dependency = (Dependency) it.next();
+             if (dependency.match(type, code, version)) {
+                 if (resp == null) {
+                     resp = new ArrayList();
+                 }
+                 resp.add(dependency);
+             }
+         }
+         return resp;
+     }
+
+	public boolean match(String type, StringWithAlias code, Version version) {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Dependency dependency = (Dependency) it.next();
+			if (dependency.match(type, code, version)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public Dependency find(String type, StringWithAlias code, Version version) {
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Dependency dependency = (Dependency) it.next();
+			if (dependency.match(type, code, version)) {
+				return dependency;
+			}
+		}
+		return null;
+	}
+	
+    public List findAll(String type, StringWithAlias code, Version version) {
+        
+        List resp = null;
+         Iterator it = this.iterator();
+         while (it.hasNext()) {
+             Dependency dependency = (Dependency) it.next();
+             if (dependency.match(type, code, version)) {
+                 if (resp == null) {
+                     resp = new ArrayList();
+                 }
+                 resp.add(dependency);
+             }
+         }
+         return resp;
+     }
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultDependencies.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageManager.java	(revision 1235)
@@ -0,0 +1,148 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.packageutils.Dependencies;
+import org.gvsig.tools.packageutils.Dependency;
+import org.gvsig.tools.packageutils.PackageInfo;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.tools.packageutils.Version;
+
+public class DefaultPackageManager implements PackageManager {
+
+	public Version createVersion() {
+		return new DefaultVersion();
+	}
+
+	public PackageInfo createPackageInfo() {
+		return new DefaultPackageInfo();
+	}
+
+	public PackageInfo createPackageInfo(InputStream packegeinfo)
+			throws BaseException {
+		PackageInfo pkg = createPackageInfo();
+		try {
+			this.readPacakgeInfo(pkg, packegeinfo);
+		} catch (IOException e) {
+			throw new BaseIOException(e);
+		}
+		return pkg;
+	}
+
+	public PackageInfo createPackageInfo(File packegeinfo) throws BaseException {
+		PackageInfo pkg = createPackageInfo();
+		try {
+			this.readPacakgeInfo(pkg, packegeinfo);
+		} catch (IOException e) {
+			throw new BaseIOException(packegeinfo, e);
+		}
+		return pkg;
+	}
+
+	public Dependency createDependency() {
+		return new DefaultDependency();
+	}
+
+	public Dependency createDependency(PackageInfo packageInfo) {
+		DefaultDependency dependency = (DefaultDependency) this.createDependency();
+		dependency.fromPackageInfo(packageInfo);
+		return dependency;
+	}
+
+	public Dependencies createDependencies() {
+		return new DefaultDependencies();
+	}
+	
+	public String getOperatingSystem() {
+		String osname = System.getProperty("os.name");
+		if (osname.toLowerCase().startsWith("linux")) {
+			return OS.LINUX;
+		}
+		if (osname.toLowerCase().startsWith("window")) {
+			return OS.WINDOWS;
+		}
+		return osname;
+	}
+
+	public String getArchitecture() {
+		String osarch = System.getProperty("os.arch");
+		if (osarch.toLowerCase().startsWith("i386")) {
+			return ARCH.X86;
+		}
+		if (osarch.toLowerCase().startsWith("x86")) {
+			return ARCH.X86;
+		}
+		if (osarch.toLowerCase().startsWith("amd64")) {
+			return ARCH.X86_64;
+		}
+		return osarch;	}
+
+	public void writePacakgeInfo(PackageInfo packageInfo, File file)
+			throws IOException {
+		PackageInfoFileWriter writer = new PackageInfoFileWriter();
+		writer.write(packageInfo, file);
+	}
+
+	public void writePacakgeInfo(PackageInfo pkg, OutputStream os)
+			throws IOException {
+		PackageInfoFileWriter writer = new PackageInfoFileWriter();
+		writer.write(pkg, os);
+	}
+
+	public void readPacakgeInfo(PackageInfo packageInfo, File file)
+			throws IOException {
+		PackageInfoFileReader reader = new PackageInfoFileReader();
+		reader.read(packageInfo, file);
+	}
+
+	public void readPacakgeInfo(PackageInfo pkg, InputStream is)
+			throws IOException {
+		PackageInfoFileReader reader = new PackageInfoFileReader();
+		reader.read(pkg, is);
+	}
+
+	public class BaseIOException extends BaseException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 3154855738763990310L;
+		
+		public BaseIOException(Throwable cause) {
+			super("Can't load package info","_Cant_load_package_info", serialVersionUID);
+		}
+		
+		public BaseIOException(File file, Throwable cause) {
+			super("Can't load package info %(file)","_Cant_load_package_info_XfileX", serialVersionUID);
+			setValue("file",file);
+		}
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageInfo.java	(revision 1235)
@@ -0,0 +1,771 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.tools.packageutils.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.InvalidParameterException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.installer.lib.api.Dependencies;
+import org.gvsig.installer.lib.api.Version;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.packageutils.PackageInfo;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.tools.packageutils.PackageManager.ARCH;
+import org.gvsig.tools.packageutils.PackageManager.JVM;
+import org.gvsig.tools.packageutils.PackageManager.OS;
+import org.gvsig.tools.packageutils.PackageManager.STATE;
+import org.gvsig.tools.packageutils.StringWithAlias;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public class DefaultPackageInfo implements PackageInfo {
+
+    private static final Logger logger = LoggerFactory
+        .getLogger(DefaultPackageInfo.class);
+
+	public static interface PACKAGE_FILE_NAME_FIELDS {
+		static final int GVSIG_VERSION = 0;
+		static final int NAME = 1;
+		static final int VERSION = 2;
+		static final int BUILD = 3;
+		static final int STATE = 4;
+		static final int OS = 5;
+		static final int ARCH = 6;
+		static final int JVM = 7;
+	}
+	private static final String PACKAGE_NAME_FORMAT = "gvSIG-desktop-{0}-{1}-{2}-{4}-{5}-{6}-{7}.gvspkg";
+	
+	private static final String DEFAULT_MODEL_VERSION = "1.0.1";
+	private static final String DEFAULT_TYPE = "unknow";
+	
+    private StringWithAlias code = null;
+    private String name = null;
+    private String description = null;
+    private Version version = null;
+    private boolean official;
+    private String type = DEFAULT_TYPE;
+    private boolean broken = false;
+
+    private String state = STATE.DEVEL;
+    private String operatingSystem = OS.ALL;
+    private String architecture = ARCH.ALL;
+    private String javaVM = JVM.J1_5;
+
+    private String owner = "";
+    private URL ownerURL = null;
+    private URL sources = null;
+    private Version applicationVersion = null;
+
+    private String defaultDownloadURL = null;
+
+    private String modelVersion = DEFAULT_MODEL_VERSION;
+    private Dependencies dependencies = null;
+    private List categories = null;
+
+    private URL webURL = null;
+    
+    private String postInstallScript = null;
+    
+    private Map aditionalProperties = null;
+
+    public DefaultPackageInfo() {
+        super();
+        PackageManager manager = ToolsLocator.getPackageManager();
+        this.version = manager.createVersion().parse("0.0.1");
+        this.applicationVersion = manager.createVersion().parse("0.0.1");
+        this.dependencies = manager.createDependencies();
+        this.categories = new ArrayList();
+        this.aditionalProperties = new HashMap();
+    }
+
+    public String getCode() {
+    	if( code == null ) {
+    		return null;
+    	}
+        return code.toString();
+    }
+    
+    public StringWithAlias getAllCodes() {
+    	return this.code;
+    }
+    
+    private String getAliasAsString() {
+    	if( this.code == null ) {
+    		return "";
+    	}
+    	StringBuffer s = new StringBuffer();
+    	Iterator alias = this.code.getAlias().iterator();
+    	while( alias.hasNext() ) {
+    		String ss = (String) alias.next();
+    		s.append(ss);
+    		if( alias.hasNext() ) {
+    			s.append(", ");
+    		}
+    	}
+    	return s.toString();
+    }    
+    public boolean hasThisCode(String code) {
+    	if( this.code == null ) {
+    		if( code == null ) {
+    			return true;
+    		}
+    		return false;
+    	}
+    	return this.code.equalsIgnoreCase(code);
+    }
+    
+    public boolean hasThisCode(StringWithAlias code) {
+    	if( this.code == null ) {
+    		if( code == null ) {
+    			return true;
+    		}
+    		return false;
+    	}
+    	return this.code.equalsIgnoreCase(code);
+    }
+    
+    public String getID() {
+        String id =
+            this.getCode() + "#" + this.getVersion() 
+                + "#" + this.getOperatingSystem() + "#"
+                + this.getArchitecture();
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Version getVersion() {
+        return version;
+    }
+    
+    public String getState() {
+        return state;
+    }
+
+    public boolean isOfficial() {
+        return official;
+    }
+
+    public void setCode(String code) {
+    	if( code == null ) {
+    		this.code = null;
+    	} else {
+    		this.code = new DefaultStringWithAlias(code);
+    	}
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setVersion(Version version) {
+        try {
+            this.version = (Version) version.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void setState(String state) {
+    	if( isEmptyString(state) ) {
+    		this.state = STATE.DEVEL;
+    	} else {
+    		this.state = state;
+    	}
+    }
+
+    public void setOfficial(boolean official) {
+        this.official = official;
+    }
+
+    public String getOperatingSystem() {
+        return operatingSystem;
+    }
+
+    public void setOperatingSystem(String operatingSystem) {
+    	if( isEmptyString(operatingSystem) ) {
+    		this.operatingSystem = OS.ALL;
+    	} else {
+    		this.operatingSystem = operatingSystem;
+    	}
+    }
+
+    public String getArchitecture() {
+        return architecture;
+    }
+
+    public void setArchitecture(String architecture) {
+    	if( isEmptyString(architecture) ) {
+    		this.architecture = ARCH.ALL;
+    	} else {
+    		this.architecture = architecture;
+    	}
+    }
+
+    public String getJavaVM() {
+        return javaVM;
+    }
+
+    public void setJavaVM(String javaVM) {
+    	if( isEmptyString(javaVM) ) {
+    		this.javaVM = JVM.J1_5;
+    	} else {
+    		this.javaVM = javaVM;
+    	}
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+    	if( isEmptyString(type) ) {
+    		this.type = DEFAULT_TYPE;
+    	} else {
+    		this.type = type;
+    	}
+    }
+
+    public Version getApplicationVersion() {
+        return applicationVersion;
+    }
+
+    public void setApplicationVersion(Version applicationVersion) {
+        this.applicationVersion = applicationVersion;
+    }
+
+    public URL getDownloadURL() {
+    	if( this.defaultDownloadURL == null ) {
+    		return null;
+    	}
+    	try {
+            return new URL(this.defaultDownloadURL);
+        } catch (MalformedURLException e) {
+        	return null;
+//            throw new RuntimeException(
+//                "Error converting to URL the package download url "+ this.defaultDownloadURL,
+//                e);
+        }
+    }
+
+    public String getDownloadURLAsString() {
+        return this.defaultDownloadURL;
+    }
+
+    public void setDownloadURL(URL defaultDownloadURL) {
+        this.defaultDownloadURL = defaultDownloadURL.toString();
+    }
+
+    public void setDownloadURL(String defaultDownloadURL) {
+        this.defaultDownloadURL = defaultDownloadURL;
+    }
+
+    public String getModelVersion() {
+        return modelVersion;
+    }
+
+    public void setModelVersion(String modelVersion) {
+    	if( isEmptyString(modelVersion) ) {
+    		this.modelVersion = DEFAULT_MODEL_VERSION;
+    	} else {
+    		this.modelVersion = modelVersion;
+    	}
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public URL getOwnerURL() {
+        return ownerURL;
+    }
+
+    public void setOwnerURL(URL sources) {
+        this.ownerURL = sources;
+    }
+
+    public URL getSourcesURL() {
+        return sources;
+    }
+
+    public void setSourcesURL(URL sources) {
+        this.sources = sources;
+    }
+
+    public String toString() {
+        StringBuffer buffer = new StringBuffer(super.toString()).append(" (");
+
+        append(buffer, PackageInfoTags.CODE, getCode());
+        append(buffer, PackageInfoTags.NAME, getName());
+        append(buffer, PackageInfoTags.DESCRIPTION, getDescription());
+        append(buffer, PackageInfoTags.APPLICATION_VERSION, getApplicationVersion());
+        append(buffer, PackageInfoTags.VERSION, getVersion());
+        append(buffer, PackageInfoTags.OS, getOperatingSystem());
+        append(buffer, PackageInfoTags.ARCHITECTURE, getArchitecture());
+        append(buffer, PackageInfoTags.JVM, getJavaVM());
+        append(buffer, PackageInfoTags.DOWNLOAD_URL, getDownloadURL());
+        append(buffer, PackageInfoTags.STATE, getState());
+        append(buffer, PackageInfoTags.OFFICIAL, Boolean.valueOf(isOfficial()));
+        append(buffer, PackageInfoTags.TYPE, getType());
+        append(buffer, PackageInfoTags.MODEL_VERSION, getModelVersion());
+        append(buffer, PackageInfoTags.OWNER, getOwner());
+        append(buffer, PackageInfoTags.OWNER_URL, getOwnerURL());
+        append(buffer, PackageInfoTags.SOURCES_URL, getSourcesURL());
+        append(buffer, PackageInfoTags.DEPENDENCIES, getDependencies());
+        append(buffer, PackageInfoTags.WEB_URL, getWebURL());
+        append(buffer, PackageInfoTags.CATEGORIES, getCategories());
+        append(buffer, PackageInfoTags.CODEALIAS, getAliasAsString());
+
+        return buffer.append(')').toString();
+    }
+
+//    public String toStringCompact() {
+//        // type code version state os arch jvm dep
+//        return String.format(
+//                "%1$-8.4s %2$-40s %3$-20.20s %4$-5.5s %5$-5.5s %6$-6.6s %7$-5.5s %8$s",
+//                new Object[] {
+//	                this.type, 
+//	                this.code, 
+//	                this.version, 
+//	                this.state,
+//	                this.operatingSystem, 
+//	                this.architecture, 
+//	                this.javaVM,
+//	                this.dependencies
+//                }
+//        	);
+//    }
+
+    public String toStringCompact() {
+        // type code version state os arch jvm dep alias
+    	StringBuffer s = new StringBuffer();
+    	s.append(strformat(this.type,-8,-4));
+    	s.append(" ");
+    	s.append(strformat(this.code,-40,0));
+    	s.append(" ");
+    	s.append(strformat(this.version,-20,-20)); 
+    	s.append(" ");
+    	s.append(strformat(this.state,-5,-5));
+    	s.append(" ");
+    	s.append(strformat(this.operatingSystem,-5,-5)); 
+    	s.append(" ");
+    	s.append(strformat(this.architecture,-6,-6));
+    	s.append(" ");
+    	s.append(strformat(this.javaVM,-5,-5));
+    	s.append(" ");
+    	s.append(strformat(this.dependencies,-8,0));
+    	s.append(" ");
+    	s.append(strformat(this.getAliasAsString(),-8,0));
+    	return s.toString();
+    }
+
+    private static final String SPACES256 = "                                                                                                                                                                                                                                                               ";
+    
+    private String strformat(Object o, int min, int max) {
+    	String s;
+    	boolean alignright = true;
+    	if( o == null ) {
+    		s = "null";
+    	} else {
+    		s = o.toString();
+    	}
+    	if( min < 0 ) {
+    		min = - min;
+    		alignright = false;
+    	}
+    	if( max == 0 ) {
+    	    if( s.length() < min ) {
+        		if( alignright ) {
+        			s = SPACES256+s;
+        			s = s.substring(s.length()-min);
+        		} else {
+        			s = (s + SPACES256).substring(0, min);
+        		}
+	    	}
+    	} else {
+    		if( max > 225) {
+    			max = 256;
+    		} else if( max < 0 ) {
+    			max = -max;
+        		alignright = false;
+    		}
+    		if( alignright ) {
+    			if( s.length() > max ) {
+		    		s = s.substring(0, max);
+		    	}
+	    	    if( s.length() < min ) {
+	    			s = SPACES256.substring(0,min-s.length())+s;
+		    	}
+    		} else {
+		    	if( s.length() > max ) {
+		    		s = s.substring(0, max);
+		    	}
+		    	if( s.length() < min ) {
+		    		s = s + SPACES256.substring(0,min-s.length());
+		    	}
+    		}
+    	}
+    	return s;
+    }
+	
+    private DefaultPackageInfo append(StringBuffer buffer, String key,
+        Object value) {
+        buffer.append("\n\t").append(key).append(": ")
+            .append(value == null ? "" : value);
+        return this;
+    }
+
+    public Object clone() throws CloneNotSupportedException {
+        DefaultPackageInfo other = (DefaultPackageInfo) super.clone();
+        
+        /*
+         * If setDependencies is called with "" then
+         * dependencies is set to null, so we must check this:
+         */
+        if (this.dependencies == null) {
+            other.dependencies = null;
+        } else {
+            other.dependencies = (Dependencies) this.dependencies.clone();
+        }
+
+        other.version = (Version) this.version.clone();
+        other.applicationVersion = (Version) this.applicationVersion.clone();
+        other.categories = new ArrayList();
+        other.categories.addAll(this.categories);
+        other.aditionalProperties = new HashMap(this.aditionalProperties);
+        return other;
+    }
+
+
+    public boolean matchID(String string) {
+        String id = this.getID();
+        String[] stringParts = string.split("#");
+
+        switch (stringParts.length) {
+        case 1:
+            if (stringParts[0].equals(this.getCode())) {
+                return true;
+            } else {
+                return false;
+            }
+        case 2:
+            if (!stringParts[0].equals(this.getCode())) {
+                return false;
+            }
+            Version version = new DefaultVersion();
+            try {
+                version.parse(stringParts[1]);
+            } catch (InvalidParameterException ex) {
+                return false;
+            }
+
+            if (version.equals(this.getVersion())) {
+                return true;
+            }
+            return false;
+        default:
+            return string.equals(id);
+
+        }
+
+    }
+
+    public Dependencies getDependencies() {
+        return this.dependencies;
+    }
+
+    public void setDependencies(Dependencies dependencies) {
+        this.dependencies = dependencies;
+    }
+
+    public void setDependencies(String dependencies) {
+        if ( isEmptyString(dependencies)) {
+            this.dependencies = null;
+        } else {
+            this.dependencies = new DefaultDependencies().parse(dependencies);
+        }
+    }
+
+    public boolean equals(Object obj) {
+        PackageInfo other;
+        try {
+            other = (PackageInfo) obj;
+        } catch (Exception e) {
+            return false;
+        }
+        if (!code.equalsIgnoreCase(other.getCode())) {
+            return false;
+        }
+        if (!version.check("=", other.getVersion())) {
+            return false;
+        }
+        if (!operatingSystem.equalsIgnoreCase(other.getOperatingSystem())) {
+            return false;
+        }
+        if (!applicationVersion.equals(other.getApplicationVersion())) {
+            return false;
+        }
+        if (!state.equalsIgnoreCase(other.getState())) {
+            return false;
+        }
+        if (!architecture.equalsIgnoreCase(other.getArchitecture())) {
+            return false;
+        }
+        if (!javaVM.equalsIgnoreCase(other.getJavaVM())) {
+            return false;
+        }
+        if (!type.equalsIgnoreCase(other.getType())) {
+            return false;
+        }
+        if (official != other.isOfficial()) {
+            return false;
+        }
+        return true;
+    }
+
+    public URL getWebURL() {
+        return webURL;
+    }
+
+    public void setWebURL(URL webURL) {
+        this.webURL = webURL;
+    }
+
+    public List getCategories() {
+        return this.categories;
+    }
+
+    public void setCategories(List categoriesList) {
+        for (int i = 0; i < categoriesList.size(); i++) {
+            if (!this.categories.contains(categoriesList.get(i))) {
+                this.categories.add(categoriesList.get(i));
+            }
+        }
+    }
+
+    public String getCategoriesAsString() {
+        String categoriesString = "";
+        for (int i = 0; i < this.categories.size(); i++) {
+            if (i + 1 < this.categories.size()) {
+                categoriesString += this.categories.get(i) + ", ";
+            } else {
+                categoriesString += this.categories.get(i);
+            }
+        }
+        return categoriesString;
+    }
+
+    public void addCategoriesAsString(String categoriesString) {
+        if (categoriesString == null) {
+            return;
+        }
+        categoriesString.trim();
+        String[] cadena = categoriesString.split(",");
+
+        for (int i = 0; i < cadena.length; i++) {
+            String trimCadena = cadena[i].trim();
+            if ((!this.categories.contains(trimCadena)) && (trimCadena != "")) {
+                this.categories.add(trimCadena);
+            }
+        }
+
+    }
+
+    public boolean isBroken() {
+        if (this.broken) {
+            return true;
+        }
+        // if( this.isOfficial() && !this.isSigned() ) {
+        // return true;
+        // }
+        return false;
+    }
+
+	private boolean isEmptyString(String s) {
+		if( s == null ) {
+			return true;
+		}
+		return s.length()==0;
+	}
+
+	public String getPostInstallScript() {
+		return this.postInstallScript;
+	}
+
+	public void setPostInstallScript(String script) {
+		this.postInstallScript = script;
+	}
+	
+	protected void setBroken(boolean broken) {
+		this.broken = broken;
+	}
+
+	public void setValue(String name, Object value) {
+		this.aditionalProperties.put(name, value);
+	}
+
+	public Object getValue(String name) {
+		return this.aditionalProperties.get(name);
+	}
+
+	private Object[] getPackageNameFormatParameters() {
+		Object[] parameters = new Object[8];
+		parameters[PACKAGE_FILE_NAME_FIELDS.GVSIG_VERSION] = this.getApplicationVersion().toString();
+		parameters[PACKAGE_FILE_NAME_FIELDS.NAME] = this.getCode();
+		parameters[PACKAGE_FILE_NAME_FIELDS.VERSION] = this.getVersion();
+		parameters[PACKAGE_FILE_NAME_FIELDS.BUILD] = new Integer(this.getVersion().getBuild());
+		parameters[PACKAGE_FILE_NAME_FIELDS.STATE] = this.getState();
+		parameters[PACKAGE_FILE_NAME_FIELDS.OS] = this.getOperatingSystem();
+		parameters[PACKAGE_FILE_NAME_FIELDS.ARCH] = this.getArchitecture();
+		parameters[PACKAGE_FILE_NAME_FIELDS.JVM] = this.getJavaVM();
+		return parameters;
+	}
+	
+	public String getPreferedPackageFileName() {
+		Object[] parameters = getPackageNameFormatParameters();
+		return MessageFormat.format(PACKAGE_NAME_FORMAT, parameters);
+	}
+
+	
+	// 
+	// =========================================================
+	// 
+	// Deprecated methods
+	//
+	
+	
+	public int getBuild() {
+		return this.getVersion().getBuild();
+	}
+
+	public void setBuild(int build) {
+		this.getVersion().setBuild(build);
+	}
+
+	public String getGvSIGVersion() {
+		// return this.getApplicationVersion().toString();
+	    Version v = this.getApplicationVersion();
+	    return v.getMajor() + "." + v.getMinor() + "." + v.getRevision();
+	}
+
+	public void setGvSIGVersion(String gvSIGVersion) {
+		this.getApplicationVersion().parse(gvSIGVersion);
+	}
+
+	public URL getDownloadURL(URL baseURL) {
+		logger.info("Deprecated methos, ignore parameter baseURL.");
+		return this.getOwnerURL();
+	}
+
+	public String getAntScript() {
+		return this.getPostInstallScript(); 
+	}
+
+	public void setAntScript(String antScript) {
+		this.setPostInstallScript(antScript);
+	}
+
+	public File downloadFile() throws BaseException {
+		throw new UnsupportedOperationException();
+	}
+
+	public File downloadFile(SimpleTaskStatus taskStatus) throws BaseException {
+		throw new UnsupportedOperationException();
+	}
+
+	public void addFileToCopy(File file) {
+		throw new UnsupportedOperationException();
+	}
+
+	public File getFileToCopy(int i) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void removeFileToCopy(File file) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void clearFilesToCopy() {
+		throw new UnsupportedOperationException();
+	}
+
+	public List getFilesToCopy() {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean removeInstallFolder(File folder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean removeFilesFolder(File folder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean isSigned() {
+		return true;
+	}
+
+	public void checkSignature(byte[] pkgdata) {
+		// Do nothing
+	}
+
+    /* (non-Javadoc)
+     * @see org.gvsig.installer.lib.api.PackageInfo#setVersion(java.lang.String)
+     */
+    public void setVersion(String version) {
+        this.version.parse(version);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/impl/DefaultPackageInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Version.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Version.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Version.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import org.gvsig.tools.lang.Cloneable;
+
+public interface Version extends Cloneable, Comparable, org.gvsig.installer.lib.api.Version {
+
+	public org.gvsig.installer.lib.api.Version parse(String version);
+
+	public int getMajor();
+
+	public int getMinor();
+
+	public int getRevision();
+
+	public String getClassifier();
+
+	public int getBuild();
+
+	public boolean check(String op, org.gvsig.installer.lib.api.Version other);
+
+	public String fullFormat();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Version.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependencies.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependencies.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependencies.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import java.util.List;
+import org.gvsig.tools.lang.Cloneable;
+
+public interface Dependencies extends List, Cloneable, org.gvsig.installer.lib.api.Dependencies {
+	public org.gvsig.installer.lib.api.Dependencies parse(String dependenies);
+
+	public boolean match(String type, String code, org.gvsig.installer.lib.api.Version version);
+	public boolean match(String type, StringWithAlias code, org.gvsig.installer.lib.api.Version version);
+
+	public org.gvsig.installer.lib.api.Dependency find(String type, String code, org.gvsig.installer.lib.api.Version version);
+	public org.gvsig.installer.lib.api.Dependency find(String type, StringWithAlias code, org.gvsig.installer.lib.api.Version version);
+    public List findAll(String type, String code, org.gvsig.installer.lib.api.Version version);
+    public List findAll(String type, StringWithAlias code, org.gvsig.installer.lib.api.Version version);
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependencies.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageManager.java	(revision 1235)
@@ -0,0 +1,155 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.exception.BaseException;
+
+public interface PackageManager {
+	
+	public static final String PACKAGE_EXTENSION = ".gvspkg";
+	
+	/**
+	 * Package state default values.
+	 */
+	public static interface STATE {
+
+		static final String DEVEL = "devel";
+		static final String TESTING = "testing";
+		static final String PILOT = "pilot";
+		static final String PROTOTYPE = "prototype";
+		static final String ALPHA = "alpha";
+		static final String BETA = "beta";
+		static final String RC = "RC";
+		static final String FINAL = "final";
+	}
+
+	/**
+	 * Supported operating system default values.
+	 */
+	public static interface OS {
+
+		static final String ALL = "all";
+		static final String LINUX = "lin";
+		static final String WINDOWS = "win";
+		static final String OSX_10_4 = "osx_10_4";
+		static final String OSX_10_5 = "osx_10_5";
+		static final String OSX_10_6 = "osx_10_6";
+		static final String OSX_10_7 = "osx_10_7";
+		static final String OSX_10_8 = "osx_10_8";
+		static final String OSX_10_9 = "osx_10_9";
+	}
+
+	/**
+	 * Supported architecture default values.
+	 */
+	public static interface ARCH {
+
+		static final String ALL = "all";
+		static final String X86 = "x86";
+		static final String X86_64 = "x86_64";
+		static final String PowerPC = "PowerPC";
+	}
+
+	/**
+	 * Supported Java virtual machine version default values.
+	 */
+	public static interface JVM {
+
+		static final String J1_5 = "j1_5";
+		static final String J1_6 = "j1_6";
+		static final String J1_7 = "j1_7";
+		static final String J1_8 = "j1_8";
+	}
+
+	/**
+	 * Create a empty Version instance
+	 * 
+	 * @return the version
+	 */
+	public Version createVersion();
+
+	/**
+	 * Create a empty PackageInfo instance
+	 * 
+	 * @return the package info
+	 */
+	public PackageInfo createPackageInfo();
+	
+	/**
+	 * Create a PackageInfo and load contents from the specified InputStream using the
+	 * default reader.
+	 * 
+	 * @param packegeinfo as URL
+	 * @return the created packageInfo
+	 * @throws BaseException 
+	 */
+	public PackageInfo createPackageInfo(InputStream packegeinfo) throws BaseException;
+
+	public PackageInfo createPackageInfo(File packegeinfo) throws BaseException;
+
+	/**
+	 * Create a empty dependency object.
+	 * 
+	 * @return the dependency
+	 */
+	public Dependency createDependency();
+
+	/**
+	 * Create a dependency instance with the data of the package.
+	 * 
+	 * @param packageInfo
+	 * @return a dependency of the package
+	 */
+	public Dependency createDependency(PackageInfo packageInfo);
+	
+	public Dependencies createDependencies();
+
+	/**
+	 * Return the OS code of the system
+	 * 
+	 * @return os code of the system
+	 */
+	public String getOperatingSystem();
+
+	/**
+	 * Returns the Architecture code of the system
+	 * 
+	 * @return architecture code of the system
+	 */
+	public String getArchitecture();
+	
+
+	public void writePacakgeInfo(PackageInfo packageInfo, File file) throws IOException ;
+
+	public void writePacakgeInfo(PackageInfo pkg, OutputStream os) throws IOException ;
+	
+	public void readPacakgeInfo(PackageInfo packageInfo, File file) throws IOException ;
+
+	public void readPacakgeInfo(PackageInfo pkg, InputStream os) throws IOException ;
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageInfo.java	(revision 1235)
@@ -0,0 +1,304 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {Prodevelop}   {Task}
+ */
+
+package org.gvsig.tools.packageutils;
+
+import java.net.URL;
+import java.util.List;
+
+import org.gvsig.installer.lib.api.Version;
+import org.gvsig.installer.lib.api.Dependencies;
+
+
+public interface PackageInfo extends org.gvsig.installer.lib.api.PackageInfo {
+
+
+	/**
+	 * @return Gets the code of the package.
+	 */
+	public String getCode();
+
+	public void setCode(String code);
+
+	public StringWithAlias getAllCodes();	
+	    
+    public boolean hasThisCode(String code);
+	
+	public String getID();
+
+	/**
+	 * @return Gets the name of the package.
+	 */
+	public String getName();
+
+	public void setName(String name);
+
+	/**
+	 * @return Gets the description of the package.
+	 */
+	public String getDescription();
+
+	public void setDescription(String description);
+
+	/**
+	 * @return Gets the version of the package.
+	 */
+	public Version getVersion();
+
+	public void setVersion(Version version);
+
+	/**
+	 * @return Gets the state of the package.
+	 * @see STATE
+	 */
+	public String getState();
+
+	/**
+	 * Sets the state of the package
+	 * 
+	 * @param state
+	 * @see STATE
+	 */
+	public void setState(String state);
+
+	/**
+	 * @return Gets if the package is official.
+	 */
+	public boolean isOfficial();
+
+	public void setOfficial(boolean official);
+
+	/**
+	 * @return Gets the type of the package.
+	 */
+	public String getType();
+
+	public void setType(String type);
+
+	/**
+	 * Returns the supported operating system.
+	 * 
+	 * @return the supported operating system
+	 * @see OS
+	 */
+	public String getOperatingSystem();
+
+	/**
+	 * Sets the supported operating system.
+	 * 
+	 * @param operatingSystem
+	 *            the supported operating system
+	 * @see OS
+	 */
+	public void setOperatingSystem(String operatingSystem);
+
+	/**
+	 * Returns the supported hardware architecture.
+	 * 
+	 * @return the supported hardware architecture
+	 * @see ARCH
+	 */
+	public String getArchitecture();
+
+	/**
+	 * Sets the supported hardware architecture.
+	 * 
+	 * @param architecture
+	 *            the supported hardware architecture
+	 * @see ARCH
+	 */
+	public void setArchitecture(String architecture);
+
+	/**
+	 * Returns the supported java vm version.
+	 * 
+	 * @return the supported java vm version
+	 * @see JVM
+	 */
+	public String getJavaVM();
+
+	/**
+	 * Sets the supported java vm version.
+	 * 
+	 * @param javaVM
+	 *            the supported java vm version
+	 * @see JVM
+	 */
+	public void setJavaVM(String javaVM);
+
+	/**
+	 * Returns the supported application version.
+	 * 
+	 * @return the supported application version
+	 */
+	public Version getApplicationVersion();
+
+	/**
+	 * Sets the supported application version.
+	 * 
+	 * @param verion
+	 *            the supported application version
+	 */
+	public void setApplicationVersion(Version version);
+
+	/**
+	 * Returns the package bundle download {@link URL}.
+	 *  
+	 * May be null if there is no remote URL to download the bundle.
+	 * 
+	 * @return the package bundle download {@link URL}
+	 */
+	public URL getDownloadURL();
+
+	public String getDownloadURLAsString();
+
+	/**
+	 * Sets the package bundle download {@link URL}. Optional.
+	 * 
+	 * @param defaultURL
+	 *            the package bundle download {@link URL}
+	 */
+	public void setDownloadURL(URL defaultURL);
+
+	public void setDownloadURL(String defaultDownloadURL);
+
+	/**
+	 * Returns the package info model version.
+	 * 
+	 * @return the package info model version
+	 */
+	public String getModelVersion();
+
+	/**
+	 * Sets the package info model version.
+	 * 
+	 * @param modelVersion
+	 *            the package info model version
+	 */
+	public void setModelVersion(String modelVersion);
+
+	public String getOwner();
+
+	/**
+	 * Sets the package owner.
+	 * 
+	 * @param owner
+	 *            the package owner
+	 */
+	public void setOwner(String owner);
+
+	/**
+	 * Returns the owner's url {@link URL}.
+	 * 
+	 * @return the owner's url {@link URL}
+	 */
+	public URL getOwnerURL();
+
+	/**
+	 * Sets the package owner's url.
+	 * 
+	 * @param sources
+	 *            the package owner's url
+	 */
+	public void setOwnerURL(URL sources);
+
+	/**
+	 * Returns the package source files url {@link URL}.
+	 * 
+	 * @return the package source files url {@link URL}
+	 */
+	public URL getSourcesURL();
+
+	/**
+	 * Sets the package sources.
+	 * 
+	 * @param sources
+	 *            the package sources
+	 */
+	public void setSourcesURL(URL sources);
+
+	/**
+	 * Returns the package web url {@link URL}.
+	 * 
+	 * @return the package web url {@link URL}
+	 */
+	public URL getWebURL();
+
+	/**
+	 * Sets the package web url {@link URL}.
+	 * 
+	 * @param webURL
+	 *            the package web url {@link URL}
+	 */
+	public void setWebURL(URL webURL);
+
+	/**
+	 * @param string
+	 * @return
+	 */
+	public boolean matchID(String string);
+
+	public Dependencies getDependencies();
+
+	public void setDependencies(String dependencies);
+
+	public void setDependencies(Dependencies dependencies);
+
+	public String toStringCompact();
+
+	public List getCategories();
+
+	public void setCategories(List categoriesList);
+
+	public String getCategoriesAsString();
+
+	public void addCategoriesAsString(String categoriesString);
+
+	public boolean isBroken();
+
+	/**
+	 * 
+	 * @return
+	 */
+	public String getPostInstallScript();
+	
+	/**
+	 * 
+	 * @param script
+	 * @return
+	 */
+	public void setPostInstallScript(String script);
+	
+	public void setValue(String name, Object value);
+	
+	public Object getValue(String name);
+	
+	public String getPreferedPackageFileName(); 
+	
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/PackageInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/StringWithAlias.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/StringWithAlias.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/StringWithAlias.java	(revision 1235)
@@ -0,0 +1,32 @@
+package org.gvsig.tools.packageutils;
+
+import java.util.List;
+
+public interface StringWithAlias {
+
+	public StringWithAlias add(String value);
+
+	public List getAlias();
+	
+	public boolean equals(Object other);
+	
+	public boolean equalsIgnoreCase(Object other);
+
+	public boolean matches(String regex);
+	
+	public boolean endsWith(Object suffix);
+
+	public boolean startsWith(Object suffix);
+	
+	public boolean startsWith(Object suffix, int toffset);
+	
+	public int compareTo(Object other);
+	
+	public int compareToIgnoreCase(Object other);
+	
+	public String toString();
+	
+	public String concat(Object other);
+	
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/StringWithAlias.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependency.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependency.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependency.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.packageutils;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.installer.lib.api.Version;
+
+public interface Dependency extends Cloneable, org.gvsig.installer.lib.api.Dependency {
+	public final String REQUIRED = "required";
+	public final String CONFLICT = "conflict";
+	public final String RECOMMENDED = "recommended";
+
+	public org.gvsig.installer.lib.api.Dependency parse(String dependency);
+
+	public String getType();
+
+	public String getCode();
+
+	public String getOp();
+
+	public Version getVersion();
+
+	public boolean match(String type, String code, Version version);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/packageutils/Dependency.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Caller.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Caller.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Caller.java	(revision 1235)
@@ -0,0 +1,77 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util;
+
+import java.util.List;
+
+/**
+ * 
+ * This is a utility class for call a list of callables.
+ * 
+ * It can collect exceptions and continue to call the next 
+ * callable in the list. 
+ * 
+ * @author gvSIG Team - jjdelcerro
+ *
+ */
+public interface Caller {
+
+	/**
+	 * Get if the Caller can collect exceptions or
+	 * exit in the first exception produced.
+	 * 
+	 * @return boolean that indicate that collect exceptions.
+	 */
+	public boolean getCollectExceptions();
+	
+	/**
+	 * Set in the caller the behabior of collect al exceptions
+	 * and continue calling the next callable in the list of our
+	 * callables.
+	 * 
+	 * @param collectExceptions
+	 */
+	public void setCollectExceptions(boolean collectExceptions);
+	
+	/**
+	 * Add a callable to the list of callables of the caller.
+	 * @param callable
+	 */
+	public void add(Callable callable);
+	
+	/**
+	 * Return the list of collected exceptions or null.
+	 * 
+	 * @return list of exceptions
+	 */
+	public List getExceptions();
+
+	/**
+	 * Call all callables in the list of callables of the caller.
+	 * 
+	 * @return true if no exceptions produced
+	 */
+	public boolean call();
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Caller.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/FolderSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/FolderSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/FolderSet.java	(revision 1235)
@@ -0,0 +1,93 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.gvsig.tools.observer.Observable;
+
+public interface FolderSet extends Observable {
+	
+	public interface FolderEntry {
+		public File getFolder();
+		public String getLabel() ;
+	}
+	public void setDefaultFolder(File defaultFolder);
+	
+	public File getDefaultFolder();
+	
+	public File asFile();
+	
+	public void add(File folder);
+	
+	public void add(File folder, String description);
+	
+	public void clear();
+	
+	public void remove(File folder);
+	
+	public void set(File folder);
+	
+	public Iterator iterator(); // over FolderEntry
+	
+	public File[] listFiles();
+	
+	public File[] listFiles(FileFilter filter);
+
+	public File[] listFiles(FilenameFilter filter);
+	
+	public String[] list();
+	
+	public String[] list(FilenameFilter filter);
+	
+	public boolean isDirectory();
+	
+	public boolean isFile();
+	
+	public String getName();
+	
+	public String getParent();
+	
+	public File getParentFile();
+	
+	public String getPath();
+	
+	public File getCanonicalFile() throws IOException ;
+	
+	public String getCanonicalPath() throws IOException ;
+	
+	public boolean canRead();
+	
+	public boolean canWrite();
+	
+	public boolean exists() ;
+	
+	public File getAbsoluteFile();
+	
+	public String getAbsolutePath();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/FolderSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ServiceLoader.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ServiceLoader.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ServiceLoader.java	(revision 1235)
@@ -0,0 +1,80 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.util;
+
+import java.util.Set;
+
+/**
+ * Loads a set of instances of classes which implement or extend an interface or
+ * class.
+ * <p>
+ * Has the same purpose as the java.util.ServiceLoader class available since JDK
+ * 1.6.
+ * </p>
+ * 
+ * @see <a
+ *      href="http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html">java.util.ServiceLoader</a>
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface ServiceLoader {
+
+	/**
+	 * Loads a {@link Set} of a object instances which implement or extended a
+	 * common service interface or class. The services will be loaded using the
+	 * current {@link ClassLoader} and the list of {@link ClassLoader}s provided
+	 * with the {@link #addClassLoader(ClassLoader)} method, if any.
+	 * 
+	 * @param serviceClass
+	 *            the interface or class which the loaded objects must implement
+	 *            or extend
+	 * @return the {@link Set} of loaded object instances
+	 */
+	Set load(Class serviceClass);
+
+	/**
+	 * Loads a {@link Set} of a object instances which implement or extended a
+	 * common service interface or class. The classes are loaded through the
+	 * provided {@link ClassLoader}
+	 * 
+	 * @param serviceClass
+	 *            the interface or class which the loaded objects must implement
+	 *            or extend
+	 * @param classLoader
+	 *            the {@link ClassLoader} to load the classes from
+	 * @return the {@link Set} of loaded object instances
+	 */
+	Set load(Class serviceClass, ClassLoader classLoader);
+
+	/**
+	 * Adds a {@link ClassLoader} to use to find services, in the case we don't
+	 * provide one.
+	 * 
+	 * @param classLoader
+	 */
+	void addClassLoader(ClassLoader classLoader);
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/MathUtils.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/MathUtils.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/MathUtils.java	(revision 1235)
@@ -0,0 +1,12 @@
+
+
+package org.gvsig.tools.util;
+
+
+public class MathUtils {
+    
+    public static boolean equals(double a, double b, double precision) {
+        double v = Math.abs(a-b);
+        return v < precision;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ArrayUtils.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ArrayUtils.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ArrayUtils.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.tools.util;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+
+
+public class ArrayUtils {
+
+    public static Object get(Object[] array, int n, int type) {
+        if ( array == null ) {
+            return null;
+        }
+        if ( array.length <= n || n < 0 ) {
+            return null;
+        }
+        if ( array[n] == null ) {
+            return null;
+        }
+        DataTypesManager typeManager = ToolsLocator.getDataTypesManager();
+        DataType t = typeManager.get(type);
+        try {
+            return t.coerce(array[n]);
+        } catch (CoercionException ex) {
+            return null;
+        }
+    }
+    
+    public static Object get(Object[] array, int n) {
+        if ( array == null ) {
+            return null;
+        }
+        if ( array.length <= n || n < 0 ) {
+            return null;
+        }
+        return array[n];
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Callable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Callable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Callable.java	(revision 1235)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util;
+
+/**
+ * A task that returns a result and may throw an exception. 
+ * Implementors define a single method with no arguments called call.
+ * 
+ * This interface is similar to the same interface of java 1.5 and this
+ * is here for java 1.4 compatibility.
+ *  
+ * @author gvSIG Team - jjdelcerro
+ *
+ */
+public interface Callable {
+	
+	/**
+	 * Computes a result, or throws an exception if unable to do so.
+	 * 
+	 * @return computed result
+	 * @throws Exception if unable to compute a result
+	 */
+	public Object call() throws Exception;
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/Callable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/XMLUtils.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/XMLUtils.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/XMLUtils.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+public class XMLUtils {
+
+    public static String getEncoding(File f, String defaultEncoding) {
+        String encoding = defaultEncoding;
+        FileReader fr = null;
+        try {
+
+            fr = new FileReader(f);
+            BufferedReader br = new BufferedReader(fr);
+            char[] buffer = new char[100];
+            br.read(buffer);
+            String st = new String(buffer);
+
+            String searchText = "encoding=\"";
+            int index = st.indexOf(searchText);
+            if ( index > -1 ) {
+                encoding = st.substring(index + searchText.length(), st.indexOf("\""));
+            }
+            return encoding;
+
+        } catch (Exception ex) {
+            return encoding;
+        } finally {
+            try {
+                fr.close();
+            } catch (Exception ex) {
+                // Do nothing, ignore errors
+            }
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultCaller.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultCaller.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultCaller.java	(revision 1235)
@@ -0,0 +1,84 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.tools.util.Callable;
+import org.gvsig.tools.util.Caller;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultCaller implements Caller {
+	
+	private static Logger LOG = LoggerFactory.getLogger(DefaultCaller.class);
+	
+	private boolean collectExceptions;
+	private List callables;
+	private List exceptions;
+	
+	public DefaultCaller() {
+		this.collectExceptions = true;
+		this.callables = new ArrayList();
+		this.exceptions = null;
+	}
+
+	public boolean call() {
+        List exceptions = new ArrayList();
+        Iterator it = this.callables.iterator();
+        while( it.hasNext() ) {
+        	Callable callable = (Callable)(it.next());
+        	try {
+				callable.call();
+			} catch (Exception e) {
+				LOG.error("Exception in Callable",e);
+				exceptions.add(new CallableException(callable,e));
+			}
+        }
+        if( exceptions.size()>0 ) {
+        	this.exceptions = exceptions;
+        	return false;
+        }
+        return true;
+	}
+
+	public boolean getCollectExceptions() {
+		return this.collectExceptions;
+	}
+
+	public void setCollectExceptions(boolean collectExceptions) {
+		this.collectExceptions = collectExceptions;
+	}
+
+	public void add(Callable callable) {
+		this.callables.add(callable);
+	}
+
+	public List getExceptions() {
+		return this.exceptions;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultCaller.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultFolderSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultFolderSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultFolderSet.java	(revision 1235)
@@ -0,0 +1,257 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util.impl;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable;
+import org.gvsig.tools.util.FolderSet;
+
+public class DefaultFolderSet extends BaseWeakReferencingObservable implements
+		FolderSet {
+
+	public class DefaultFolderEntry implements FolderEntry {
+		File folder;
+		String label;
+
+		DefaultFolderEntry(File folder, String label) {
+			this.folder = folder;
+			this.label = label;
+		}
+
+		public boolean equals(Object obj) {
+			return this.folder.equals(((FolderEntry) obj).getFolder());
+		}
+
+		public int hashCode() {
+			return this.folder.hashCode();
+		}
+
+		public File getFolder() {
+			return this.folder;
+		}
+
+		public String getLabel() {
+			return this.label;
+		}
+	}
+
+	private Set folders = null;
+	private File defaultFolder = null;
+
+	public DefaultFolderSet() {
+		folders = new LinkedHashSet();
+	}
+
+	public void add(File folder) {
+		this.add(folder, null);
+	}
+
+	public void add(File folder, String description) {
+		if (folder == null) {
+			return;
+		}
+		if (folder.exists() && !folder.isDirectory()) {
+			throw new IllegalArgumentException("folder required");
+		}
+		this.folders.add(new DefaultFolderEntry(folder, description));
+		if( this.defaultFolder == null ) {
+			this.defaultFolder = folder;
+		}
+ 		this.notifyObservers();
+	}
+
+	public void clear() {
+		this.folders.clear();
+		this.defaultFolder = null;
+		this.notifyObservers();
+	}
+
+	public void remove(File folder) {
+		if (folder != null) {
+			this.folders.remove(new DefaultFolderEntry(folder, null));
+			if (folder.equals(this.defaultFolder)) {
+				this.defaultFolder = null;
+			}
+			this.notifyObservers();
+		}
+	}
+
+	public void set(File folder) {
+		this.beginComplexNotification();
+		this.clear();
+		this.setDefaultFolder(folder);
+		this.endComplexNotification();
+	}
+
+	public File[] listFiles() {
+		List entries = new ArrayList();
+		Iterator it = this.folders.iterator();
+		while (it.hasNext()) {
+			FolderEntry folderEntry = (FolderEntry) it.next();
+			File[] files = folderEntry.getFolder().listFiles();
+			if (files != null) {
+			    entries.addAll(Arrays.asList(files));
+			}
+		}
+		return (File[]) entries.toArray(new File[entries.size()]);
+	}
+
+	public File[] listFiles(FileFilter filter) {
+		List entries = new ArrayList();
+		Iterator it = this.folders.iterator();
+		while (it.hasNext()) {
+			FolderEntry folderEntry = (FolderEntry) it.next();
+			File[] files = folderEntry.getFolder().listFiles(filter);
+			if (files != null) {
+			    entries.addAll(Arrays.asList(files));
+			}
+			
+		}
+		return (File[]) entries.toArray(new File[entries.size()]);
+	}
+
+	public File[] listFiles(FilenameFilter filter) {
+		List entries = new ArrayList();
+		Iterator it = this.folders.iterator();
+		while (it.hasNext()) {
+			FolderEntry folderEntry = (FolderEntry) it.next();
+			File[] files = folderEntry.getFolder().listFiles(filter);
+			if (files != null) {
+			    entries.addAll(Arrays.asList(files));
+			}
+		}
+		return (File[]) entries.toArray(new File[entries.size()]);
+	}
+
+	public Iterator iterator() {
+		return this.folders.iterator();
+	}
+
+	public void setDefaultFolder(File defaultFolder) {
+		this.add(defaultFolder);
+		this.defaultFolder = defaultFolder;
+	}
+
+	public File getDefaultFolder() {
+		if( this.defaultFolder == null ) {
+			Iterator it = this.folders.iterator();
+			if( it.hasNext() ) {
+				this.defaultFolder = (File) it.next();
+			}
+		}
+		return this.defaultFolder;
+	}
+	
+	public File asFile() {
+		return getDefaultFolder();
+	}
+	
+	public String[] list() {
+		List entries = new ArrayList();
+		Iterator it = this.folders.iterator();
+		while (it.hasNext()) {
+			FolderEntry folderEntry = (FolderEntry) it.next();
+			String[] files = folderEntry.getFolder().list();
+			if (files != null) {
+			    entries.addAll(Arrays.asList(files));
+			}
+		}
+		return (String[]) entries.toArray(new String[entries.size()]);
+	}
+	
+	public String[] list(FilenameFilter filter) {
+		List entries = new ArrayList();
+		Iterator it = this.folders.iterator();
+		while (it.hasNext()) {
+			FolderEntry folderEntry = (FolderEntry) it.next();
+			String[] files = folderEntry.getFolder().list(filter);
+			if (files != null) {
+			    entries.addAll(Arrays.asList(files));
+			}
+		}
+		return (String[]) entries.toArray(new String[entries.size()]);
+	}
+
+	public boolean isDirectory() {
+		return true;
+	}
+
+	public boolean isFile() {
+		return false;
+	}
+
+	public String getName() {
+		return this.getDefaultFolder().getName();
+	}
+
+	public String getParent() {
+		return this.getDefaultFolder().getParent();
+	}
+
+	public File getParentFile() {
+		return this.getDefaultFolder().getParentFile();
+	}
+
+	public String getPath() {
+		return this.getDefaultFolder().getPath();
+	}
+
+	public File getCanonicalFile() throws IOException {
+		return this.getDefaultFolder().getCanonicalFile();
+	}
+
+	public String getCanonicalPath() throws IOException {
+		return this.getDefaultFolder().getCanonicalPath();
+	}
+
+	public boolean canRead() {
+		return this.getDefaultFolder().canRead();
+	}
+
+	public boolean canWrite() {
+		return this.getDefaultFolder().canWrite();
+	}
+
+	public boolean exists() {
+		return this.getDefaultFolder().exists();
+	}
+
+	public File getAbsoluteFile() {
+		return this.getDefaultFolder().getAbsoluteFile();
+	}
+
+	public String getAbsolutePath() {
+		return this.getDefaultFolder().getAbsolutePath();
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultFolderSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultServiceLoader.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultServiceLoader.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/DefaultServiceLoader.java	(revision 1235)
@@ -0,0 +1,241 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.util.impl;
+
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.util.ServiceLoader;
+
+/**
+ * Implementation which uses reflection to try to use first the standard JDK
+ * utilities to load service implementation classes, which are available since
+ * JDK 1.6. If it fails or the JDK used is < 1.6, the old mechanism based on the
+ * usage of internal sun classes is used.
+ * <p>
+ * To register your implementations classes eLfor a service, use the mechanism
+ * explained in the Java JAR file specification for the JDK version you are
+ * using:
+ * <ul>
+ * <li><a href=
+ * "http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider"
+ * >JDK 1.4</a></li>
+ * <li><a href=
+ * "http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider"
+ * >JDK 1.5</a></li>
+ * <li><a href=
+ * "http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider"
+ * >JDK 1.6</a></li>
+ * </ul>
+ * </p>
+ * 
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultServiceLoader implements ServiceLoader {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultServiceLoader.class);
+
+    private Set classLoaders = new LinkedHashSet();
+
+    /**
+     * Constructor.
+     */
+    public DefaultServiceLoader() {
+        try {
+            Class.forName("java.util.ServiceLoader");
+            LOG.info("Will use java.util.ServiceLoader to load services");
+        } catch (ClassNotFoundException e) {
+            LOG.info("Will use sun.misc.Service to load services");
+        }
+    }
+
+    public void addClassLoader(ClassLoader classLoader) {
+        classLoaders.add(classLoader);
+    }
+
+    public Set load(Class serviceClass) {
+        Set services = load(serviceClass, null);
+
+        for (Iterator iterator = classLoaders.iterator(); iterator.hasNext();) {
+            ClassLoader classLoader = (ClassLoader) iterator.next();
+            services.addAll(load(serviceClass, classLoader));
+        }
+
+        return services;
+    }
+
+    public Set load(Class serviceClass, ClassLoader classLoader) {
+        try {
+            return postJDK16Load(serviceClass, classLoader);
+        } catch (Exception e) {
+            LOG.debug("Could not use the JDK >= 1.6 utility classes "
+                + "to load the {} implementation classes, "
+                + "we may be running on a JDK < 1.6, so I will try "
+                + "to use the JDK < 1.6 sun.misc.Service class", serviceClass);
+            LOG.trace("The exception thrown is: ", e);
+        }
+
+        try {
+            return preJDK16Load(serviceClass, classLoader);
+        } catch (Exception e) {
+            LOG.error("Error finding available " + serviceClass + " objects", e);
+        }
+        return null;
+    }
+
+    /**
+     * Load the classes using the pre JDK 1.6 sun utilities.
+     */
+    private Set preJDK16Load(Class serviceClass, ClassLoader classLoader)
+        throws Exception {
+		LOG.info("Loading " +
+				serviceClass + " " +
+				(serviceClass.isInterface()? "implementations" : "extensions") +
+	            " from '" +
+	            ((classLoader==null)? "System":classLoader.toString()) +
+	            "' class loader (using sun.misc.Service class)."
+	    );
+
+        // Use reflection to call the internal Sun JDK class and avoid
+        // compiler errors in eclipse
+        Class serviceClazz = Class.forName("sun.misc.Service");
+
+        if (serviceClazz == null) {
+            LOG.error("Could not load Class sun.misc.Service "
+                + "using reflection");
+            return null;
+        }
+
+        Method providersMethod = null;
+
+        if (classLoader == null) {
+            providersMethod =
+                serviceClazz
+                    .getMethod("providers", new Class[] { Class.class });
+        } else {
+            providersMethod =
+                serviceClazz.getMethod("providers", new Class[] { Class.class,
+                    ClassLoader.class });
+        }
+
+        Iterator iterator = null;
+        if (classLoader == null) {
+            iterator =
+                (Iterator) providersMethod.invoke(null,
+                    new Object[] { serviceClass });
+        } else {
+            iterator =
+                (Iterator) providersMethod.invoke(null, new Object[] {
+                    serviceClass, classLoader });
+        }
+        if (iterator == null) {
+            LOG.debug("Empty {} objects iterator returned by the "
+                + "sun.misc.Service.providers method", serviceClass);
+            return null;
+        }
+
+        Set services = new LinkedHashSet();
+        while (iterator.hasNext()) {
+            services.add(iterator.next());
+        }
+        return services;
+    }
+
+    /**
+     * Load the classes using the JDK 1.6 standard utilities.
+     */
+    private Set postJDK16Load(Class serviceClass, ClassLoader classLoader)
+        throws Exception {
+		LOG.info("Loading " +
+				serviceClass + " " +
+				(serviceClass.isInterface()? "implementations" : "extensions") +
+	            " from '" +
+	            ((classLoader==null)? "System":classLoader.toString()) +
+	            "' class loader (using java.util.ServiceLoader class)."
+	    );
+
+        // Use reflection to call the JDK >= 1.6 utility classes and being
+        // able to compile with JDK 1.4 or 1.5
+        Class serviceLoaderClazz = Class.forName("java.util.ServiceLoader");
+        Method loadMethod = null;
+        if (classLoader == null) {
+            loadMethod =
+                serviceLoaderClazz.getMethod("load",
+                    new Class[] { Class.class });
+        } else {
+            loadMethod =
+                serviceLoaderClazz.getMethod("load", new Class[] { Class.class,
+                    ClassLoader.class });
+        }
+
+        Object serviceLoader = null;
+
+        if (classLoader == null) {
+            serviceLoader =
+                loadMethod.invoke(null, new Object[] { serviceClass });
+        } else {
+            serviceLoader =
+                loadMethod.invoke(null, new Object[] { serviceClass,
+                    classLoader });
+        }
+        if (serviceLoader == null) {
+            LOG.error("Could not load a ServiceLoader to load {} objects",
+                serviceClass);
+            return null;
+        }
+
+        Method iteratorMethod = serviceLoaderClazz.getMethod("iterator", null);
+        Iterator iterator =
+            (Iterator) iteratorMethod.invoke(serviceLoader, null);
+        if (iterator == null) {
+            LOG.debug(
+                "java.util.ServiceLoader of {} returned an empty iterator",
+                serviceClass);
+            return null;
+        }
+        Object obj = null;
+        Set services = new LinkedHashSet();
+        while (iterator.hasNext()) {
+        	try  {
+        		obj = iterator.next();
+        		services.add(obj);
+        	} catch(Throwable t) {
+        		LOG.error("Can't load service (" + ((obj==null)? "unknow":obj.toString()) + ") from " + ((classLoader==null)? "unknow": classLoader.toString()) + ".", t  );
+        	}
+        }
+        return services;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/CallableException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/CallableException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/CallableException.java	(revision 1235)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.util.impl;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.util.Callable;
+
+public class CallableException extends BaseException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 786823929903465907L;
+
+	public CallableException(Callable callable, Throwable cause) {
+		super(
+			"Error '%(error)' calling '%(callable)'.",
+			cause,
+			"_error_calling_XcallableX",
+			serialVersionUID
+		);
+		setValue("error", cause.getClass().getName());
+		setValue("callable", callable.getClass().getName());
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/impl/CallableException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/I18nManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/I18nManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/I18nManager.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.i18n;
+
+public interface I18nManager {
+
+        /**
+         * Get translation for the current language of <b>message</b>.
+         * 
+         * If the translation not found return the message it self.
+         * 
+         * @param message
+         *          the message key used for translation.
+         * 
+         * @return the traslated message
+         */
+	public String getTranslation(String message);
+        
+        /**
+         * Get translation for the current language of <b>message</b>.
+         * This use the java MessageFormat utiity to replace args in the
+         * resulting translation message.
+         * 
+         * If the translation not found return the message it self.
+         * 
+         * @param message
+         *          the message key used for translation.
+         * 
+         * @param args
+         * @return the traslated message
+         */
+        public String getTranslation(String message, String[] args);
+        
+	public void addResourceFamily(String family, ClassLoader loader, String callerName);
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/I18nManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/impl/DummyI18nManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/impl/DummyI18nManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/i18n/impl/DummyI18nManager.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.i18n.impl;
+
+import org.gvsig.tools.i18n.I18nManager;
+
+/**
+ * Dummy {@link I18nManager} implementation to be used when there has not been
+ * registered an implementation.
+ * 
+ * Returns as value the same message to get the translation for.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class DummyI18nManager implements I18nManager {
+
+	public String getTranslation(String message) {
+		// Return the same message, this is a dummy implementation.
+		return message;
+	}
+
+        public String getTranslation(String message, String[] args) {
+		// Return the same message, this is a dummy implementation.
+		return message;
+	}
+
+	public void addResourceFamily(String family, ClassLoader loader,
+			String callerName) {
+		// Do nothing, this is a dummy implementation.
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/logger/FilteredLogger.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/logger/FilteredLogger.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/logger/FilteredLogger.java	(revision 1235)
@@ -0,0 +1,46 @@
+
+
+package org.gvsig.tools.logger;
+
+import org.slf4j.Logger;
+
+public class FilteredLogger {
+        protected int count = 0;
+        protected final Logger logger;
+        protected final int max;
+        protected String processName;
+        
+        public FilteredLogger(Logger logger, String processName, int max) {
+            this.max = max;
+            this.logger = logger;
+            this.processName = processName;
+            this.count = 0;
+        }
+
+        protected boolean canDumpMoreMessages() {
+            if( ++this.count < this.max ) {
+                return true;
+            } else if( this.count == this.max ) {
+                this.logger.info("Too many errors, don't dump more in this process ("+processName+").");
+            }
+            return false;
+        }
+                
+        public void warn(String msg, Throwable th) {
+            if( canDumpMoreMessages() ) {
+                this.logger.warn(msg,th);
+            }
+        }
+        
+        public void warn(String msg) {
+            if( canDumpMoreMessages() ) {
+                this.logger.warn(msg);
+            }
+        }
+        
+        public void info(String msg) {
+            if( canDumpMoreMessages() ) {
+                this.logger.info(msg);
+            }
+        }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/lang/Cloneable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/lang/Cloneable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/lang/Cloneable.java	(revision 1235)
@@ -0,0 +1,47 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.lang;
+
+/**
+ * {@link java.lang.Cloneable} extension to define the
+ * {@link java.lang.Cloneable#clone()} as a public method.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface Cloneable extends java.lang.Cloneable {
+
+	/**
+	 * Creates a copy of the object.
+	 * 
+	 * @see {@link Object#clone()}.
+	 * 
+	 * @return a copy of the object
+	 * @throws CloneNotSupportedException if the instance of the object cannot
+	 * be cloned. As this is extending {@link java.lang.Cloneable} so
+	 * its sure it implements it, so this exception may be used for problems
+	 * on specific object instances.
+	 */
+	Object clone() throws CloneNotSupportedException;
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectSet.java	(revision 1235)
@@ -0,0 +1,171 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.visitor.IndexedVisitable;
+
+/**
+ * A set of iterable DynObject objects.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public interface DynObjectSet extends Disposable, IndexedVisitable, Observable {
+
+    public static interface Notification {
+
+        static final String EDITION_STATUS_CHANGE =
+            "edition_status_change_DynObjectSet";
+
+        static final String DATA_CHANGED = "data_changed_DynObjectSet";
+
+        String getType();
+    }
+
+    /**
+     * Returns the number of {@link DynObject}(s) contained in this
+     * DynObjectSet.
+     * 
+     * @return number of {@link DynObject}(s) contained in this DynObjectSet.
+     * 
+     * @throws BaseException
+     */
+    long getSize() throws BaseException;
+
+    /**
+     * 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 DynObjects.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, 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 BaseException
+     *             if the index is out of range (index &lt; 0 || index &gt;
+     *             size()).
+     */
+    DisposableIterator iterator(long index) throws BaseException;
+
+    /**
+     * 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 DynObjects.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, long)
+     * 
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws BaseException
+     */
+    DisposableIterator iterator() throws BaseException;
+
+    /**
+     * Indicates whether this DynObjectSet contains zero DynObjects.
+     * 
+     * @return true if this DynObjectSet is empty, false otherwise.
+     * 
+     * @throws BaseException
+     */
+    boolean isEmpty() throws BaseException;
+
+    /**
+     * Tells if DynObject deletion is enabled into this set.
+     * 
+     * @return if DynObject deletion is enabled into this set
+     */
+    boolean isDeleteEnabled();
+
+    /**
+     * Deletes a DynObject from this set. Depending on the inner set
+     * implementation that may mean also the data will be removed from a
+     * persistent state.
+     * 
+     * @param dynObject
+     *            to remove
+     * @throws BaseException
+     *             if there is an error removing the DynObject
+     */
+    void delete(DynObject dynObject) throws BaseException;
+
+    /**
+     * Tells if DynObject updates are enabled into this set.
+     * 
+     * @return if DynObject updates are enabled into this set
+     */
+    boolean isUpdateEnabled();
+
+    /**
+     * Updates a DynObject from this set. Depending on the inner set
+     * implementation that may mean also the data will be updated in a
+     * persistent state.
+     * 
+     * @param dynObject
+     *            to update
+     * @throws BaseException
+     *             if there is an error updating the DynObject
+     */
+    void update(DynObject dynObject) throws BaseException;
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectValueItem.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectValueItem.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectValueItem.java	(revision 1235)
@@ -0,0 +1,82 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+public class DynObjectValueItem {
+
+	private Object value;
+	private String label;
+
+	public DynObjectValueItem(Object value, String label) {
+		this.setLabel(label);
+		this.setValue(value);
+	}
+
+	public DynObjectValueItem(Object value) {
+		this.setLabel(null);
+		this.setValue(value);
+	}
+
+	public void setValue(Object value) {
+		this.value = value;
+	}
+
+	public Object getValue() {
+		return value;
+	}
+
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+
+	public String toString() {
+		return label;
+	}
+
+	public boolean equals(Object obj) {
+		if (obj == null){
+			return false;
+		}
+		if (!(obj instanceof DynObjectValueItem)) {
+			return false;
+		}
+		DynObjectValueItem other = (DynObjectValueItem) obj;
+		if (value != other.value
+				&& (value == null || !value.equals(other.value))) {
+			return false;
+		}
+		if (label != other.label
+				&& (label == null || !label.equals(other.label))) {
+			return false;
+		}
+		return true;
+
+	}
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/Tags.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/Tags.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/Tags.java	(revision 1235)
@@ -0,0 +1,52 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.tools.dynobject;
+
+import java.util.Iterator;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.lang.Cloneable;
+
+
+public interface Tags extends Cloneable{
+
+	public Object get(String name);
+	
+	public Iterator getKeys();
+	
+	public Object get(String name, int type) throws CoercionException;
+	
+	public int getInt(String name) throws CoercionException;
+	
+	public boolean getBoolean(String name) throws CoercionException;
+	
+	public void set(String name, Object value) ;
+ 
+	public boolean has(String name) ;
+	
+	public void add(Tags tags);
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/Tags.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField.java	(revision 1235)
@@ -0,0 +1,383 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import java.util.List;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+
+/**
+ * A field of a {@link DynObject}.
+ * <p>
+ * A field will be persisted only if it is set as persistent (@see
+ * {@link DynField#isPersistent()}, which is the default value.
+ * </p>
+ * 
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaqu�n Jos� del Cerro</a>
+ */
+public interface DynField {
+
+	/**
+	 * Return the name of the field.
+	 * 
+	 * @return name of the field
+	 */
+	public String getName();
+
+	/**
+	 * Return the type used in this field. 
+	 * The values of type is the same of {@link DataTypes}
+	 * 
+	 * @return
+	 */
+	public int getType();
+
+	public DataType getDataType();
+	
+	/**
+	 * Return the subtype associated to this field.
+	 * The subtype is a string used for the cliente of the
+	 * field.
+	 * 
+	 * When the field is of type #{@link DataTypes#DYNOBJECT},
+	 * the subtype are the fullname of the DynClass.
+	 *  
+	 * @return the subtype of the field.
+	 */
+	public String getSubtype();
+	
+	/**
+	 * Return the descripcion associated to this field.
+	 * 
+	 * @return the description of the field.
+	 */
+	public String getDescription();
+
+	/**
+	 * Return the default value used in creation of new objects
+	 * with this field.
+	 * 
+	 * @return defaulr value to use for this field.
+	 */
+	public Object getDefaultValue();
+
+	/**
+	 * Return a string that identify a group for this field.
+	 * The groups are defined by the client of the field.
+	 * 
+	 * @return the group of the field
+	 */
+	public String getGroup();
+	
+	/**
+	 * Return the ordinal that identify the order of this field
+	 * in the {@link DynObject}.
+	 * 
+	 * @return the order of field in the {@link DynObject} 
+	 */
+	public int getOder();
+
+	/**
+	 * Return true if this field is mandatory.
+	 * 
+	 */
+	public boolean isMandatory();
+	
+	/**
+	 * Returns if the field is persistent or volatile. The meaning of being
+	 * persistent depends on how is persisted, but any persistence mechanism
+	 * must avoid persisting this field value.
+	 * 
+	 * @return if the field is to be persisted or not
+	 */
+	boolean isPersistent();
+
+	/**
+	 * Inform if this field can be visible or not for the user.
+	 * This value don't affect the access through the API.
+	 *  
+	 * @return true if the field is hidden for the user.
+	 */
+	boolean isHidden();
+
+	/**
+	 * Returns if the field is readOnly or not. The meaning of being
+	 * readOnly allows to know if the user input to any graphic component associated
+	 * to this field should be allowed or not.
+	 * 
+	 * @return if the graphic component associated to this field should be readOnly or not
+	 */
+	public boolean isReadOnly();
+	
+	/**
+	 * Return true if the value of this field is a container.
+	 * This method uses the same criteria of the {@link DataType}
+	 *  
+	 * @return true if the field type is a container
+	 */
+	public boolean isContainer();
+
+	/**
+	 * Return the available values for this field.
+	 * When assign a value to the field, this value need that
+	 * exists in this list.
+	 * 
+	 * @return an array of the available values for the field.
+	 */
+	public DynObjectValueItem[] getAvailableValues();
+
+	public Object getMinValue();
+
+	public Object getMaxValue();
+
+	/**
+	 * Return the java class of the value of the field.
+	 * 
+	 * @return the class of the value
+	 */
+	Class getClassOfValue();
+
+	/**
+	 * If the field is a container (List, Map or Set) return
+	 * the java class of its items.
+	 * 
+	 * @return the class of the items
+	 */
+	Class getClassOfItems();
+
+	
+	
+	
+	
+	
+	
+	
+	
+	/**
+	 * Sets the description asociated to this field.
+	 * 
+	 * @param description
+	 * 
+	 * @return this same {@link DynField} object
+	 */
+	DynField setDescription(String description);
+
+	/**
+	 * Sets the type of the field.
+	 * The values used are the specified in {@link DataTypes}.
+	 * 
+	 * This method assign the default values of the type for
+	 * "ClassOfValue" and "subType". 
+	 * 
+	 * @param type
+	 * 
+	 * @return this same {@link DynField} object
+	 */
+	DynField setType(int type);
+	
+	DynField setType(DataType type);
+
+	/**
+	 * Strings used as subtype for this field.
+	 * This value is used by the client of the object.
+	 * 
+	 * When the field is a #{@link DataTypes#DYNOBJECT},
+	 * the subtype is the fullname of the DynStruct.
+	 *  
+	 * @param subtype
+	 * 
+	 * @return this same {@link DynField} object
+	 */
+	DynField setSubtype(String subtype);
+
+	/**
+	 * Set the default value used for this field when a new
+	 * object with this field is created.
+	 *  
+	 * @param defaultValue
+	 * 
+	 * @return this same {@link DynField} object
+	 */
+	DynField setDefaultFieldValue(Object defaultValue);
+
+	DynField setGroup(String groupName);
+
+	DynField setOrder(int order);
+
+	DynField setMandatory(boolean mandatory);
+
+	DynField setHidden(boolean hidden);
+
+	/**
+	 * Sets if the field must be persisted or not.
+	 * @see #isPersistent()
+	 * @param persistent if the field must be persisted or not
+	 * @return this same {@link DynField} object
+	 */
+	DynField setPersistent(boolean persistent);
+
+	DynField setAvailableValues(DynObjectValueItem[] values);
+
+	DynField setAvailableValues(List values);
+
+	DynField setMinValue(Object minValue);
+
+	DynField setMaxValue(Object maxValue);
+	
+	/**
+	 * Sets the class used for the values of the field.
+	 *  
+	 * @param theClass
+	 * 
+	 * @return this same {@link DynField} object
+	 * 
+	 * @throws DynFieldIsNotAContainerException
+	 */
+	DynField setClassOfValue(Class theClass) throws DynFieldIsNotAContainerException;
+	
+	/**
+	 * If field type is List, Set or Map, this class is the class of items.
+	 * 
+	 * @param theClass
+	 * 
+	 * @return this same {@link DynField} object
+	 * 
+	 * @throws DynFieldIsNotAContainerException
+	 */
+	DynField setClassOfItems(Class theClass) throws DynFieldIsNotAContainerException;
+	
+	/**
+	 * Sets if the field is readOnly or not. The meaning of being
+	 * readOnly allows to know if the user input to any graphic component associated
+	 * to this field should be allowed or not.
+	 * @param isReadOnly
+	 *    if the graphic component associated to this field should be readOnly or not
+	 *    
+	 * @return DynField that define the type of elements.
+	 */
+	public DynField setReadOnly(boolean isReadOnly);	
+
+
+	
+	
+	
+	
+	
+	/**
+	 * When a field is of type container, this method return a DynClass
+	 * that define the type of elements. 
+ 	 * When the type is DYNOBJECT return the DynClass associated
+ 	 * to this.
+	 * 
+	 * Return null if the type not is a container.
+	 * 
+	 * @return DynField that define the type of elements.
+	 */
+	public DynField getElementsType();
+
+	/**
+ 	 * Set the type of items when the field is a container.
+ 	 * 
+ 	 * El  tipo de los elementos de un container esta definido
+ 	 * mediante un DynField, que crea con el tipo pasado por
+ 	 * parametro y lo devuelve este metodo.
+ 	 * 
+	 * @param tipo de los elementos
+	 * @return this same {@link DynField} object
+	 * @throws DynFieldIsNotAContainerException
+	 */
+	public DynField setElementsType(int type) throws DynFieldIsNotAContainerException ;
+
+	/**
+ 	 * Set the type of items when the field is a container.
+ 	 * 
+ 	 * Metodo de utilidad que establece el typo de DYNOBJECT y
+ 	 * methe como subtipo el DynStruct pasado como parametro.
+ 	 *  
+	 * @param tipo de los elementos
+	 * @return this same {@link DynField} object
+	 * @throws DynFieldIsNotAContainerException
+	 */
+	public DynField setElementsType(DynStruct type) throws DynFieldIsNotAContainerException ;
+
+	
+	
+	/**
+	 * Validate that the value match the properties of the field.
+	 * 
+	 * @param value
+	 * @throws DynFieldValidateException
+	 */
+	void validate(Object value) throws DynFieldValidateException;
+
+	/**
+	 * Force the type of value to the type of the field.
+	 * 
+	 * @param value
+	 * @return new value
+	 * @throws CoercionException 
+	 */
+	Object coerce(Object value) throws CoercionException;
+		
+	/**
+	 * If the field value can be any possible value, for its type.
+	 * 
+	 * @deprecated now autodetect the mode of use
+	 */
+	static final int ANY = 1;
+
+	/**
+	 * If the field value must be one of a list of posible values.
+	 * 
+	 * @deprecated usado automaticamente al asignar AvailableValues 
+	 */
+    static final int CHOICE = 2;
+
+	/**
+	 * If the field value must pertain to a range of possible values.
+	 * 
+	 * @deprecated usado automaticamente al asignar minValue/maxValue
+	 */
+    static final int RANGE = 3;
+
+	/**
+	 * @deprecated don't use, check minValue/maxValue and getAvailableValues instead 
+	 */
+	int getTheTypeOfAvailableValues(); // SINGLE, CHOICE o RANGE
+
+	/**
+	 * @deprecated use instead {@link #setDefaultFieldValue(Object)}
+	 */
+	DynField setDefaultDynValue(Object defaultValue);
+
+	/**
+	 * @deprecated don't use, set minValue/maxValue and availableValues instead 
+	 */
+	DynField setTheTypeOfAvailableValues(int type);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct.java	(revision 1235)
@@ -0,0 +1,176 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create DynObjects implementation}
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+
+
+/**
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaqu�n Jos� del Cerro</a>
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface DynStruct{
+
+    String getName();
+
+	String getNamespace();
+
+	String getFullName();
+
+    String getDescription();
+    
+	void setNamespace(String namespace);
+
+	void setDescription(String description);
+
+    /*************/
+    /* DynFields */
+    /*************/
+
+    DynField getDynField(String name);
+
+    DynField getDeclaredDynField(String name);
+
+    DynField[] getDynFields();
+
+    DynField[] getDeclaredDynFields();
+
+    DynField addDynField(String name);
+
+	// /**
+	// * Adds a new field to the struct
+	// * @param name
+	// * @return
+	// */
+	// DynField addDynFieldSingle(String name);
+
+	DynField addDynFieldBoolean(String name);
+
+    DynField addDynFieldInt(String name);
+
+	DynField addDynFieldLong(String name);
+
+	DynField addDynFieldFloat(String name);
+
+    DynField addDynFieldDouble(String name);
+
+	DynField addDynFieldString(String name);
+
+	DynField addDynFieldDate(String name);
+
+	DynField addDynFieldList(String name);
+
+	DynField addDynFieldArray(String name);
+
+	DynField addDynFieldMap(String name);
+
+	DynField addDynFieldSet(String name);
+
+	DynField addDynFieldObject(String name);
+
+	DynField addDynFieldFile(String name);
+
+	DynField addDynFieldFolder(String name);
+
+	DynField addDynFieldURL(String name);
+
+	DynField addDynFieldURI(String name);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldString(String)
+	 */
+    DynField addDynFieldSingle(String name, int type, Object defaultValue,
+	    boolean mandatory, boolean persistent);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldString(String)
+	 */
+    DynField addDynFieldSingle(String name, int type, Object defaultValue);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldRange(String)
+	 */
+    DynField addDynFieldRange(String name, int type, Object defaultValue,
+	    Object min, Object max, boolean mandatory, boolean persistent);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldRange(String)
+	 */
+    DynField addDynFieldRange(String name, int type, Object defaultValue,
+	    Object min, Object max);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldChoice(String)
+	 */
+    DynField addDynFieldChoice(String name, int type, Object defaultValue,
+	    DynObjectValueItem[] values, boolean mandatory, boolean persistent);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1.0
+	 * @see #addDynFieldChoice(String)
+	 */
+    DynField addDynFieldChoice(String name, int type, Object defaultValue,
+	    DynObjectValueItem[] values);
+
+    void removeDynField(String name);
+
+    void validate(DynObject object) throws DynObjectValidateException;
+    
+    DynObject newInstance();
+
+    /***************************/
+    /* Parent DynClass objects */
+    /***************************/
+
+    void extend(DynStruct struct);
+
+    void extend(String namespace, String structName);
+
+    void extend(String structName);
+
+    /**
+     * 
+     * Removes a given dynStruct from the current superDynClasses of this dynClass. If it is not contained, does nothing.
+     *  
+     * @param dynStruct the dynStruct to be removed.
+     */
+    void remove(DynStruct superDynStruct);
+
+
+    DynStruct[] getSuperDynStructs();
+
+    boolean isInstance(DynObject dynObject);
+
+    boolean isExtendable(DynStruct dynStruct);
+ 
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectException.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.exception.BaseException;
+
+public class DynObjectException extends BaseException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4202116374269244934L;
+
+	public DynObjectException(Throwable cause) {
+		super(
+			"DynObject error.",
+			cause,
+			"_DynObject_error", 
+			serialVersionUID
+		);
+	}
+
+	protected DynObjectException(String messagefmt, String key, long code) {
+		super(messagefmt, key, code);
+	}
+
+	protected DynObjectException(String messagefmt, Throwable cause, String key, long code) {
+		super(messagefmt, cause, key, code);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectRuntimeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectRuntimeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectRuntimeException.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+public class DynObjectRuntimeException extends BaseRuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -8715772554233511721L;
+
+	public DynObjectRuntimeException(Throwable cause) {
+		super(
+			"DynObject error.",
+			cause,
+			"_DynObject_error", 
+			serialVersionUID
+		);
+	}
+
+	protected DynObjectRuntimeException(String messagefmt, String key, long code) {
+		super(messagefmt, key, code);
+	}
+
+	protected DynObjectRuntimeException(String messagefmt, Throwable cause, String key, long code) {
+		super(messagefmt, cause, key, code);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_v2.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_v2.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_v2.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+public interface DynField_v2 extends DynField_LabelAttribute {
+
+    public DynField setClassOfValue(DynStruct dynStrct);
+
+    public DynField setClassOfValue(String theClassNameOfValue);
+
+    public String getClassNameOfValue();
+
+    public DynStruct getDynClassOfValue();
+
+    public DynField setTypeOfItems(int type);
+
+    public int getTypeOfItems();
+
+    public DynField setClassOfItems(DynStruct dynStrct);
+
+    public DynField setClassOfItems(Class theClass);
+
+    public DynField setClassOfItems(String theClassNameOfValue);
+
+    public String getClassNameOfItems();
+
+    public DynStruct getDynClassOfItems();
+
+    public Class getClassOfItems();
+
+    public Tags getTags();
+
+    public DynField setRelationType(int relationType);
+
+    public int getRelationType();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_v2.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct_v2.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct_v2.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynStruct_v2.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+
+public interface DynStruct_v2 extends DynStruct {
+   
+    public Tags getTags();
+    
+    public String getLabel();
+    
+    public void setLabel(String label);
+    
+    public DynField addDynField(String name, int type);
+    
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectPagingHelper.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectPagingHelper.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectPagingHelper.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.paging.PagingCalculator;
+
+/**
+ * Helper interface to access the values of a DynObjectSet by page or position.
+ * 
+ * @author gvSIG team
+ */
+public interface DynObjectPagingHelper extends PagingCalculator {
+
+	/**
+	 * Returns the {@link DynObject} located at the index position.
+	 * 
+	 * @param index
+	 *            to locate the DynObject in the set
+	 * @return the DynObject located at the index position
+	 * @throws BaseException
+	 *             if there is an error getting the DynObject
+	 */
+	DynObject getDynObjectAt(long index) throws BaseException;
+
+	/**
+	 * Returns all the values of the current loaded page.
+	 * 
+	 * @return all the values of the current loaded page
+	 */
+	DynObject[] getCurrentPageDynObjects();
+
+	/**
+	 * Returns the {@link DynObjectSet} used to fetch the data.
+	 * 
+	 * @return the DynObjectSet
+	 */
+	DynObjectSet getDynObjectSet();
+
+	/**
+	 * Reloads the current page of data from the set.
+	 * 
+	 * @throws BaseException
+	 *             if there is an error reloading the current page
+	 */
+	void reloadCurrentPage() throws BaseException;
+
+	/**
+	 * Reloads everything.
+	 * 
+	 * @throws BaseException
+	 */
+	void reload() throws BaseException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObjectManager.java	(revision 1235)
@@ -0,0 +1,436 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.gvsig.tools.dynobject.exception.DuplicateDynClassException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.dynobject.impl.DefaultDynField;
+import org.gvsig.tools.dynobject.impl.DynClassExportHelper;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Manager for the DynObject tools library. This is the main entry point to the
+ * tools dynobjects API.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface DynObjectManager {
+
+    /**
+     * Null value for method id.
+     * 
+     * This value not is a value valid for a code of method.
+     */
+    public int NULLCODE = -1;
+
+    /**
+     * Create a instance of DynClass with the name and description
+     * Indicated as parameters.
+     * 
+     * @param name
+     *            , the name used for DynClass name.
+     * @param description
+     *            , the description associated to the
+     *            new DynClass.
+     * 
+     * @return the DynClass created.
+     */
+    public DynClass createDynClass(String name, String description);
+
+    /**
+     * Create a instance of DynClass with the name and description
+     * Indicated as parameters.
+     * 
+     * @param namespace
+     *            , the namespace used for the new DynClass.
+     * 
+     * @param name
+     *            , the name used for the new DynClass.
+     * 
+     * @param description
+     *            , the description associated to the
+     *            new DynClass.
+     * 
+     * @return the DynClass created.
+     * 
+     */
+    public DynClass createDynClass(String namespace, String name,
+        String description);
+
+    public String exportSimpleDynClassDefinitions(DynClass dynClass);
+    
+    public void exportSimpleDynClassDefinitions(File out, DynClass dynClass) throws FileNotFoundException ;
+    
+    public void exportSimpleDynClassDefinitions(OutputStream out, DynClass dynClass);
+    
+    /**
+     * Load the classes defined in the resource and return a Map
+     * with its.
+     * The classes do not be registered in the manager.
+     * 
+     * @param resource
+     *            , XML with the definition of dynamic
+     *            classes.
+     * 
+     * @param loader
+     *            , loader used to load classes used in
+     *            "classOfValue" in the resource.
+     * 
+     * @param defaultNamespace
+     *            , namespace used in classes that do not
+     *            specify a namespace in the resource.
+     * 
+     * @return The Map of loaded dynamic classes
+     * 
+     * @throws XmlPullParserException
+     * @throws IOException
+     */
+    public Map importDynClassDefinitions(InputStream resource,
+        ClassLoader loader, String defaultNamespace)
+        throws XmlPullParserException, IOException;
+
+    /**
+     * Load the classes defined in the resource.
+     * When the class do not specify a namespace this is set
+     * to null.
+     * 
+     * The classes do not be registered in the manager.
+     * 
+     * @param resource
+     *            , XML with the definition of dynamic
+     *            classes.
+     * 
+     * @param loader
+     *            , loader used to load classes used in
+     *            "classOfValue" in the resource.
+     * 
+     * @return The Map of loaded dynamic classes
+     * 
+     * @throws XmlPullParserException
+     * @throws IOException
+     */
+    public Map importDynClassDefinitions(InputStream resource,
+        ClassLoader loader) throws XmlPullParserException, IOException;
+
+    /**
+     * Load the classes defined in the resource.
+     * When the class do not specify a namespace this is set
+     * to null.
+     * 
+     * The classes do not be registered in the manager.
+     * 
+     * @param parser
+     *            , XML parser used in the definition of dynamic
+     *            classes.
+     * 
+     * @param loader
+     *            , loader used to load classes used in
+     *            "classOfValue" in the resource.
+     * 
+     * @param defaultNamespace
+     *            , namespace used in classes that do not
+     *            specify a namespace in the resource.
+     * 
+     * @return The Map of loaded dynamic classes
+     * 
+     * @throws XmlPullParserException
+     * @throws IOException
+     */
+    public Map importDynClassDefinitions(XmlPullParser parser,
+        ClassLoader loader, String defaultNamespace)
+        throws XmlPullParserException, IOException;
+
+    /**
+     * A�ade la dynClass a la lista de clases registradas.
+     * Falla lanzando una excepcion si ya existe una clase registrada con ese
+     * nombre en ese namespace.
+     * 
+     * @param dynClass
+     * @throws DuplicateDynClassException
+     */
+    public void add(DynClass dynClass) throws DuplicateDynClassException;
+
+    /**
+     * Create and add to the manager a class with the name
+     * passed as parameter in the default namespace.
+     * 
+     * @param name
+     * @param description
+     * @return the new class created.
+     */
+    public DynClass add(String name, String description);
+
+    /**
+     * Create and add to the manager a class with the name
+     * passed as parameter in the default namespace.
+     * 
+     * @param name
+     * @param description
+     * @return the new class created.
+     */
+    public DynClass add(String name);
+
+    public void remove(DynStruct dynClass);
+
+    /**
+     * Obtiene la clase asociado al nombre indicado.
+     * 
+     * Si se indica un nombre con namespace la buscara en
+     * ese namespace. if not se usara el namespace por
+     * defecto.
+     * 
+     * @param name
+     *            , nombre de la clase que queremos obtener.
+     * @return la clase requerida.
+     */
+    public DynClass get(String name);
+
+    /**
+     * Obtiene el la clase asociado al nombre indicado dentro del
+     * namespace pedido.
+     * 
+     * @param name
+     *            , nombre de la clase que queremos obtener.
+     * @return la clase requerida.
+     */
+    public DynClass get(String namespace, String name);
+
+    /**
+     * Comprueba si esta registrada una clase.
+     * 
+     * @return true si la clase "name" esta registrada, false si no.
+     */
+    public boolean has(String name);
+
+    /**
+     * Comprueba si esta registrada una clase.
+     * 
+     * @return true si la clase "name" esta registrada, false si no.
+     */
+    public boolean has(String namespace, String name);
+
+    /**
+     * Return the count of registered DynClass.
+     * 
+     * @return count of DynClass
+     */
+    public int getCount();
+
+    /**
+     * Return an iterator over all registered DynClass.
+     * 
+     * @return the iterator.
+     */
+    public Iterator iterator();
+
+    /**
+     * Return an iterator over all registered DynClass with the same namespace.
+     * 
+     * @return the iterator.
+     */
+    public Iterator iterator(String namespace);
+
+    /**
+     * Return the list of names of all registered DynClass.
+     * 
+     * @return list of DynClass names.
+     */
+    public List getNames();
+
+    /**
+     * Create a new DynObject associated to the DynStruct or DynClass
+     * passed as parameter.
+     * 
+     * @param dynStruct
+     *            or dynClass to use for create the dynObject
+     * @return the new DynObject
+     */
+    public DynObject createDynObject(DynStruct dynStruct);
+
+    /**
+     * Crea un nuevo objeto asociandole como clase base la indicada que tiene el
+     * nombre indicado.
+     * 
+     * @param dynClassName
+     * @return el nuevo DynObject
+     */
+    public DynObject createDynObject(String classname);
+
+    /**
+     * Crea un nuevo objeto asociandole como clase base la indicada que tiene el
+     * nombre indicado.
+     * 
+     * @param dynClassName
+     * @return el nuevo DynObject
+     */
+    public DynObject createDynObject(String namespace, String classname);
+
+    /**
+     * Actualiza todas las DynClasses registradas para reflejar la
+     * herencia de forma adecuada.
+     */
+    public void consolide();
+
+    /**
+     * Register the method in the dynClass.
+     * 
+     * @param dynClass
+     *            class over the method is registred
+     * @param dynMethod
+     *            method to registry
+     * @return unique code of method
+     */
+    public int registerDynMethod(DynClass dynClass, DynMethod dynMethod);
+
+    /**
+     * Register the method in the class.
+     * 
+     * @param theClass
+     *            class over the method is registred
+     * @param dynMethod
+     *            method to registry
+     * @return unique code of method
+     */
+    public int registerDynMethod(Class theClass, DynMethod dynMethod);
+
+    /**
+     * Obtain the method for the indicated code of the dynObject.
+     * 
+     * @param dynObject
+     * @param code
+     *            code of the requeted method
+     * @return the required DynMethod
+     * 
+     * @throws DynMethodException
+     */
+    public DynMethod getDynMethod(DynObject dynObject, int code)
+        throws DynMethodException;
+
+    public DynMethod getDynMethod(DynClass dynClass, int code)
+        throws DynMethodException;
+
+    public DynMethod getDynMethod(Object obj, int code)
+        throws DynMethodException;
+
+    public DynMethod getDynMethod(Class theClass, int code)
+        throws DynMethodException;
+
+    public DynMethod getDynMethod(int code) throws DynMethodException;
+
+    /**
+     * Invoke the method of the indicated code for the object self, with
+     * parameters in context.
+     * 
+     * @param self
+     *            object over the method is invoked
+     * @param code
+     *            code for the method to invoke
+     * @param context
+     *            paramters of method
+     * @return return value for the method
+     * @throws DynMethodException
+     */
+    public Object invokeDynMethod(Object self, int code, DynObject context)
+        throws DynMethodException;
+
+    void validate(DynObject object) throws DynObjectValidateException;
+
+    /**
+     * @deprecated use DataTypesManager.getDefaultClass
+     */
+    Class getDefaultClassOfType(int type);
+
+    /**
+     * Creates a new {@link DynObjectPagingHelper} to page the data of a
+     * {@link DynObjectSet}.
+     * 
+     * @param set
+     *            to page the data of
+     * @return a {@link DynObjectPagingHelper}
+     * @throws BaseException
+     *             if there is an error creating the paging helper, usually
+     *             because of an error getting the data of the
+     *             {@link DynObjectSet}
+     */
+    DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set)
+        throws BaseException;
+
+    /**
+     * Creates a new {@link DynObjectPagingHelper} to page the data of a
+     * {@link DynObjectSet}.
+     * 
+     * @param set
+     *            to page the data of
+     * @param pageSize
+     *            the size of the page to load using the helper
+     * @return a {@link DynObjectPagingHelper}
+     * @throws BaseException
+     *             if there is an error creating the paging helper, usually
+     *             because of an error getting the data of the
+     *             {@link DynObjectSet}
+     */
+    DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set,
+        int pageSize) throws BaseException;
+
+    /**
+     * Creates a {@link org.gvsig.tools.dynobject.DynClassName} with a DynClass
+     * name and its namespace.
+     * 
+     * @param namespace
+     *            where the {@link DynClass} belongs to
+     * @param name
+     *            of the {@link DynClass}
+     * @return a new {@link org.gvsig.tools.dynobject.DynClassName}
+     */
+    DynClassName createDynClassName(String namespace, String name);
+
+    /**
+     * Creates a {@link org.gvsig.tools.dynobject.DynClassName} with a DynClass
+     * name or fullname
+     * 
+     * @param name
+     *            of the {@link DynClass}. It might be a simple name or a
+     *            composed full name (namespace and name)
+     * @return a new {@link org.gvsig.tools.dynobject.DynClassName}
+     */
+    DynClassName createDynClassName(String name);
+
+    public Object getAttributeValue(Object obj, String name);
+
+    public void setAttributeValue(Object obj, String name, Object value);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldValidateException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldValidateException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldValidateException.java	(revision 1235)
@@ -0,0 +1,181 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+
+public class DynFieldValidateException extends DynMethodException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5033443492130842514L;
+	private final static String MESSAGE_FORMAT = "Field '%(field)' of type %(fieldtype) has a invalid value of '%(value)'.";
+	private final static String MESSAGE_KEY = "_Field_XfieldX_of_type_XfieldtypeX_has_a_invalid_value_of_XvalueX";
+
+	protected DynFieldValidateException(String messagefmt, String key, long code) {
+		super(messagefmt, key, code);
+	}
+
+        protected DynFieldValidateException(String messagefmt, Throwable cause, String key, long code) {
+		super(messagefmt, cause, key, code);
+	}
+
+	public DynFieldValidateException(Object value, DynField field,
+			Throwable cause) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		if (cause != null) {
+			this.initCause(cause);
+		}
+
+		setValue("field", field.getName());
+		setValue(value);
+		if (field.getAvailableValues() != null) {
+			StringBuffer buffer = new StringBuffer();
+			buffer.append(ToolsLocator.getDataTypesManager().getTypeName(
+					field.getType()));
+			buffer.append(" ( ");
+			for (int i = 0; i < field.getAvailableValues().length; i++) {
+				buffer.append(field.getAvailableValues()[i].getValue()
+						.toString());
+				buffer.append(", ");
+			}
+			buffer.append(")");
+			setValue("fieldtype", buffer.toString());
+		} else if (field.getMaxValue() != null && field.getMinValue() != null) {
+			setValue("fieldtype", ToolsLocator.getDataTypesManager()
+					.getTypeName(field.getType())
+					+ "  (  "
+					+ field.getMinValue().toString()
+					+ " <= x <=  "
+					+ field.getMaxValue().toString() + ")");
+
+		} else {
+			setValue("fieldtype", ToolsLocator.getDataTypesManager()
+					.getTypeName(field.getType()));
+		}
+		if (value == null) {
+			setValue("valuetype", "null");
+		} else {
+			setValue("valuetype", value.getClass().getName());
+		}
+	}
+
+	private void setValue(Object value) {
+		try {
+			if (value instanceof DynObject) {
+				// setValue("value", getDynObjectValueText((DynObject) value));
+				setValue("value",
+						getDynClassValueText(((DynObject) value).getDynClass()));
+				return;
+			} else if (value instanceof DynClass) {
+				setValue("value", getDynClassValueText((DynStruct) value));
+				return;
+			} else if (value instanceof DynStruct) {
+				setValue("value", getDynClassValueText((DynStruct) value));
+				return;
+			}
+			if (value == null) {
+				setValue("value", "null");
+			} else {
+				setValue("value", value.toString());
+			}
+		} catch (Exception e) {
+			setValue("value", "(unknow)");
+		}
+	}
+
+	private String getDynClassValueText(DynStruct definition) {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append(definition.getName()).append("\n  ");
+		buffer.append("Mandatory values are: ");
+		DynField[] fields = definition.getDynFields();
+		if (fields == null || fields.length == 0) {
+			buffer.append("(none)\n");
+			return buffer.toString();
+		}
+		
+		DynField field;
+		String DEL = ",  ";
+		StringBuffer items = new StringBuffer();
+		
+		buffer.append("[");
+		for (int i = 0; i < fields.length; i++) {
+			field = fields[i];
+			if (field.isMandatory()) {
+				items.append(field.getName());
+				items.append(DEL);
+			}
+		}
+		buffer.append(items);
+		buffer.append("]");
+		
+		return buffer.toString();
+	}
+
+	private String getDynObjectValueText(DynObject dynObject) {
+		String space = "  ";
+		StringBuffer buffer = new StringBuffer();
+		buffer.append(dynObject.getDynClass().getName()).append("\n");
+		DynField[] fields = dynObject.getDynClass().getDynFields();
+		if (fields == null || fields.length == 0) {
+			return buffer.toString();
+		}
+
+		DynField field;
+		buffer.append("(\n");
+		for (int i = 0; i < fields.length; i++) {
+			field = fields[i];
+			Object value = null;
+			try {
+				value = dynObject.getDynValue(field.getName());
+				field.validate(value);
+			} catch (DynFieldValidateException ex) {
+				if (value instanceof DynObject) {
+					buffer.append(space).append(
+							getDynObjectValueText((DynObject) value));
+				} else {
+					buffer.append(space).append(ex.getLocalizedMessageStack());
+				}
+			} catch (DynFieldNotFoundException ex2) {
+				if (value instanceof DynObject) {
+					buffer.append(space).append(
+							getDynObjectValueText((DynObject) value));
+				} else {
+					buffer.append(space).append(ex2.getLocalizedMessageStack());
+				}
+			}
+		}
+		buffer.append(")");
+		return buffer.toString();
+	}
+
+	public DynFieldValidateException(Object value, DynField field) {
+		this(value, field, null);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldValidateException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DuplicateDynClassException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DuplicateDynClassException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DuplicateDynClassException.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {DiSiD Technologies}  {Create DynObjects implementation}
+*/
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+import org.gvsig.tools.dynobject.DynStruct;
+
+/**
+ * Exception thrown when a DynClass is duplicated
+ * 
+ * @author jjdelcerro
+ */
+public class DuplicateDynClassException extends DynObjectRuntimeException {
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -6748081522560475914L;
+    private static final String MESSAGE = "Duplicated DynClass '%(name)'.";
+	private static final String KEY = "_Duplicated_DynClass_XnameX";
+
+    /**
+     * Creates a new DynClassNotFoundException.
+     * 
+     * @param dynClassName
+     *            the name of the DynClass that does not exist
+     */
+    public DuplicateDynClassException(String dynClassName) {
+        super(MESSAGE, KEY, serialVersionUID);
+        this.setValue("name", dynClassName);
+    }
+
+    public DuplicateDynClassException(DynStruct dynClass) {
+        super(MESSAGE, KEY, serialVersionUID);
+        this.setValue("name", dynClass.getFullName());
+    }
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DuplicateDynClassException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldNotFoundException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldNotFoundException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldNotFoundException.java	(revision 1235)
@@ -0,0 +1,98 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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 DynObjects implementation}
+*/
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+
+/**
+ * Exception thrown when an attribute of a DynObject does not exist.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DynFieldNotFoundException extends DynObjectRuntimeException {
+
+    private static final long serialVersionUID = -945752158015340022L;
+
+    private static final String KEY = "_The_attribute_XattributeNameX_does_not_exist_in_a_DynObject_of_the_DynClass_XdynClassNameX";
+
+    private static final String MESSAGE = "The attribute %(attributeName) "
+            + "does not exist in a DynObject of the DynClass %(dynClassName)";
+
+    /**
+     * Creates a new DynFieldNotFoundException.
+     *
+     * @param dynFieldName
+     *            the name of the attribute not found
+     * @param dynClassName
+     *            the name of the DynClass where the attribute does not exist
+     */
+    public DynFieldNotFoundException(String dynFieldName, String dynClassName) {
+        super(MESSAGE, KEY, serialVersionUID);
+        this.setValue("attributeName", dynFieldName);
+        this.setValue("dynClassName", dynClassName);
+    }
+
+    /**
+     * Creates a new DynFieldNotFoundException.
+     *
+     * @param dynFieldName
+     *            the name of the attribute not found
+     * @param dynClassName
+     *            the name of the DynClass where the attribute does not exist
+     * @param cause
+     *            the original cause exception
+     */
+    public DynFieldNotFoundException(String dynFieldName, String dynClassName,
+            Throwable cause) {
+        super(MESSAGE, cause, KEY, serialVersionUID);
+        this.setValue("attributeName", dynFieldName);
+        this.setValue("dynClassName", dynClassName);
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodException.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynObjectException;
+
+
+public abstract class DynMethodException extends DynObjectException {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7079190638140530989L;
+
+	protected DynMethodException(String messagefmt, String key, long code) {
+		super(messagefmt, key, code);
+	}
+
+        protected DynMethodException(String messagefmt, Throwable cause, String key, long code) {
+		super(messagefmt, cause, key, code);
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectValidateException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectValidateException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectValidateException.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.dynobject.exception;
+
+import org.gvsig.tools.exception.ListBaseException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DynObjectValidateException extends ListBaseException {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3935895993135692900L;
+	private final static String MESSAGE_FORMAT = "Errors found validating '%(name)'.";
+	private final static String MESSAGE_KEY = "_DynObjectValidateException";
+
+	public DynObjectValidateException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name", name);
+	}
+	
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldRequiredValueException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldRequiredValueException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldRequiredValueException.java	(revision 1235)
@@ -0,0 +1,89 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+
+public class DynFieldRequiredValueException extends DynFieldValidateException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7813629748228774775L;
+    private final static String MESSAGE_FORMAT =
+        "Field '%(fieldText)': Value required.";
+    private final static String MESSAGE_KEY =
+        "_Field_XfieldTextX_Value_required";
+
+	public DynFieldRequiredValueException(DynField field, Object value) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+
+        setValue("field", field.getName());
+        setValue("fieldText", translate(field.getName()));
+		setValue(value);
+	}
+
+    private String translate(String name) {
+        return ToolsLocator.getI18nManager().getTranslation(name);
+    }
+
+    private void setValue(Object value) {
+		try {
+			if (value instanceof DynObject) {
+				setValue("value", ((DynObject) value).getDynClass().getName());
+				return;
+			} else if (value instanceof DynClass) {
+				setValue("value", ((DynClass) value).getName());
+				return;
+			} else if (value instanceof DynStruct) {
+				setValue("value", ((DynStruct) value).getName());
+				return;
+			}
+			if (value == null) {
+				setValue("value", "null");
+			} else {
+				setValue("value", value.toString());
+			}
+		} catch (Exception e) {
+			setValue("value", "(unknow)");
+		}
+	}
+
+	public DynField getDynField() {
+		return (DynField) this.values().get("field");
+	}
+
+	public String getDynFieldName() {
+		return this.getDynField().getName();
+	}
+
+	public Object getValueOfException() {
+		return this.values().get("value");
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldRequiredValueException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynClassNotFoundException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynClassNotFoundException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynClassNotFoundException.java	(revision 1235)
@@ -0,0 +1,93 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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 DynObjects implementation}
+*/
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+
+/**
+ * Exception thrown when a DynClass does not exist.
+ * 
+ * @author gvSIG team
+ */
+public class DynClassNotFoundException extends DynObjectRuntimeException {
+    
+    private static final long serialVersionUID = 3901517820197735933L;
+
+    private static final String KEY = "_The_DynClass_with_the_name_XnameX_does_not_exist";
+
+    private static final String MESSAGE = "The DynClass with the name "
+            + "%(dynClassName) does not exist";
+
+    /**
+     * Creates a new DynClassNotFoundException.
+     * 
+     * @param dynClassName
+     *            the name of the DynClass that does not exist
+     */
+    public DynClassNotFoundException(String dynClassName) {
+        super(MESSAGE, KEY, serialVersionUID);
+        setValue("name",dynClassName);
+    }
+
+    /**
+     * Creates a new DynClassNotFoundException.
+     * 
+     * @param dynClassName
+     *            the name of the DynClass that does not exist
+     * @param cause
+     *            the original cause exception
+     */
+    public DynClassNotFoundException(String dynClassName,
+            Throwable cause) {
+        super(MESSAGE, cause, KEY, serialVersionUID);
+        setValue("name",dynClassName);
+    }
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldIsNotAContainerException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldIsNotAContainerException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldIsNotAContainerException.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+
+public class DynFieldIsNotAContainerException extends DynObjectRuntimeException {
+
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -1538491031568651876L;
+
+	private static final String KEY = "_Container_type_is_required_for_type_of_field_XnameX";
+
+    private static final String MESSAGE = "Container type (array, list, map or set) is requiered for type of field '%(name).";
+
+    public DynFieldIsNotAContainerException(String dynFieldName) {
+        super(MESSAGE, KEY, serialVersionUID);
+        this.setValue("name", dynFieldName);
+    }
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynFieldIsNotAContainerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectFieldSubtypeRequiredValueException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectFieldSubtypeRequiredValueException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynObjectFieldSubtypeRequiredValueException.java	(revision 1235)
@@ -0,0 +1,87 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+
+public class DynObjectFieldSubtypeRequiredValueException extends
+		DynFieldValidateException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7813629748228774775L;
+	private final static String MESSAGE_FORMAT = "Field '%(field)': DynObject field in '%(definitionName)' needs to have its subtype set to '%(definitionFullName)'";
+	private final static String MESSAGE_KEY = "_Field_XfieldX_Value_required.";
+
+	public DynObjectFieldSubtypeRequiredValueException(
+			DynStruct parentDefinition, DynField field, Object value) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("definitionFullName", parentDefinition.getFullName());
+		setValue("definitionName", parentDefinition.getName());
+		setValue("field", field.getName());
+		setValue(value);
+	}
+
+	private void setValue(Object value) {
+		try {
+			if (value instanceof DynObject) {
+				setValue("value", ((DynObject) value).getDynClass().getName());
+				return;
+			} else if (value instanceof DynClass) {
+				setValue("value", ((DynClass) value).getName());
+				return;
+			} else if (value instanceof DynStruct) {
+				setValue("value", ((DynStruct) value).getName());
+				return;
+			}
+			if (value == null) {
+				setValue("value", "null");
+			} else {
+				setValue("value", value.toString());
+			}
+		} catch (Exception e) {
+			setValue("value", "(unknow)");
+		}
+	}
+
+	public DynField getDynField() {
+		return (DynField) this.values().get("field");
+	}
+
+	public DynField getDefinition() {
+		return (DynField) this.values().get("definitionFullName");
+	}
+
+	public String getDynFieldName() {
+		return this.getDynField().getName();
+	}
+
+	public Object getValueOfException() {
+		return this.values().get("value");
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodInvocationException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodInvocationException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodInvocationException.java	(revision 1235)
@@ -0,0 +1,48 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynClass;
+
+public class IllegalDynMethodInvocationException extends DynMethodException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4671773584912776614L;
+	private final static String MESSAGE_FORMAT = "Can't invoke method %(name) for class %(badclass).";
+	private final static String MESSAGE_KEY = "_Cant_invoke_method_XnameX_for_class_XbadclassX";
+
+	public IllegalDynMethodInvocationException(String name, Class badClass) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+		setValue("badclass", badClass.getName());
+	}
+
+	public IllegalDynMethodInvocationException(String name, DynClass dynClass) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+		setValue("badclass", dynClass.getName());
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodIllegalCodeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodIllegalCodeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodIllegalCodeException.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+
+public class DynMethodIllegalCodeException extends DynMethodException {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 8651495467468815121L;
+	private final static String MESSAGE_FORMAT = "Can't invoke method %(name) with code %(badcode)m real code %(code).";
+	private final static String MESSAGE_KEY = "_DynMethodIllegalCodeException";
+
+	public DynMethodIllegalCodeException(String name, int code, int badcode) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+		setValue("code", new Integer(code));
+		setValue("badcode", new Integer(badcode));
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodNotSupportedException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodNotSupportedException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/DynMethodNotSupportedException.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+
+public class DynMethodNotSupportedException extends DynMethodException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -5061673498469446308L;
+	private final static String MESSAGE_FORMAT = "Method not suported";
+	private final static String MESSAGE_FORMAT_CODE = "Method not suported (code=%(code)) for class %(className)";
+	private final static String MESSAGE_FORMAT_NAME = "Method not suported (name=%(name)) for class %(className)";
+	private final static String MESSAGE_KEY = "_Method_not_suported";
+	private final static String MESSAGE_KEY_CODE = "_Method_of_code_XcodeX_not_suported_for_class_XclassNameX";
+	private final static String MESSAGE_KEY_NAME = "_Method_of_name_XnameX_not_suported_for_class_XclassNameX";
+
+	public DynMethodNotSupportedException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+
+	public DynMethodNotSupportedException(int code, String className) {
+		super(MESSAGE_FORMAT_CODE, MESSAGE_KEY_CODE, serialVersionUID);
+		setValue("code", "" + code);
+		setValue("className", className);
+	}
+
+	public DynMethodNotSupportedException(String name, String className) {
+		super(MESSAGE_FORMAT_NAME, MESSAGE_KEY_NAME, serialVersionUID);
+		setValue("name", name);
+		setValue("className", className);
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/exception/IllegalDynMethodException.java	(revision 1235)
@@ -0,0 +1,48 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.exception;
+
+import org.gvsig.tools.dynobject.DynClass;
+
+public class IllegalDynMethodException extends DynMethodException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2958323225403802109L;
+	private final static String MESSAGE_FORMAT = "Method %(name) not found in class %(badclass).";
+	private final static String MESSAGE_KEY = "_Method_XnameX_not_found_in_class_XbadclassX";
+
+	public IllegalDynMethodException(String name, Class badClass) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+		setValue("badclass", badClass.getName());
+	}
+
+	public IllegalDynMethodException(String name, DynClass badDynClass) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+		setValue("badclass", badDynClass.getName());
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DelegatedDynObject.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DelegatedDynObject.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DelegatedDynObject.java	(revision 1235)
@@ -0,0 +1,33 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+public interface DelegatedDynObject extends DynObject {
+
+	Object invokeDynMethod(Object self, String methodName, DynObject context)throws DynMethodException;
+	
+	Object invokeDynMethod(Object self, int methodCode, DynObject context) throws DynMethodException;
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create DynObjects implementation}
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+
+/**
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaqu�n Jos� del Cerro</a>
+ */
+public interface DynClass extends DynStruct {
+
+
+    DynClass[] getSuperDynClasses();
+
+
+    /**************/
+    /* DynMethods */
+    /**************/
+
+    DynMethod getDeclaredDynMethod(String name) throws DynMethodException;
+
+    DynMethod[] getDeclaredDynMethods() throws DynMethodException;
+
+    DynMethod getDynMethod(String name) throws DynMethodException;
+
+    DynMethod[] getDynMethods() throws DynMethodException;
+
+    DynMethod getDynMethod(int code) throws DynMethodException;
+
+    void addDynMethod(DynMethod dynMethod);
+
+    void removeDynMethod(String name);
+
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObject.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObject.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynObject.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create DynObjects implementation}
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+/**
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaqu�n Jos� del Cerro</a>
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface DynObject {
+
+	DynClass getDynClass();
+
+    void implement(DynClass dynClass);
+
+    void delegate(DynObject dynObject);
+
+	Object getDynValue(String name)  throws DynFieldNotFoundException ;
+
+	void setDynValue(String name, Object value)  throws DynFieldNotFoundException ;
+
+	boolean hasDynValue(String name);
+
+	Object invokeDynMethod(String name, DynObject context) throws DynMethodException;
+
+	Object invokeDynMethod(int code, DynObject context) throws DynMethodException;
+
+	void clear();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_LabelAttribute.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_LabelAttribute.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField_LabelAttribute.java	(revision 1235)
@@ -0,0 +1,33 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.tools.dynobject;
+
+
+public interface DynField_LabelAttribute extends DynField {
+
+    public String getLabel();
+    
+    public DynField setLabel(String label);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClassName.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClassName.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClassName.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+/**
+ * Identifies a {@link DynClass} with its namespace and its name.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface DynClassName {
+
+	/**
+	 * Returns the name of the {@link DynClass}.
+	 * 
+	 * @return the name
+	 */
+	String getName();
+
+	/**
+	 * Returns the name space of the {@link DynClass}.
+	 * 
+	 * @return the name space
+	 */
+	String getNamespace();
+
+	/**
+	 * Returns the full name (namespace and name) of the {@link DynClass}.
+	 * 
+	 * @return the full name
+	 */
+	String getFullName();
+
+	/**
+	 * Sets the namespace of the {@link DynClass}.
+	 * 
+	 * @param namespace
+	 *            the name space
+	 */
+	void setNamespace(String namespace);
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClassName.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportHelper.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportHelper.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportHelper.java	(revision 1235)
@@ -0,0 +1,906 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynClassName;
+import org.gvsig.tools.dynobject.DynClass_v2;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+import org.gvsig.tools.exception.ListBaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+public class DynClassImportHelper implements DynClassImportExportTags {
+
+    private static final Logger LOG = LoggerFactory
+            .getLogger(DynClassImportHelper.class);
+
+    private DynObjectManager manager = ToolsLocator.getDynObjectManager();
+
+    private Map dynClasses = null;
+
+    private String getNullWhenEmptyString(String value) {
+        if ( value != null ) {
+            if ( value.trim().length() == 0 ) {
+                return null;
+            }
+        }
+        return value;
+
+    }
+
+    private String nextText(XmlPullParser parser)
+            throws XmlPullParserException, IOException {
+        return getNullWhenEmptyString(parser.nextText());
+    }
+
+    private String getAttributeValue(XmlPullParser parser, int i)
+            throws XmlPullParserException, IOException {
+        return getNullWhenEmptyString(parser.getAttributeValue(i));
+    }
+
+    public Map importDefinitions(InputStream resource, ClassLoader loader,
+            String defaultNamespace) throws XmlPullParserException, IOException {
+
+        XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
+                ToolsLocator.getInstance().getXmlPullParserFactoryClassNames(),
+                null);
+
+        XmlPullParser parser = factory.newPullParser();
+
+        parser.setInput(resource, null);
+
+        return importDefinitions(parser, loader, defaultNamespace);
+    }
+
+    private class Definitions extends HashMap implements Map {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = -3322643637478345069L;
+
+        public Object put(Object key, Object value) {
+            return super.put(((String) key).toLowerCase(), value);
+        }
+
+        public Object get(Object theName) {
+            DynClass definition;
+            definition = (DynClass) super.get(((String) theName).toLowerCase());
+            if ( definition != null ) {
+                return definition;
+            }
+            // No ha encontrado la clase pedida, podria ser que el namespace
+            // no coincida, vamos a buscarla ignorando el namespace en caso
+            // de que este no se haya indicado.
+            DynClassName name = manager.createDynClassName((String) theName);
+            if ( name.getNamespace() == null ) {
+                // No han especificado namespace, asi que busco la primera
+                // que tenga como nombre el indicado independientemente del
+                // namespace que tenga.
+                Iterator it = this.values().iterator();
+                while ( it.hasNext() ) {
+                    definition = (DynClass) it.next();
+                    if ( definition.getName().equalsIgnoreCase(name.getName()) ) {
+                        return definition;
+                    }
+                }
+            } else {
+                // Han especificaso un namespace, asi que voy a buscar una que
+                // no tenga namespace y su nombre concuerde.
+                Iterator it = this.values().iterator();
+                while ( it.hasNext() ) {
+                    definition = (DynClass) it.next();
+                    if ( definition.getNamespace() == null
+                            && definition.getName().equalsIgnoreCase(
+                                    name.getName()) ) {
+                        return definition;
+                    }
+                }
+            }
+            return null;
+        }
+
+        public boolean containsKey(Object key) {
+            String lowerKey = ((String) key).toLowerCase();
+            if ( super.containsKey(lowerKey) ) {
+                return true;
+            }
+            Object value = this.get(lowerKey);
+            return value != null;
+        }
+    }
+
+    public Map importDefinitions(XmlPullParser parser, ClassLoader loader,
+            String defaultNamespace) throws XmlPullParserException, IOException {
+        dynClasses = new Definitions();
+        String version = null;
+
+        if ( loader == null ) {
+            loader = this.getClass().getClassLoader();
+        }
+        parser.nextTag();
+        parser.require(XmlPullParser.START_TAG, null, DEFINITIONS_TAG);
+        for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+            String name = parser.getAttributeName(i);
+            if ( name.equalsIgnoreCase(VERSION_TAG) ) {
+                version = this.getAttributeValue(parser, i);
+            } else {
+                throw new WrongVersionException(parser);
+            }
+        }
+        parser.nextTag();
+        if ( parser.getName().equalsIgnoreCase(VERSION_TAG) ) {
+            parser.require(XmlPullParser.START_TAG, null, VERSION_TAG);
+            version = parser.nextText();
+            if ( !version.trim().equals(VERSION_VALUE) ) {
+                throw new UnsupportedClassVersionError();
+            }
+            parser.require(XmlPullParser.END_TAG, "", VERSION_TAG);
+            parser.nextTag();
+        }
+
+        parser.require(XmlPullParser.START_TAG, "", CLASSES_TAG);
+        parser.nextTag();
+        while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                .getName().equals(CLASSES_TAG)) ) {
+            checkEndDocument(parser);
+            DynClass dynClass = importDynClass(parser, loader,
+                    defaultNamespace, dynClasses);
+            try {
+                ((DefaultDynClass) dynClass).check();
+            } catch (ListBaseException e) {
+                throw new DynObjectRuntimeException(e);
+            }
+            if ( dynClasses.get(dynClass.getFullName()) != null ) {
+                throw new DuplicateDynClassException(parser,
+                        dynClass.getFullName());
+            }
+            dynClasses.put(dynClass.getFullName(), dynClass);
+        }
+        parser.require(XmlPullParser.END_TAG, "", CLASSES_TAG);
+        parser.nextTag();
+
+        parser.require(XmlPullParser.END_TAG, "", DEFINITIONS_TAG);
+        parser.next();
+
+        parser.require(XmlPullParser.END_DOCUMENT, null, null);
+        LOG.debug("Imported classes {}", new Object[]{getKeys(dynClasses)});
+        return dynClasses;
+    }
+
+    private String getKeys(Map theMap) {
+        List l = new ArrayList(theMap.keySet());
+        return l.toString();
+    }
+
+    private DynClass importDynClass(XmlPullParser parser, ClassLoader loader,
+            String defaultNamespace, Map classes)
+            throws XmlPullParserException, IOException {
+        DynObjectManager manager = ToolsLocator.getDynObjectManager();
+        DynClass dynClass;
+        List superClasses = new ArrayList();
+        Map values = new HashMap();
+        List tagsValues = null;
+
+        parser.require(XmlPullParser.START_TAG, null, CLASS_TAG);
+        //
+        // Collect class attributes from tag attributes
+        //
+        for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+            values.put(parser.getAttributeName(i),
+                    this.getAttributeValue(parser, i));
+        }
+        parser.nextTag();
+
+        while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                .getName().equals(CLASSES_TAG)) ) {
+            checkEndDocument(parser);
+
+            parser.require(XmlPullParser.START_TAG, null, null);
+            String tagName = parser.getName();
+            if ( tagName.equalsIgnoreCase(CLASS_DESCRIPTION_TAG) ) {
+                values.put(CLASS_DESCRIPTION_TAG, this.nextText(parser));
+
+            } else if ( tagName.equalsIgnoreCase(CLASS_NAME_TAG) ) {
+                values.put(CLASS_NAME_TAG, this.nextText(parser));
+
+            } else if ( tagName.equalsIgnoreCase(CLASS_NAMESPACE_TAG) ) {
+                values.put(CLASS_NAMESPACE_TAG, this.nextText(parser));
+
+            } else if ( tagName.equalsIgnoreCase(CLASS_SUPERCLASSNAMES_TAG) ) {
+                parser.nextTag();
+                while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                        .getName().equals(CLASS_SUPERCLASSNAMES_TAG)) ) {
+                    checkEndDocument(parser);
+                    parser.require(XmlPullParser.START_TAG, "",
+                            CLASS_SUPERCLASSNAME_TAG);
+                    superClasses.add(manager.createDynClassName(
+                            defaultNamespace, this.nextText(parser)));
+                    parser.require(XmlPullParser.END_TAG, null,
+                            CLASS_SUPERCLASSNAME_TAG);
+                    parser.nextTag();
+                }
+
+            } else if ( tagName.equalsIgnoreCase(CLASS_EXTENDS_TAG) ) {
+                parser.nextTag();
+                while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                        .getName().equals(CLASS_EXTENDS_TAG)) ) {
+                    checkEndDocument(parser);
+                    superClasses
+                            .add(importSuperClass(parser, defaultNamespace));
+                    parser.nextTag();
+                }
+
+            } else if ( tagName.equalsIgnoreCase(FIELD_TAGS_TAG) ) {
+                parser.nextTag();
+                tagsValues = new ArrayList();
+                while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                        .getName().equals(FIELD_TAGS_TAG)) ) {
+                    checkEndDocument(parser);
+                    tagsValues.add(importValueItem(parser, VALUEITEM_TAGNAME_TAG));
+                    parser.nextTag();
+                }
+
+            } else {
+                break;
+            }
+            parser.require(XmlPullParser.END_TAG, null, tagName);
+            parser.nextTag();
+        }
+        parser.require(XmlPullParser.START_TAG, null, CLASS_FIELDS_TAG);
+        parser.nextTag();
+
+        //
+        // Create dynclass
+        //
+        if ( values.get(CLASS_NAME_TAG) == null ) {
+            throw new NeedTagOrAttributeException(parser, CLASS_NAME_TAG);
+        }
+        if ( values.get(CLASS_NAMESPACE_TAG) == null ) {
+            values.put(CLASS_NAMESPACE_TAG, defaultNamespace);
+        }
+        dynClass = manager.createDynClass(
+                (String) values.get(CLASS_NAMESPACE_TAG),
+                (String) values.get(CLASS_NAME_TAG),
+                (String) values.get(CLASS_DESCRIPTION_TAG));
+        for ( int i = 0; i < superClasses.size(); i++ ) {
+            DynClassName superClass = (DynClassName) superClasses.get(i);
+            if ( superClass.getName() == null ) {
+                throw new NeedTagOrAttributeException(parser, CLASS_NAME_TAG);
+            }
+            DynClass superDynClass = (DynClass) classes.get(superClass
+                    .getFullName());
+            if ( superDynClass == null ) {
+                superDynClass = ToolsLocator.getDynObjectManager().get(
+                        superClass.getNamespace(), superClass.getName());
+                if ( superDynClass == null ) {
+                    throw new CantLocateDynClassException(parser,
+                            superClass.getFullName());
+                }
+            }
+            dynClass.extend(superDynClass);
+        }
+        if ( tagsValues != null && !tagsValues.isEmpty() ) {
+            if ( dynClass instanceof DynClass_v2 ) {
+                for ( int i = 0; i < tagsValues.size(); i++ ) {
+                    PairValueLabel pair = (PairValueLabel) tagsValues.get(i);
+                    if ( pair.label != null ) {
+                        ((DynClass_v2) dynClass).getTags().set(pair.label, pair.value);
+                    }
+                }
+            }
+        }
+        //
+        // Parse and load fields of dynclass
+        //
+        while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                .getName().equals(CLASS_FIELDS_TAG)) ) {
+            checkEndDocument(parser);
+            importDynField(parser, (DynClass_v2) dynClass, loader);
+            parser.nextTag();
+        }
+        parser.require(XmlPullParser.END_TAG, null, CLASS_FIELDS_TAG);
+        parser.nextTag();
+
+        parser.require(XmlPullParser.END_TAG, null, CLASS_TAG);
+        parser.nextTag();
+        return dynClass;
+    }
+
+    private DynClassName importSuperClass(XmlPullParser parser,
+            String defaultNamespace) throws XmlPullParserException, IOException {
+
+        String name = null;
+        String namespace = defaultNamespace;
+
+        parser.require(XmlPullParser.START_TAG, null, CLASS_EXTENDS_CLASS_TAG);
+        for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+            String attrname = parser.getAttributeName(i);
+            if ( attrname.equalsIgnoreCase(CLASS_NAME_TAG) ) {
+                name = this.getAttributeValue(parser, i);
+            } else if ( attrname.equalsIgnoreCase(CLASS_NAMESPACE_TAG) ) {
+                namespace = this.getAttributeValue(parser, i);
+            } else {
+                throw new UnexpectedTagOrAttributeException(parser, attrname);
+            }
+        }
+        if ( name == null ) {
+            name = this.nextText(parser);
+        } else {
+            parser.nextTag();
+        }
+        parser.require(XmlPullParser.END_TAG, null, CLASS_EXTENDS_CLASS_TAG);
+        DynClassName dynClassName = manager.createDynClassName(namespace, name);
+        return dynClassName;
+    }
+
+    private void importDynField(XmlPullParser parser, DynClass_v2 dynClass,
+            ClassLoader loader) throws XmlPullParserException, IOException {
+        DynField_v2 field;
+        List availableValues = null;
+        List tagsValues = null;
+        Map values = new LinkedHashMap();
+
+        parser.require(XmlPullParser.START_TAG, null, FIELD_TAG);
+        //
+        // Collect field attributes from tag attributes
+        //
+        for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+            values.put(parser.getAttributeName(i),
+                    this.getAttributeValue(parser, i));
+        }
+        parser.nextTag();
+
+        //
+        // Collect field attributes from tags
+        //
+        while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                .getName().equals(FIELD_TAG)) ) {
+            checkEndDocument(parser);
+
+            parser.require(XmlPullParser.START_TAG, null, null);
+            String name = parser.getName();
+            if ( name.equalsIgnoreCase(FIELD_NAME_TAG) ) {
+                values.put(FIELD_NAME_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_DESCRIPTION_TAG) ) {
+                values.put(FIELD_DESCRIPTION_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_TYPE_TAG) ) {
+                values.put(FIELD_TYPE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_SUBTYPE_TAG) ) {
+                values.put(FIELD_SUBTYPE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_GROUP_TAG) ) {
+                values.put(FIELD_GROUP_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_LABEL_TAG) ) {
+                values.put(FIELD_LABEL_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_ORDER_TAG) ) {
+                values.put(FIELD_ORDER_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_ISMANDATORY_TAG) ) {
+                values.put(FIELD_ISMANDATORY_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_ISPERSISTENT_TAG) ) {
+                values.put(FIELD_ISPERSISTENT_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_MINVALUE_TAG) ) {
+                values.put(FIELD_MINVALUE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_MAXVALUE_TAG) ) {
+                values.put(FIELD_MAXVALUE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_CLASSOFVALUE_TAG) ) {
+                values.put(FIELD_CLASSOFVALUE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_CLASSOFITEMS_TAG) ) {
+                values.put(FIELD_CLASSOFITEMS_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_DEFAULTVALUE_TAG) ) {
+                values.put(FIELD_DEFAULTVALUE_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_HIDDEN_TAG) ) {
+                values.put(FIELD_HIDDEN_TAG, this.nextText(parser));
+
+            } else if ( name.equalsIgnoreCase(FIELD_AVALILABLEVALUES_TAG) ) {
+                parser.nextTag();
+                availableValues = new ArrayList();
+                while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                        .getName().equals(FIELD_AVALILABLEVALUES_TAG)) ) {
+                    checkEndDocument(parser);
+                    availableValues.add(importValueItem(parser, VALUEITEM_LABEL_TAG));
+                    parser.nextTag();
+                }
+
+            } else if ( name.equalsIgnoreCase(FIELD_TAGS_TAG) ) {
+                parser.nextTag();
+                tagsValues = new ArrayList();
+                while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                        .getName().equals(FIELD_TAGS_TAG)) ) {
+                    checkEndDocument(parser);
+                    tagsValues.add(importValueItem(parser, VALUEITEM_TAGNAME_TAG));
+                    parser.nextTag();
+                }
+
+            } else {
+                break;
+            }
+            parser.require(XmlPullParser.END_TAG, null, name);
+            parser.nextTag();
+        }
+        parser.require(XmlPullParser.END_TAG, null, FIELD_TAG);
+
+        if ( values.get(FIELD_NAME_TAG) == null ) {
+            throw new NeedTagOrAttributeException(parser, FIELD_NAME_TAG);
+        }
+
+        
+
+        //
+        // Get type and subtype first
+        //
+        String name = FIELD_TYPE_TAG;
+        String value = (String) values.get(name);
+        if ( value == null ) {
+            throw new InvalidFieldTypeException(parser, value);
+        }
+        int type = ToolsLocator.getDataTypesManager().getType(value);
+        if ( type == DataTypes.INVALID ) {
+            throw new InvalidFieldTypeException(parser, value);
+        }
+        //
+        // Create the field
+        //
+        field = (DynField_v2) dynClass.addDynField((String) values.get(FIELD_NAME_TAG),type);
+
+        //
+        // Load other values in the field
+        //
+        Iterator names = values.keySet().iterator();
+        while ( names.hasNext() ) {
+            name = (String) names.next();
+            value = (String) values.get(name);
+            if ( value == null ) {
+                continue;
+            }
+            if ( name.equalsIgnoreCase(FIELD_NAME_TAG) ) {
+                // Do nothing
+
+            } else if ( name.equalsIgnoreCase(FIELD_DESCRIPTION_TAG) ) {
+                field.setDescription(value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_TYPE_TAG) ) {
+                // Do nothing
+            } else if ( name.equalsIgnoreCase(FIELD_SUBTYPE_TAG) ) {
+                field.setSubtype(value);
+                
+            } else if ( name.equalsIgnoreCase(FIELD_GROUP_TAG) ) {
+                field.setGroup(value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_LABEL_TAG) ) {
+                this.manager.setAttributeValue(field, "label", value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_ORDER_TAG) ) {
+                field.setOrder(Integer.parseInt(value));
+
+            } else if ( name.equalsIgnoreCase(FIELD_ISMANDATORY_TAG) ) {
+                field.setMandatory(new Boolean(value).booleanValue());
+
+            } else if ( name.equalsIgnoreCase(FIELD_ISPERSISTENT_TAG) ) {
+                field.setPersistent(new Boolean(value).booleanValue());
+
+            } else if ( name.equalsIgnoreCase(FIELD_HIDDEN_TAG) ) {
+                field.setHidden(new Boolean(value).booleanValue());
+
+            } else if ( name.equalsIgnoreCase(FIELD_MINVALUE_TAG) ) {
+                field.setMinValue(value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_MAXVALUE_TAG) ) {
+                field.setMaxValue(value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_DEFAULTVALUE_TAG) ) {
+                field.setDefaultFieldValue(value);
+
+            } else if ( name.equalsIgnoreCase(FIELD_TYPEOFITEMS_TAG) ) {
+                int typeOfItems = ToolsLocator.getDataTypesManager().getType(value);
+                if ( typeOfItems == DataTypes.INVALID ) {
+                    throw new InvalidFieldTypeException(parser, value);
+                }
+                field.setTypeOfItems(typeOfItems);
+
+            } else if ( name.equalsIgnoreCase(FIELD_CLASSOFITEMS_TAG) ) {
+                if( field.getTypeOfItems()==DataTypes.DYNOBJECT ) {
+                    DynClass dynStruct = (DynClass) dynClasses.get(value);
+                    if ( dynStruct == null ) {
+                        // Try to search in registered DynClasses
+                        field.setClassOfItems(value);
+                    } else {
+                        field.setClassOfItems(dynStruct);
+                    }
+                } else {
+                    try {
+                        Class klass;
+                        klass = Class.forName(value, true, loader);
+                        field.setClassOfItems(klass);
+                    } catch (DynFieldIsNotAContainerException e) {
+                        LOG.warn("No se ha encontrado la clase '" + value + "'.", e);
+                        throw new IncompatibleAttributeValueException(parser,
+                                FIELD_NAME_TAG);
+                    } catch (ClassNotFoundException e) {
+                        LOG.warn("No se ha encontrado la clase '" + value + "'.", e);
+                        throw new CantLocateClassException(parser, FIELD_CLASSOFITEMS_TAG, value);
+                    }
+                }
+
+            } else if ( name.equalsIgnoreCase(FIELD_CLASSOFVALUE_TAG) ) {
+                if( field.getType()==DataTypes.DYNOBJECT ) {
+                    DynClass dynStruct = (DynClass) dynClasses.get(value);
+                    if ( dynStruct == null ) {
+                        // Try to search in registered DynClasses
+                        field.setClassOfValue(value);
+                    } else {
+                        field.setClassOfValue(dynStruct);
+                    }
+                } else {
+                    try {
+                        Class klass;
+                        klass = Class.forName(value, true, loader);
+                        field.setClassOfValue(klass);
+                    } catch (DynFieldIsNotAContainerException e) {
+                        LOG.warn("No se ha encontrado la clase '" + value + "'.", e);
+                        throw new IncompatibleAttributeValueException(parser,
+                                FIELD_NAME_TAG);
+                    } catch (ClassNotFoundException e) {
+                        LOG.warn("No se ha encontrado la clase '" + value + "'.", e);
+                        throw new CantLocateClassException(parser, FIELD_CLASSOFVALUE_TAG, value);
+                    }
+                }
+
+            } else if ( name.equalsIgnoreCase(FIELD_AVALILABLEVALUES_TAG) ) {
+                // Do nothing
+
+            } else {
+                throw new UnexpectedTagOrAttributeException(parser, name);
+            }
+        }
+
+        try {
+            //
+            // Coerce the min/max/default/available values to the type of
+            // the field
+            //
+            if ( availableValues != null && !availableValues.isEmpty() ) {
+                for ( int i = 0; i < availableValues.size(); i++ ) {
+                    PairValueLabel pair = (PairValueLabel) availableValues
+                            .get(i);
+                    if ( pair.label == null ) {
+                        if ( pair.value == null ) {
+                            pair.label = "null";
+                        } else {
+                            pair.label = pair.value.toString();
+                        }
+                    }
+                    availableValues.set(i,
+                            new DynObjectValueItem(field.coerce(pair.value),
+                                    pair.label));
+                }
+                field.setAvailableValues(availableValues);
+            }
+            if ( tagsValues != null && !tagsValues.isEmpty() ) {
+                for ( int i = 0; i < tagsValues.size(); i++ ) {
+                    PairValueLabel pair = (PairValueLabel) tagsValues.get(i);
+                    if ( pair.label != null ) {
+                        field.getTags().set(pair.label, pair.value);
+                    }
+                }
+            }
+            field.setMaxValue(field.coerce(values.get(FIELD_MAXVALUE_TAG)));
+            field.setMinValue(field.coerce(values.get(FIELD_MINVALUE_TAG)));
+            field.setDefaultFieldValue(field.coerce(values
+                    .get(FIELD_DEFAULTVALUE_TAG)));
+        } catch (CoercionException e) {
+            throw new ParseCoerceException(e, parser);
+        }
+    }
+
+    private class PairValueLabel {
+
+        String label = null;
+        String value = null;
+    }
+
+    private PairValueLabel importValueItem(XmlPullParser parser, String attributeName)
+            throws XmlPullParserException, IOException {
+        PairValueLabel pair = new PairValueLabel();
+
+        if ( parser.getName().equalsIgnoreCase(VALUEITEM_TAG) ) {
+            parser.require(XmlPullParser.START_TAG, null, VALUEITEM_TAG);
+            for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+                String name = parser.getAttributeName(i);
+                if ( name.equalsIgnoreCase(attributeName) ) {
+                    pair.label = this.getAttributeValue(parser, i);
+                } else if ( name.equalsIgnoreCase(VALUEITEM_VALUE_TAG) ) {
+                    pair.value = this.getAttributeValue(parser, i);
+                } else {
+                    throw new UnexpectedTagOrAttributeException(parser, name);
+                }
+            }
+            parser.nextTag();
+
+            while ( !(parser.getEventType() == XmlPullParser.END_TAG && parser
+                    .getName().equals(VALUEITEM_TAG)) ) {
+                checkEndDocument(parser);
+                parser.require(XmlPullParser.START_TAG, null, null);
+                String name = parser.getName();
+                if ( name.equalsIgnoreCase(attributeName) ) {
+                    pair.label = this.nextText(parser);
+                } else if ( name.equalsIgnoreCase(VALUEITEM_VALUE_TAG) ) {
+                    pair.value = this.nextText(parser);
+                } else {
+                    break;
+                }
+                parser.require(XmlPullParser.END_TAG, null, name);
+                parser.nextTag();
+            }
+            parser.require(XmlPullParser.END_TAG, null, VALUEITEM_TAG);
+        } else {
+            parser.require(XmlPullParser.START_TAG, null, VALUEITEM_VALUE_TAG);
+            for ( int i = 0; i < parser.getAttributeCount(); i++ ) {
+                String name = parser.getAttributeName(i);
+                if ( name.equalsIgnoreCase(attributeName) ) {
+                    pair.label = parser.getAttributeValue(i);
+                } else if ( name.equalsIgnoreCase(VALUEITEM_VALUE_TAG) ) {
+                    pair.value = this.getAttributeValue(parser, i);
+                } else {
+                    throw new UnexpectedTagOrAttributeException(parser, name);
+                }
+            }
+            if ( pair.value == null ) {
+                pair.value = parser.nextText();
+            } else {
+                pair.value += parser.nextText();
+            }
+            parser.require(XmlPullParser.END_TAG, null, VALUEITEM_VALUE_TAG);
+        }
+        return pair;
+    }
+
+    private void checkEndDocument(XmlPullParser parser)
+            throws XmlPullParserException {
+        if ( parser.getEventType() == XmlPullParser.END_DOCUMENT ) {
+            throw new UnexpectedTagOrAttributeException(parser,
+                    "(end-of-document)");
+        }
+
+    }
+
+    public static abstract class ImportDynClassesException extends
+            BaseRuntimeException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 3346283395112730192L;
+
+        /**
+         * Don't call this constructor form subclasses.
+         *
+         * @param parser
+         */
+        public ImportDynClassesException(XmlPullParser parser) {
+            super(
+                    "Error importing classes from file at line %(line) column %(column).",
+                    "_Error_importing_classes_from_file_at_line_XlineX_column_XcolumnX",
+                    serialVersionUID);
+        }
+
+        protected ImportDynClassesException(XmlPullParser parser, String msg,
+                String key, long code) {
+            super(
+                    "Error importing classes from file at line %(line) column %(column). "
+                    + msg, key, code);
+            this.setValue("line", new Integer(parser.getLineNumber()));
+            this.setValue("column", new Integer(parser.getColumnNumber()));
+        }
+    }
+
+    public static class DuplicateDynClassException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 3653024321140806121L;
+
+        public DuplicateDynClassException(XmlPullParser parser, String name) {
+            super(parser, "Duplicate DynClass definition for '%(name)'.",
+                    "_Duplicate_DynClass_definition_for_XnameX",
+                    serialVersionUID);
+            this.setValue("name", name);
+        }
+    }
+
+    public static class InvalidFieldTypeException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 8501343258053356775L;
+
+        public InvalidFieldTypeException(XmlPullParser parser, String value) {
+            super(parser, "Invalid field type '%(value)'.",
+                    "_Invalid_field_type_XvalueX", serialVersionUID);
+            this.setValue("value", value);
+        }
+    }
+
+    public static class UnexpectedTagOrAttributeException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = -808282903423455613L;
+
+        public UnexpectedTagOrAttributeException(XmlPullParser parser,
+                String tag) {
+            super(parser, "Unexpected tag or attribute '%(tag)'.",
+                    "_Unexpected_tag_or_attribute_XtagX", serialVersionUID);
+            this.setValue("tag", tag);
+        }
+    }
+
+    public static class NeedTagOrAttributeException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = -808282903423455613L;
+
+        public NeedTagOrAttributeException(XmlPullParser parser, String tag) {
+            super(parser, "Need tag or attribute '%(tag)'.",
+                    "_Need_tag_or_attribute_XtagX", serialVersionUID);
+            this.setValue("tag", tag);
+        }
+    }
+
+    public static class CantLocateClassException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 5733585544096433612L;
+
+        public CantLocateClassException(XmlPullParser parser, String tagname) {
+            super(parser, "Can't locate class named in attribute '%(name)'.",
+                    "_Cant_locate_class_XnameX", serialVersionUID);
+            this.setValue("name", tagname);
+        }
+
+        public CantLocateClassException(XmlPullParser parser, String tagname,
+                String className) {
+            super(parser, "Can't locate class named in attribute '%(name)' "
+                    + "whose name is '%(className)'.", "_Cant_locate_class_XnameX",
+                    serialVersionUID);
+            this.setValue("name", tagname);
+            this.setValue("className", className);
+        }
+    }
+
+    public static class CantLocateDynClassException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 6286170415562358806L;
+
+        public CantLocateDynClassException(XmlPullParser parser, String tagname) {
+            super(parser,
+                    "Can't locate DynClass '%(name). Look at the extends tag.",
+                    "_Cant_locate_DynClass_XnameX", serialVersionUID);
+            this.setValue("name", tagname);
+        }
+    }
+
+    public static class IncompatibleAttributeValueException extends
+            ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 2646530094487375049L;
+
+        public IncompatibleAttributeValueException(XmlPullParser parser,
+                String name) {
+            super(parser, "Incompatible attribute value for field '%(name)'.",
+                    "_Incompatible_attribute_value_for_field_XnameX",
+                    serialVersionUID);
+            this.setValue("name", name);
+        }
+
+        public IncompatibleAttributeValueException(XmlPullParser parser,
+                String name, String value) {
+            super(
+                    parser,
+                    "Incompatible attribute value '%(value)', for field '%(name)'.",
+                    "_Incompatible_attribute_value_for_field_XnameX",
+                    serialVersionUID);
+            this.setValue("name", name);
+            this.setValue("value", value);
+        }
+    }
+
+    public static class ParseCoerceException extends ImportDynClassesException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 1447718822981628834L;
+
+        public ParseCoerceException(Throwable cause, XmlPullParser parser) {
+            super(parser, "Can't convert value.", "_Cant_convert_value",
+                    serialVersionUID);
+            this.initCause(cause);
+        }
+    }
+
+    public static class WrongVersionException extends ImportDynClassesException {
+
+        private static final long serialVersionUID = 6620589308398698367L;
+
+        public WrongVersionException(XmlPullParser parser) {
+            super(parser, "Wrong format version.", "_Wrong_format_version",
+                    serialVersionUID);
+        }
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportHelper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectPagingHelper.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectPagingHelper.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectPagingHelper.java	(revision 1235)
@@ -0,0 +1,211 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectPagingHelper;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.paging.DefaultPagingCalculator;
+import org.gvsig.tools.paging.PagingCalculator;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Default {@link DynObjectPagingHelper} implementation.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultDynObjectPagingHelper extends AbstractDisposable implements
+    DynObjectPagingHelper {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultDynObjectPagingHelper.class);
+
+    private DynObjectSet set;
+    private DynObject[] values;
+    private PagingCalculator calculator;
+
+    public DefaultDynObjectPagingHelper() {
+        // Nothing to do
+    }
+
+    public DefaultDynObjectPagingHelper(DynObjectSet set) throws BaseException {
+        this(set, DEFAULT_PAGE_SIZE);
+    }
+
+    public DefaultDynObjectPagingHelper(DynObjectSet set, int pageSize)
+        throws BaseException {
+        setDynObjectSet(set, pageSize);
+    }
+
+    protected void setDynObjectSet(final DynObjectSet set, int pageSize)
+        throws BaseException {
+        this.set = set;
+        setDefaultCalculator(new Sizeable() {
+
+            public long getSize() {
+                try {
+                    return set.getSize();
+                } catch (BaseException e) {
+                    LOG.error("Error getting the size of the DynObjectSet: "
+                        + set, e);
+                    return 0l;
+                }
+            }
+        }, pageSize);
+    }
+
+    public DynObject getDynObjectAt(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 values[(int) positionForIndex];
+    }
+
+    public DynObject[] getCurrentPageDynObjects() {
+        return values;
+    }
+
+    public DynObjectSet getDynObjectSet() {
+        return set;
+    }
+
+    public void reloadCurrentPage() throws BaseException {
+        if (getCurrentPage() > -1) {
+            loadCurrentPageData();
+        }
+    }
+
+    protected void loadCurrentPageData() throws BaseException {
+        final int currentPageSize = getCurrentPageSize();
+        final DynObject[] values = new DynObject[currentPageSize];
+
+        long t1 = 0;
+        if (LOG.isTraceEnabled()) {
+            t1 = System.currentTimeMillis();
+        }
+
+        long initialIndex = getInitialIndex();
+        final int pageSize = getCurrentPageSize();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Loading {} DynObjects starting at position {}",
+                new Integer(pageSize), new Long(initialIndex));
+        }
+
+        set.accept(new Visitor() {
+
+            private int i = 0;
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                if (i >= pageSize) {
+                    throw new VisitCanceledException();
+                }
+                values[i] = (DynObject) obj;
+                i++;
+            }
+        }, initialIndex);
+
+        if (LOG.isTraceEnabled()) {
+            long t2 = System.currentTimeMillis();
+            LOG.trace("Time to load {} DynObjects: {} ms", new Integer(
+                currentPageSize), new Long(t2 - t1));
+        }
+
+        this.values = values;
+    }
+
+    public void reload() throws BaseException {
+        reloadCurrentPage();
+    }
+
+    protected void doDispose() throws BaseException {
+        set.dispose();
+    }
+
+    protected PagingCalculator getCalculator() {
+        return calculator;
+    }
+
+    protected void setCalculator(PagingCalculator calculator)
+        throws BaseException {
+        this.calculator = calculator;
+        loadCurrentPageData();
+    }
+
+    protected void setDefaultCalculator(Sizeable sizeable, int pageSize)
+        throws BaseException {
+        setCalculator(new DefaultPagingCalculator(sizeable, pageSize));
+    }
+
+    public int getMaxPageSize() {
+        return calculator == null ? DEFAULT_PAGE_SIZE : calculator
+            .getMaxPageSize();
+    }
+
+    public void setMaxPageSize(int pageSize) throws BaseException {
+        calculator.setMaxPageSize(pageSize);
+        reloadCurrentPage();
+    }
+
+    public long getCurrentPage() {
+        return calculator.getCurrentPage();
+    }
+
+    public void setCurrentPage(long page) throws BaseException {
+        calculator.setCurrentPage(page);
+        loadCurrentPageData();
+    }
+
+    public long getInitialIndex() {
+        return calculator.getInitialIndex();
+    }
+
+    public long getNumPages() {
+        return calculator.getNumPages();
+    }
+
+    public long getTotalSize() {
+        return calculator.getTotalSize();
+    }
+
+    public int getCurrentPageSize() {
+        return calculator.getCurrentPageSize();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportExportTags.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportExportTags.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassImportExportTags.java	(revision 1235)
@@ -0,0 +1,48 @@
+
+package org.gvsig.tools.dynobject.impl;
+
+
+public interface DynClassImportExportTags {
+    public String VERSION_VALUE = "1.0.0";
+
+    public String DEFINITIONS_TAG = "definitions";
+    public String VERSION_TAG = "version";
+    public String CLASSES_TAG = "classes";
+
+    public String CLASS_TAG = "class";
+    public String CLASS_NAME_TAG = "name";
+    public String CLASS_NAMESPACE_TAG = "namespace";
+    public String CLASS_DESCRIPTION_TAG = "description";
+    public String CLASS_SUPERCLASSNAMES_TAG = "superClassNames";
+    public String CLASS_SUPERCLASSNAME_TAG = "superClassName";
+    public String CLASS_EXTENDS_TAG = "extends";
+    public String CLASS_EXTENDS_CLASS_TAG = "class";
+    public String CLASS_FIELDS_TAG = "fields";
+
+    public String FIELD_TAG = "field";
+    public String FIELD_NAME_TAG = "name";
+    public String FIELD_DESCRIPTION_TAG = "description";
+    public String FIELD_SUBTYPE_TAG = "subtype";
+    public String FIELD_TYPE_TAG = "type";
+    public String FIELD_ISMANDATORY_TAG = "mandatory";
+    public String FIELD_ISPERSISTENT_TAG = "persistent";
+    public String FIELD_MINVALUE_TAG = "minValue";
+    public String FIELD_MAXVALUE_TAG = "maxValue";
+
+    public String FIELD_CLASSOFVALUE_TAG = "classOfValue";
+    public String FIELD_CLASSOFITEMS_TAG = "classOfItems";
+    public String FIELD_TYPEOFITEMS_TAG = "typeOfItems";
+
+    public String FIELD_DEFAULTVALUE_TAG = "defaultValue";
+    public String FIELD_AVALILABLEVALUES_TAG = "availableValues";
+    public String FIELD_GROUP_TAG = "group";
+    public String FIELD_ORDER_TAG = "order";
+    public String FIELD_HIDDEN_TAG = "hidden";
+    public String FIELD_LABEL_TAG = "label";
+    public String FIELD_TAGS_TAG = "tags";
+    public String VALUEITEM_TAGNAME_TAG = "name";
+
+    public String VALUEITEM_TAG = "valueItem";
+    public String VALUEITEM_LABEL_TAG = "label";
+    public String VALUEITEM_VALUE_TAG = "value";
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/ValueType.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/ValueType.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/ValueType.java	(revision 1235)
@@ -0,0 +1,135 @@
+package org.gvsig.tools.dynobject.impl;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+
+public class ValueType {
+
+    DataType type;
+    Class theClass;
+    DynStruct theDynClass;
+
+    public ValueType(int type) {
+        this.setType(type);
+    }
+
+    public void setType(int type) {
+        if ( type == DataTypes.UNKNOWN ) {
+            this.type = null;
+        } else {
+            DataType t = ToolsLocator.getDataTypesManager().get(type);
+            setType(t);
+        }
+    }
+
+    public void setType(DataType type) {
+        if ( this.theDynClass != null ) {
+            if ( type.getType() == DataTypes.DYNOBJECT ) {
+                this.type = type;
+            } else if ( type.getType() == DataTypes.UNKNOWN ) {
+                this.type = ToolsLocator.getDataTypesManager().get(DataTypes.DYNOBJECT);
+            } else {
+                throw new IllegalArgumentException("Can't set type to non DYNOBJECT when have a dynclass assigned.");
+            }
+        } else {
+            this.type = type;
+            if( this.theClass==null ) {
+                this.theClass = this.type.getDefaultClass();
+            }
+        }
+    }
+
+    public String getSubtype() {
+        if ( this.type == null ) {
+            return null;
+        }
+        return this.type.getSubtype();
+    }
+
+    public int getType() {
+        if( this.type == null ) {
+            return DataTypes.UNKNOWN;
+        }
+        return type.getType();
+    }
+
+    public DataType getDataType() {
+        return type;
+    }
+
+    public void setClassOfValue(Class theClass) {
+        if ( this.type == null || type.getType() == DataTypes.UNKNOWN ) {
+            this.type = ToolsLocator.getDataTypesManager().get(DataTypes.OBJECT);
+        }
+        if ( type.getType() == DataTypes.DYNOBJECT && theClass!=null) {
+            if( !DynObject.class.isAssignableFrom(theClass) ) {                
+                throw new IllegalArgumentException("Can't assign a Class '"+theClass.getName()+"' when type is '"+type.getName()+"'.");
+            }
+        }
+        this.theClass = theClass;
+    }
+
+    public void setClassOfValue(DynStruct dynStrct) {
+        if ( this.type == null || type.getType() == DataTypes.UNKNOWN ) {
+            this.type = ToolsLocator.getDataTypesManager().get(DataTypes.DYNOBJECT);
+        }
+        if ( type.getType() != DataTypes.DYNOBJECT && dynStrct!=null) {
+            throw new IllegalArgumentException("Can't assign a DynClass '"+dynStrct.getFullName()+"' when type is '"+type.getName()+"'.");
+        }
+        this.theDynClass = dynStrct;
+    }
+
+    public void setClassOfValue(String theClassNameOfValue) {
+        if ( this.type == null ) {
+            throw new IllegalStateException("Need to set type before assign classOfValue by name");
+        }
+        if ( type.getType() == DataTypes.DYNOBJECT ) {
+            this.theDynClass = (DynStruct) ToolsLocator.getDynObjectManager().createDynClassName(theClassNameOfValue);
+            if ( this.theDynClass == null ) {
+                throw new IllegalArgumentException("DynClass of type '" + theClassNameOfValue + "' not found.");
+            }
+        } else {
+            try {
+                Class theClass = Class.forName(theClassNameOfValue);
+                this.theClass = theClass;
+            } catch (ClassNotFoundException ex) {
+                throw new IllegalArgumentException("The class '" + theClassNameOfValue + "' not exists.");
+            }
+        }
+    }
+
+    public String getClassNameOfValue() {
+        if ( type == null ) {
+            return null;
+        }
+        if ( type.getType() == DataTypes.DYNOBJECT ) {
+            if ( this.theDynClass == null ) {
+                return null;
+            }
+            return this.theDynClass.getFullName();
+        }
+        if ( this.theClass == null ) {
+            return null;
+        }
+        return this.theClass.getName();
+    }
+
+    public DynStruct getDynClassOfValue() {
+        return this.theDynClass;
+    }
+
+    public Class getClassOfValue() {
+        return this.theClass;
+    }
+
+    public String toString() {
+        if ( this.type == null ) {
+            return "(null)";
+        }
+        return this.type.toString();
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObjectManager.java	(revision 1235)
@@ -0,0 +1,733 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynClassName;
+import org.gvsig.tools.dynobject.DynField_LabelAttribute;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynObjectPagingHelper;
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DuplicateDynClassException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodIllegalCodeException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.dynobject.exception.IllegalDynMethodException;
+import org.gvsig.tools.dynobject.exception.IllegalDynMethodInvocationException;
+import org.gvsig.tools.exception.BaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+/**
+ * Default {@link DynObjectManager} implementation.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultDynObjectManager implements DynObjectManager {
+
+    private final static Logger LOG = LoggerFactory
+        .getLogger(DefaultDynObjectManager.class);
+
+    private static DefaultDynObjectManager manager = null;
+
+    private class MethodInfo {
+
+        int code;
+        DynClass dynClass;
+        DynMethod dynMethod;
+        Class theClass;
+
+        MethodInfo(Class theClass, DynClass dynClass, DynMethod dynMethod,
+            int code) {
+            this.code = code;
+            this.dynClass = dynClass;
+            this.dynMethod = dynMethod;
+            this.theClass = theClass;
+        }
+
+        String getKey() {
+            return DefaultDynObjectManager
+                .getKey(theClass, dynClass, dynMethod);
+        }
+
+        void check(Class theClass, int code) throws DynMethodException {
+            if (code != this.code) {
+                throw new DynMethodIllegalCodeException(dynMethod.getName(),
+                    this.code, code);
+            }
+            if (theClass != null) {
+                if (this.theClass == null) {
+                    throw new IllegalDynMethodInvocationException(
+                        dynMethod.getName(), theClass);
+                }
+                if (!this.theClass.isAssignableFrom(theClass)) {
+                    throw new IllegalDynMethodInvocationException(
+                        dynMethod.getName(), theClass);
+                }
+            }
+        }
+
+        void check(DynClass dynClass, int code) throws DynMethodException {
+            if (code != this.code) {
+                throw new DynMethodIllegalCodeException(dynMethod.getName(),
+                    this.code, code);
+            }
+            if (dynClass != null) {
+                if (this.dynClass == null) {
+                    throw new IllegalDynMethodInvocationException(
+                        dynMethod.getName(), dynClass);
+                }
+                if (dynClass != this.dynClass
+                    || !dynClass.getName().equalsIgnoreCase(
+                        this.dynClass.getName())) {
+                    throw new IllegalDynMethodInvocationException(
+                        dynMethod.getName(), dynClass);
+                }
+            }
+        }
+    }
+
+    private class ClassesNamespaces {
+
+        private Map defaultNamespace;
+        private Map namespaces;
+
+        ClassesNamespaces() {
+            this.namespaces = new HashMap();
+            this.defaultNamespace = new HashMap();
+        }
+
+        public Map addNamespace(String name) {
+            Map namespace = new HashMap();
+            this.namespaces.put(name.toLowerCase(), namespace);
+            return namespace;
+        }
+
+        public Map getNamespace(String name) {
+            return (Map) this.namespaces.get(name.toLowerCase());
+        }
+
+//        public void clear() {
+//            this.defaultNamespace.clear();
+//            this.namespaces.clear();
+//        }
+
+        public boolean containsClass(String name) {
+            name = name.toLowerCase();
+            if (this.defaultNamespace.containsKey(name)) {
+                return true;
+            }
+
+            Iterator it = this.namespaces.values().iterator();
+            while (it.hasNext()) {
+                Map names = (Map) it.next();
+                if (names.containsKey(name)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public boolean containsClass(String namespace, String name) {
+            name = name.toLowerCase();
+            if (namespace == null) {
+                return this.defaultNamespace.containsKey(name);
+            }
+            Map space = this.getNamespace(namespace);
+            if (space == null) {
+                return false;
+            }
+            return space.containsKey(name);
+        }
+
+//        public boolean containsClass(DynClass dynClass) {
+//            if (this.defaultNamespace.containsValue(dynClass)) {
+//                return true;
+//            }
+//
+//            Iterator it = this.namespaces.values().iterator();
+//            while (it.hasNext()) {
+//                Map names = (Map) it.next();
+//                if (names.containsValue(dynClass)) {
+//                    return true;
+//                }
+//            }
+//            return false;
+//        }
+
+        public DynClass get(String name, String namespace) {
+            if (namespace == null) {
+                return (DynClass) this.defaultNamespace.get(name.toLowerCase());
+            }
+            Map space = this.getNamespace(namespace);
+            if (space == null) {
+                return null;
+            }
+            DynClassName className = new DefaultDynClassName(name);
+            if (className.getNamespace()==null){
+                return (DynClass) space.get(name.toLowerCase());
+            }
+            if (!namespace.equalsIgnoreCase(className.getNamespace())){
+            	return null;
+            }
+            return (DynClass) space.get(className.getName().toLowerCase());
+        }
+
+        public Set keySet() {
+            Set keyset = new HashSet();
+            Iterator it = this.iterator();
+            while (it.hasNext()) {
+                DynClass dynClass = (DynClass) it.next();
+                keyset.add(dynClass.getFullName());
+            }
+            return keyset;
+        }
+
+        public Iterator iterator() {
+            final class MyIterator implements Iterator {
+
+                Iterator current;
+                Iterator others;
+
+                MyIterator(Iterator main, Iterator others) {
+                    this.current = main;
+                    this.others = others;
+                }
+
+                public boolean hasNext() {
+                    if (this.current.hasNext()) {
+                        return true;
+                    }
+                    while (this.others.hasNext()) { 
+                        Object obj = others.next();
+                        this.current = (Iterator) ((HashMap) obj).values().iterator();
+                        if (this.current.hasNext()) {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                public Object next() {
+                    if (this.current.hasNext()) {
+                        return this.current.next();
+                    }
+                    while (this.others.hasNext()) {
+                        Object obj = others.next();
+                        this.current = (Iterator) ((HashMap) obj).values().iterator();
+                        if (this.current.hasNext()) {
+                            return this.current.next();
+                        }
+                    }
+                    return null;
+                }
+
+                public void remove() {
+                    throw new UnsupportedOperationException();
+                }
+            }
+
+            return new MyIterator(this.defaultNamespace.values().iterator(),
+                this.namespaces.values().iterator());
+        }
+
+        public Object add(DynStruct dynClass) {
+            String name = dynClass.getName().toLowerCase();
+            Map namespace;
+            if (dynClass.getNamespace() != null) {
+                namespace = (Map) this.getNamespace(dynClass.getNamespace());
+                if (namespace == null) {
+                    namespace = this.addNamespace(dynClass.getNamespace());
+                }
+            } else {
+                namespace = this.defaultNamespace;
+            }
+            if (namespace.containsKey(name)) {
+                throw new DuplicateDynClassException(dynClass);
+            }
+            return namespace.put(name, dynClass);
+        }
+
+        public void remove(DynStruct dynClass) {
+            String name = dynClass.getName().toLowerCase();
+            Map namespace;
+            if (dynClass.getNamespace() != null) {
+                namespace = (Map) this.getNamespace(dynClass.getNamespace());
+                if (namespace == null) {
+                    namespace = this.addNamespace(dynClass.getNamespace());
+                }
+            } else {
+                namespace = this.defaultNamespace;
+            }
+            if (namespace.containsKey(name)) {
+                namespace.remove(name);
+            }
+        }
+
+        public int size() {
+            int count = this.defaultNamespace.size();
+
+            Iterator it = this.namespaces.values().iterator();
+            while (it.hasNext()) {
+                Map names = (Map) it.next();
+                count += names.size();
+            }
+            return count;
+        }
+
+    }
+
+    private Map anonymousClasses;
+    private ClassesNamespaces classes;
+    private Map methodsMap;
+    private MethodInfo[] methods;
+
+    public static DefaultDynObjectManager getManager() {
+        if (manager == null) {
+            manager = new DefaultDynObjectManager();
+        }
+        return manager;
+    }
+
+    static String getKey(Class theClass, DynClass dynClass, DynMethod dynMethod) {
+        return DefaultDynObjectManager.getKey(theClass, dynClass,
+            dynMethod.getName());
+    }
+
+    static String getKey(Class theClass, DynClass dynClass, String methodName) {
+        if (dynClass == null) {
+            return theClass.getName() + ":" + methodName;
+        } else {
+            return dynClass.getName() + ":" + methodName;
+        }
+    }
+
+    public DefaultDynObjectManager() {
+        this.classes = new ClassesNamespaces();
+        this.anonymousClasses = new HashMap();
+        this.methodsMap = new HashMap();
+        this.methods = null;
+    }
+
+    public DynClass createDynClass(String name, String description) {
+        return new DefaultDynClass(this, name, description);
+    }
+
+    public DynClass createDynClass(String namespace, String name,
+        String description) {
+        return new DefaultDynClass(this, namespace, name, description);
+    }
+
+    public void add(DynClass dynClass) {
+        try {
+            ((DefaultDynClass) dynClass).check();
+        } catch (Exception ex) {
+            throw new DynObjectRuntimeException(ex);
+        }
+        this.classes.add(dynClass);
+        LOG.trace("Add DynClass definition {}.",
+            new Object[] { dynClass.getFullName() });
+
+    }
+
+    public DynClass add(String name, String description) {
+        DynClass dynClass =
+            (DynClass) this.classes.get(name.toLowerCase(), null);
+        if (dynClass == null) {
+            dynClass = this.createDynClass(name, description);
+            this.add(dynClass);
+        }
+        return dynClass;
+    }
+
+    public DynClass add(String name) {
+        return this.add(name, null);
+    }
+
+    public void remove(DynStruct dynClass) {
+        this.classes.remove(dynClass);
+    }
+
+    // public static String getFullName(String namespace, String name) {
+    // if( namespace == null ) {
+    // return name;
+    // }
+    // return namespace + ":" + name;
+    // }
+    // public static String[] splitFullName(String fullname) {
+    // String[] name = new String[] { null, fullname };
+    // int x=fullname.indexOf(':');
+    // if( x>-1 ) {
+    // name[0] = fullname.substring(0, x);
+    // name[1] = fullname.substring(x+1);
+    // }
+    // return name;
+    //
+    // }
+
+    public DynClass get(String theName) {
+        DynClassName name = createDynClassName(theName);
+        return this.get(name.getNamespace(), name.getName());
+    }
+
+    public DynClass get(String namespace, String name) {
+        return (DynClass) this.classes.get(name, namespace);
+    }
+
+    public DynClass get(DynClass[] superClasses) {
+        StringBuffer name = new StringBuffer();
+        for (int i = 0; i < superClasses.length; i++) {
+            name.append(superClasses[i].getName()).append("+");
+        }
+        DefaultDynClass dynClass =
+            (DefaultDynClass) this.anonymousClasses.get(name.toString());
+        if (dynClass == null) {
+            dynClass =
+                new DefaultDynClass(this, name.toString(), null, superClasses);
+            dynClass.setAnonymous(true);
+        }
+        return dynClass;
+    }
+
+    public int getCount() {
+        return this.classes.size();
+    }
+
+    public List getNames() {
+        String[] names = (String[]) this.classes.keySet().toArray();
+        Arrays.sort(names);
+        return Collections.unmodifiableList(Arrays.asList(names));
+    }
+
+    public boolean has(String name) {
+        return this.classes.containsClass(name);
+    }
+
+    public boolean has(String namespace, String name) {
+        return this.classes.containsClass(namespace, name);
+    }
+
+    public Iterator iterator() {
+        return this.classes.iterator();
+    }
+
+    public DynObject createDynObject(String dynClassName) {
+        DynClassName name = createDynClassName(dynClassName);
+        return this.createDynObject(name.getName(), name.getNamespace());
+    }
+
+    public DynObject createDynObject(String dynClassName, String namespace) {
+
+        DynClass dynClass =
+            (DynClass) this.classes.get(dynClassName, namespace);
+        if (dynClass == null) {
+            throw new IllegalArgumentException("Can't locate class '"
+                + createDynClassName(namespace, dynClassName).getFullName()
+                + "'.");
+        }
+        return this.createDynObject(dynClass);
+    }
+
+    public DynObject createDynObject(DynStruct dynClass) {
+        return new DefaultDynObject(dynClass);
+    }
+
+    public void consolide() {
+        Iterator it = this.classes.iterator();
+        while (it.hasNext()) {
+            DefaultDynClass dc = (DefaultDynClass) it.next();
+            dc.consolide();
+        }
+        it = this.anonymousClasses.values().iterator();
+        while (it.hasNext()) {
+            DefaultDynClass dc = (DefaultDynClass) it.next();
+            dc.consolide();
+        }
+    }
+
+    public int registerDynMethod(DynClass dynClass, DynMethod dynMethod) {
+        ((DefaultDynClass) dynClass).addMethod(dynMethod);
+        return registerDynMethod(null, dynClass, dynMethod);
+    }
+
+    public int registerDynMethod(Class theClass, DynMethod dynMethod) {
+        return registerDynMethod(theClass, null, dynMethod);
+    }
+
+    int registerDynMethod(Class theClass, DynClass dynClass, DynMethod dynMethod) {
+        MethodInfo info = new MethodInfo(theClass, dynClass, dynMethod, 0);
+        MethodInfo oldInfo = (MethodInfo) methodsMap.get(info.getKey());
+        if (oldInfo != null) {
+            // Update the method info
+            oldInfo.dynClass = dynClass;
+            oldInfo.dynMethod = dynMethod;
+            return oldInfo.code;
+        }
+        if (methods == null) {
+            methods = new MethodInfo[1];
+            info.code = 0;
+        } else {
+            MethodInfo[] temp1 = new MethodInfo[methods.length + 1];
+            System.arraycopy(methods, 0, temp1, 0, methods.length);
+            info.code = temp1.length - 1;
+            methods = temp1;
+        }
+        methods[info.code] = info;
+        methodsMap.put(info.getKey(), info);
+
+        return info.code;
+    }
+
+    public Object invokeDynMethod(Object self, int code, DynObject context)
+        throws DynMethodException {
+
+        try {
+            /*
+             * Intentamos ejecutar la operacion, y si peta ya haremos las
+             * comprobaciones oportunas para lanzar la excepcion que toque.
+             * 
+             * Asi evitamos codigo de comprobacion para los casos que valla bien
+             * que deberian ser la mayoria.
+             */
+            return methods[code].dynMethod.invoke(self, context);
+        } catch (RuntimeException e) {
+            getDynMethod(self, code);
+            throw e;
+        } catch (DynMethodException e) {
+            getDynMethod(self, code);
+            throw e;
+        }
+
+    }
+
+    public int getDynMethodCode(DynClass dynClass, String methodName)
+        throws DynMethodException {
+        String key = DefaultDynObjectManager.getKey(null, dynClass, methodName);
+        MethodInfo info = (MethodInfo) methodsMap.get(key);
+        if (info == null) {
+            throw new IllegalDynMethodException(methodName, dynClass);
+        }
+        info.check(dynClass, info.code);
+        return info.code;
+    }
+
+    public int getDynMethodCode(Class theClass, String methodName)
+        throws DynMethodException {
+        String key = DefaultDynObjectManager.getKey(theClass, null, methodName);
+        MethodInfo info = (MethodInfo) methodsMap.get(key);
+        if (info == null) {
+            throw new IllegalDynMethodException(methodName, theClass);
+        }
+        info.check(theClass, info.code);
+        return info.code;
+    }
+
+    public DynMethod getDynMethod(int code) throws DynMethodException {
+        if (code >= methods.length) {
+            throw new DynMethodNotSupportedException(code, "{null}");
+        }
+        MethodInfo info = methods[code];
+        info.check((Class) null, code);
+        return info.dynMethod;
+    }
+
+    public DynMethod getDynMethod(Object obj, int code)
+        throws DynMethodException {
+        return getDynMethod(obj.getClass(), code);
+    }
+
+    public DynMethod getDynMethod(Class theClass, int code)
+        throws DynMethodException {
+        if (code >= methods.length) {
+            throw new DynMethodNotSupportedException(code, theClass.getName());
+        }
+        MethodInfo info = methods[code];
+        info.check(theClass, code);
+        return info.dynMethod;
+    }
+
+    public DynMethod getDynMethod(DynClass dynClass, int code)
+        throws DynMethodException {
+        if (code >= methods.length) {
+            throw new DynMethodNotSupportedException(code, dynClass.getName());
+        }
+        MethodInfo info = methods[code];
+        info.check(dynClass, code);
+        return info.dynMethod;
+    }
+
+    public DynMethod getDynMethod(DynObject dynObject, int code)
+        throws DynMethodException {
+        return getDynMethod(dynObject.getDynClass(), code);
+    }
+
+    public void validate(DynObject object) {
+        // TODO
+        return;
+    }
+
+    public Class getDefaultClassOfType(int type) {
+        return ToolsLocator.getDataTypesManager().getDefaultClass(type);
+    }
+
+    public String exportSimpleDynClassDefinitions(DynClass dynClass) {
+        DynClassExportHelper exporter = new DynClassExportHelper();
+        return exporter.exportSimpleDefinition(dynClass);
+    }
+    
+    public void exportSimpleDynClassDefinitions(File out, DynClass dynClass) throws FileNotFoundException {
+        DynClassExportHelper exporter = new DynClassExportHelper();
+        exporter.exportSimpleDefinition(out, dynClass);
+    }
+    
+    public void exportSimpleDynClassDefinitions(OutputStream out, DynClass dynClass) {
+        DynClassExportHelper exporter = new DynClassExportHelper();
+        exporter.exportSimpleDefinition(out, dynClass);
+    }
+    
+    public Map importDynClassDefinitions(InputStream resource,
+        ClassLoader loader) throws XmlPullParserException, IOException {
+        return new DynClassImportHelper().importDefinitions(resource, loader,
+            null);
+    }
+
+    public Map importDynClassDefinitions(XmlPullParser parser,
+        ClassLoader loader, String defaultNamespace)
+        throws XmlPullParserException, IOException {
+        return new DynClassImportHelper().importDefinitions(parser, loader,
+            defaultNamespace);
+    }
+
+    public Map importDynClassDefinitions(InputStream resource,
+        ClassLoader loader, String defaultNamespace)
+        throws XmlPullParserException, IOException {
+        return new DynClassImportHelper().importDefinitions(resource, loader,
+            defaultNamespace);
+    }
+
+    public DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set)
+        throws BaseException {
+        return new DefaultDynObjectPagingHelper(set); 
+    }
+
+    public DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set,
+        int pageSize) throws BaseException {
+        return new DefaultDynObjectPagingHelper(set, pageSize);
+    }
+
+    public DynClassName createDynClassName(String namespace, String name) {
+        return new DefaultDynClassName(namespace, name);
+    }
+
+    public DynClassName createDynClassName(String name) {
+        return new DefaultDynClassName(name);
+    }
+
+    public Iterator iterator(String nameSpace) {
+        return iterator(nameSpace, false);
+    }
+
+    private Iterator iterator(String nameSpace, boolean exactMatchingRequired) {
+
+        List list = new ArrayList();
+        Iterator it = this.classes.iterator();
+
+        if (nameSpace == null) {
+            nameSpace = "";
+        }
+
+        while( it.hasNext() ) {
+            
+            Object obj = it.next();
+            DynStruct dynStruct = (DynStruct) obj;
+            String dynNameSpace = dynStruct.getNamespace();
+            if ((dynNameSpace == null) || (dynNameSpace.equals(""))) {
+                dynNameSpace = null;
+            } else {
+                dynNameSpace = dynNameSpace.toLowerCase();
+            }
+            nameSpace = nameSpace.toLowerCase();
+            if (exactMatchingRequired) {
+                if (nameSpace.equalsIgnoreCase(dynNameSpace)) {
+                    list.add(dynStruct);
+                }
+            } else {
+                if ((dynNameSpace != null)
+                    && (nameSpace.indexOf(dynNameSpace) > -1)) {
+                    list.add(dynStruct);
+                }
+            }
+        }
+        return list.iterator();
+    }
+
+    public Object getAttributeValue(Object obj, String name) {
+        if( "label".equalsIgnoreCase(name) ) {
+            if( obj instanceof DynField_LabelAttribute ) {
+                return ((DynField_LabelAttribute)obj).getLabel();
+            }
+    	} else if( "StructWhenTypeIsDynObject".equalsIgnoreCase(name) ) {
+            if( obj instanceof DynField_v2 ) {
+                return ((DynField_v2)obj).getDynClassOfValue();
+            }
+    	}
+    	return null;
+    }
+
+    public void setAttributeValue(Object obj, String name, Object value) {
+        if( "label".equalsIgnoreCase(name) ) {
+            if( obj instanceof DynField_LabelAttribute ) {
+                ((DynField_LabelAttribute)obj).setLabel((String) value);
+            }
+    	} else if( "StructWhenTypeIsDynObject".equalsIgnoreCase(name) ) {
+            if( obj instanceof DynField_v2 ) {
+                ((DynField_v2)obj).setClassOfValue((DynStruct) value);
+            }
+    	}
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassExportHelper.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassExportHelper.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DynClassExportHelper.java	(revision 1235)
@@ -0,0 +1,234 @@
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+
+public class DynClassExportHelper implements DynClassImportExportTags {
+
+    private class XMLTag {
+
+        private String tagname;
+        private Map attributes = new LinkedHashMap();
+
+        public XMLTag(String tagname) {
+            this.tagname = tagname;
+        }
+
+        public String getTagname() {
+            return tagname;
+        }
+        
+        public void set(String name, String value) {
+            if( value == null ) {
+                return;
+            }
+            this.attributes.put(name, value);
+        }
+        
+        public void set(String name, int value) {
+            this.attributes.put(name, Integer.toString(value));
+        }
+        
+        public void set(String name, Object value) {
+            if( value == null ) {
+                return;
+            }
+            this.attributes.put(name, value.toString());
+        }
+        
+        public void set(String name, boolean value) {
+            this.attributes.put(name, value? "true":"false");
+        }
+        
+        public String toString() {
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("<");
+            buffer.append(this.tagname);
+            if( this.attributes.size()>0 ) {
+                Iterator entries = this.attributes.entrySet().iterator();
+                while( entries.hasNext() ) {
+                    Map.Entry entry = (Map.Entry) entries.next();
+                    buffer.append(" ");
+                    buffer.append(entry.getKey());
+                    buffer.append("=\"");
+                    buffer.append(entry.getValue());
+                    buffer.append("\"");
+                }
+            }
+            buffer.append(">\n");
+            return buffer.toString();
+        }
+    }
+
+    private class XMLHelper {
+
+        private StringBuffer buffer = null;
+
+        XMLHelper() {
+            this.buffer = new StringBuffer();
+        }
+
+        public XMLHelper append(String tagname) {
+            this.buffer.append(tagname);
+            return this;
+        }
+
+        public XMLHelper append(int indent, String tagname) {
+            this.indent(indent);
+            this.buffer.append("<").append(tagname).append(">\n");
+            return this;
+        }
+
+        public XMLHelper append(int indent, String tagname, String value) {
+            if( value==null ) {
+                value="";
+            }
+            this.indent(indent);
+            buffer.append("<")
+                    .append(tagname)
+                    .append(">")
+                    .append(value)
+                    .append("</")
+                    .append(tagname)
+                    .append(">\n");
+            return this;
+        }
+        
+        public XMLHelper close(int indent, String tagname) {
+            this.indent(indent);
+            this.buffer.append("</").append(tagname).append(">\n");
+            return this;
+        }
+        
+        public XMLHelper close(int indent, XMLTag tag) {
+            this.close(indent, tag.getTagname());
+            return this;
+        }
+
+        public XMLTag createTag(String tagname) {
+            return new XMLTag(tagname);
+        }
+        
+        public XMLHelper append(int indent, XMLTag tag) {
+            this.indent(indent);
+            this.buffer.append(tag.toString());
+            return this;
+        }
+        
+        private void indent(int indent) {
+            if( indent<1 ) {
+                return;
+            }
+            String spaces = "                                                                      ";
+            if( indent*2 > spaces.length() ) {
+                this.buffer.append(spaces);
+            } else {
+                this.buffer.append(spaces.substring(0, indent*2));
+            }
+        }
+
+        @Override
+        public String toString() {
+            return this.buffer.toString();
+        }        
+    }
+
+    public void exportSimpleDefinition(File out, DynClass dynClass) throws FileNotFoundException {
+        FileOutputStream os = new FileOutputStream(out);
+        exportSimpleDefinition(os, dynClass);
+    }
+
+    public void exportSimpleDefinition(OutputStream out, DynClass dynClass) {
+        PrintStream writer = null;
+        try {
+            writer = new PrintStream(out);
+            writer.print( exportSimpleDefinition(dynClass));
+        } finally {
+            writer.close();
+        }
+    }
+    
+    public String exportSimpleDefinition(DynClass dynClass) {
+
+        int indent = 0;
+        XMLHelper buffer = new XMLHelper();
+
+        buffer.append("<?xml version=\"1.0\"?>\n");
+        buffer.append(indent++, DEFINITIONS_TAG);
+        buffer.append(indent, VERSION_TAG, "1.0.0");
+        buffer.append(indent++, CLASSES_TAG);
+
+        XMLTag tag = buffer.createTag(CLASS_TAG);
+        tag.set(CLASS_NAME_TAG, dynClass.getName());
+        buffer.append(indent++, tag);
+        
+        buffer.append(indent++, CLASS_EXTENDS_TAG);
+        DynClass[] superDynClasses = dynClass.getSuperDynClasses();
+        if( superDynClasses!=null ) {
+            for( int i=0; i<superDynClasses.length; i++ ) {
+                DynClass superDynClass = superDynClasses[i];
+                tag = buffer.createTag(CLASS_EXTENDS_CLASS_TAG);
+                tag.set(CLASS_NAMESPACE_TAG, superDynClass.getNamespace());
+                tag.set(CLASS_NAME_TAG, superDynClass.getName());
+                buffer.append(indent, tag);
+            }
+        }
+        buffer.close(--indent, CLASS_EXTENDS_TAG);
+        
+        buffer.append(indent, CLASS_DESCRIPTION_TAG, dynClass.getDescription());
+        
+        buffer.append(indent++, CLASS_FIELDS_TAG);
+        
+        DynField[] fields = dynClass.getDeclaredDynFields();
+        for( int ifields=0; ifields<fields.length; ifields++ ) {
+            DynField field = fields[ifields];
+            tag = buffer.createTag(FIELD_TAG);
+            tag.set(FIELD_NAME_TAG, field.getName());
+            tag.set(FIELD_TYPE_TAG, field.getDataType().getName());
+            tag.set(FIELD_ISMANDATORY_TAG, field.isMandatory());
+            tag.set(FIELD_MINVALUE_TAG, field.getMinValue());
+            tag.set(FIELD_MAXVALUE_TAG, field.getMaxValue());
+            tag.set(FIELD_DEFAULTVALUE_TAG, field.getDefaultValue());
+            tag.set(FIELD_GROUP_TAG, field.getGroup());
+            tag.set(FIELD_ORDER_TAG, field.getOder());
+            tag.set(FIELD_HIDDEN_TAG, field.isHidden());
+
+            buffer.append(indent++, tag);
+            
+            buffer.append(indent,FIELD_DESCRIPTION_TAG, field.getDescription());
+            DynObjectValueItem[] values = field.getAvailableValues();
+            if( values!=null && values.length>0 ) {
+                buffer.append(indent++,FIELD_AVALILABLEVALUES_TAG);
+                for( int ivalues=0; ivalues<values.length; ivalues++ ) {
+                    DynObjectValueItem value = values[ivalues];
+                    tag = buffer.createTag(VALUEITEM_VALUE_TAG);
+                    tag.set(VALUEITEM_LABEL_TAG, value.getLabel());
+                    tag.set(VALUEITEM_VALUE_TAG, value.getValue());
+                    buffer.append(indent, tag);
+                    buffer.close(indent,tag);
+                }
+                buffer.close(++indent,FIELD_AVALILABLEVALUES_TAG);
+            }
+            
+            buffer.close(--indent, FIELD_TAG);
+
+        }
+        
+        buffer.close(--indent, CLASS_FIELDS_TAG);
+        
+        buffer.close(--indent, CLASS_TAG);
+        buffer.close(--indent, CLASSES_TAG);
+        buffer.close(indent, DEFINITIONS_TAG);
+
+        return buffer.toString();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynField.java	(revision 1235)
@@ -0,0 +1,726 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynField_v2;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.Tags;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.dynobject.exception.DynFieldRequiredValueException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.exception.ListBaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultDynField implements DynField_v2 {
+
+    public static final Logger log = LoggerFactory.getLogger(DefaultDynField.class);
+
+    private String name;
+    private String description;
+
+    private ValueType type;
+
+    private String subtype;
+
+    private Object defaultValue;
+
+    private int order;
+    private boolean hidden;
+    private String groupName;
+    private DynObjectValueItem[] availableValues;
+    private Object minValue;
+    private Object maxValue;
+    private boolean mandatory;
+    private boolean persistent;
+    private String label = null;
+
+    private boolean validateElements;
+    private boolean isReadOnly;
+    private Tags tags = new DefaultTags();
+
+    private ValueType itemsType;
+    private boolean validateItems;
+
+//        Para implementacion futura, como minimo para implementar
+//        un copy entre dynobject y saber cuando parar.
+//        Los valores deberan ser algo asi como:
+//        - Composicion, 1:1 o 1:N y se copian.
+//        - Agregacion, 1:N, no se copian
+//        - Colaboracion, 1:1, no se copian
+//        Y solo tendra efecto/sentido cuando el field sea de tipo
+//        DynObject, y tal vez lista de DynObject
+    private int relationType;
+
+    public DefaultDynField(String name, int dataType) {
+        this(name, // field name
+                dataType, // data type
+                null, // default value
+                true, // persistent
+                false // mandatory
+        );
+    }
+
+    protected DefaultDynField(String name, int dataType, Object defaultValue,
+            boolean persistent, boolean mandatory) {
+        DataTypesManager datamanager = ToolsLocator.getDataTypesManager();
+
+        if ( StringUtils.isBlank(name) ) {
+            throw new IllegalArgumentException("name can't be null");
+        }
+        this.name = name;
+        this.type = new ValueType(dataType);
+        this.subtype = this.getSubtype();
+
+        this.defaultValue = defaultValue;
+        this.persistent = persistent;
+        this.mandatory = mandatory;
+        this.validateElements = false;
+        this.groupName = null;
+        this.order = 0;
+        this.hidden = false;
+        this.availableValues = null;
+
+        this.itemsType = new ValueType(DataTypes.UNKNOWN);
+        this.validateItems = false;
+    }
+
+    protected ValueType getValueType() {
+        return type;
+    }
+
+    public void check() throws ListBaseException {
+    }
+
+    public String toString() {
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append("DynField").append("[").append(this.hashCode())
+                .append("]").append("( ").append("name='").append(this.name)
+                .append("', ").append("description='").append(this.description)
+                .append("', ").append("type='").append(this.type)
+                .append("', ").append("subType='").append(this.subtype)
+                .append("', ").append("mandatory='").append(this.isMandatory())
+                .append("', ").append("defaultValue='")
+                .append(this.getDefaultValue()).append("', ")
+                .append("minValue='").append(this.minValue).append("', ")
+                .append("maxValue='").append(this.maxValue).append("', ")
+                .append("persistent='").append(this.isPersistent())
+                .append(" )");
+        return buffer.toString();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public DynField setName(String name) {
+        if ( StringUtils.isBlank(name) ) {
+            throw new IllegalArgumentException("name can't be null");
+        }
+        this.name = name;
+        return this;
+    }
+
+    public DynField setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    public String getDescription() {
+        return (description == null) ? getLabel() : description;
+    }
+
+    public DynField setLabel(String label) {
+        this.label = label;
+        return this;
+    }
+
+    public String getLabel() {
+        return (label == null) ? getName() : label;
+    }
+
+    public DynField setType(int dataType) {
+        this.type.setType(dataType);
+        return this;
+    }
+
+    public DynField setType(DataType dataType) {
+        this.type.setType(dataType);
+        return this;
+    }
+
+    public int getType() {
+        return this.type.getType();
+    }
+
+    public DataType getDataType() {
+        return this.type.getDataType();
+    }
+
+    public DynField setSubtype(String subtype) {
+        this.subtype = subtype;
+        return this;
+    }
+
+    public String getSubtype() {
+        return subtype;
+    }
+
+    public DynField setDefaultDynValue(Object defaultValue) {
+        this.defaultValue = defaultValue;
+        return this;
+    }
+
+    public Object getDefaultValue() {
+        return defaultValue;
+    }
+
+    public DynField setAvailableValues(DynObjectValueItem[] availableValues) {
+        if ( availableValues == null || availableValues.length == 0 ) {
+            this.availableValues = null;
+        } else {
+            this.availableValues = availableValues;
+        }
+        return this;
+    }
+
+    public DynField setAvailableValues(List availableValues) {
+        if ( availableValues == null ) {
+            this.availableValues = null;
+        } else if ( availableValues.isEmpty() ) {
+            this.availableValues = null;
+        } else {
+            this.availableValues = (DynObjectValueItem[]) availableValues
+                    .toArray(new DynObjectValueItem[availableValues.size()]);
+        }
+        return this;
+    }
+
+    public DynObjectValueItem[] getAvailableValues() {
+        return availableValues;
+    }
+
+    public DynField setMinValue(Object minValue) {
+        try {
+            this.minValue = this.coerce(minValue);
+        } catch (CoercionException e) {
+            IllegalArgumentException ex = new IllegalArgumentException(e.getLocalizedMessage());
+            ex.initCause(e);
+            throw ex;
+        }
+        return this;
+    }
+
+    public Object getMinValue() {
+        return minValue;
+    }
+
+    public DynField setMaxValue(Object maxValue) {
+        try {
+            this.maxValue = this.coerce(maxValue);
+        } catch (CoercionException e) {
+            IllegalArgumentException ex = new IllegalArgumentException(e.getLocalizedMessage());
+            ex.initCause(e);
+            throw ex;
+        }
+        return this;
+    }
+
+    public Object getMaxValue() {
+        return maxValue;
+    }
+
+    public boolean isMandatory() {
+        return this.mandatory;
+    }
+
+    public boolean isPersistent() {
+        return this.persistent;
+    }
+
+    public DynField setMandatory(boolean mandatory) {
+        this.mandatory = mandatory;
+        return this;
+    }
+
+    public DynField setPersistent(boolean persistent) {
+        this.persistent = persistent;
+        return this;
+    }
+
+    public DynField setTheTypeOfAvailableValues(int type) {
+        return this; // FIXME: this method is @deprecated
+    }
+
+    public int getTheTypeOfAvailableValues() {
+        return 1; // FIXME: this method is @deprecated
+    }
+
+    public boolean equals(Object obj) {
+        if ( this == obj ) {
+            return true;
+        }
+        if ( obj instanceof DynField ) {
+            // FIXME: No esta claro que esto sea correcto.
+            return name.equals(((DynField) obj).getName());
+        }
+        return false;
+    }
+
+    public Class getClassOfValue() {
+        return this.type.getClassOfValue();
+    }
+
+    public DynField setClassOfValue(Class theClass) {
+        this.type.setClassOfValue(theClass);
+        return this;
+    }
+
+    public DynField setClassOfValue(String theClassName) {
+        this.type.setClassOfValue(theClassName);
+        return this;
+    }
+
+    public boolean isContainer() {
+        if ( type.getDataType() == null ) {
+            return false;
+        }
+        return type.getDataType().isContainer();
+    }
+
+    public void validate(Object value) throws DynFieldValidateException {
+        Comparable v;
+        if ( value == null ) {
+            if ( this.mandatory ) {
+                throw new DynFieldRequiredValueException(this, value);
+            }
+            return;
+        }
+
+        switch (this.type.getType()) {
+        case DataTypes.BOOLEAN:
+            if ( !(value instanceof Boolean) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.DOUBLE:
+            if ( !(value instanceof Double) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.FLOAT:
+            if ( !(value instanceof Float) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.BYTE:
+            if ( !(value instanceof Byte) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.INT:
+            if ( !(value instanceof Integer) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.LONG:
+            if ( !(value instanceof Long) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.STRING:
+            if ( !(value instanceof String) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.CHAR:
+            if ( !(value instanceof String) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            if ( ((String) value).length() > 1 ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.DATE:
+            if ( !(value instanceof Date) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.TIMESTAMP:
+            if ( !(value instanceof Date) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.TIME:
+            if ( !(value instanceof Date) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.FILE:
+            if ( !(value instanceof File) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+        case DataTypes.FOLDER:
+            if ( !(value instanceof File) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+        case DataTypes.URI:
+            if ( !(value instanceof URI) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+        case DataTypes.URL:
+            if ( !(value instanceof URL) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            break;
+
+        case DataTypes.ARRAY:
+            // TODO: falta verificar que es un array del tipo que toca.
+            break;
+
+        case DataTypes.OBJECT:
+            if ( this.type.getClassOfValue() != null ) {
+                if ( !this.type.getClassOfValue().isInstance(value) ) {
+                    throw new DynFieldValidateException(value, this);
+                }
+            }
+            break;
+
+        case DataTypes.MAP:
+            if ( !(value instanceof Map) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            validateCollection(value);
+            break;
+
+        case DataTypes.SET:
+            if ( !(value instanceof Set) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            validateCollection(value);
+            break;
+
+        case DataTypes.LIST:
+            if ( !(value instanceof List) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            validateCollection(value);
+            break;
+
+        case DataTypes.DYNOBJECT:
+            if ( !(value instanceof DynObject) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            if ( !this.getDynClassOfValue().isInstance((DynObject) value) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            try {
+                this.getDynClassOfValue().validate((DynObject) value);
+            } catch (DynObjectValidateException e) {
+                throw new DynFieldValidateException(value, this, e);
+            }
+            break;
+
+        default:
+            if ( this.type.getDataType().isObject() ) {
+                if ( this.type.getClassOfValue() != null ) {
+                    if ( !this.type.getClassOfValue().isInstance(value) ) {
+                        throw new DynFieldValidateException(value, this);
+                    }
+                }
+            }
+        }
+
+        if ( this.getAvailableValues() != null ) {
+            if ( !(value instanceof Comparable) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            v = (Comparable) value;
+            boolean ok = false;
+            for ( int i = 0; i < this.availableValues.length; i++ ) {
+                if ( v.compareTo(this.availableValues[i].getValue()) == 0 ) {
+                    ok = true;
+                    break;
+                }
+            }
+            if ( !ok ) {
+                throw new DynFieldValidateException(value, this);
+            }
+        } else if ( this.getMaxValue() != null && this.getMinValue() != null ) {
+            if ( !(value instanceof Comparable) ) {
+                throw new DynFieldValidateException(value, this);
+            }
+            v = (Comparable) value;
+            if ( v.compareTo(this.minValue) < 0
+                    || v.compareTo(this.maxValue) > 0 ) {
+                throw new DynFieldValidateException(value, this);
+            }
+        }
+    }
+
+    private void validateCollection(Object value) throws ValidateItemException {
+        if ( this.validateItems ) {
+            DynStruct dynClass = this.itemsType.getDynClassOfValue();
+            if ( dynClass != null ) {
+                int index = 0;
+                Iterator it = ((Collection) value).iterator();
+                while ( it.hasNext() ) {
+                    try {
+                        dynClass.validate((DynObject) it.next());
+                        index++;
+                    } catch (DynObjectValidateException ex) {
+                        throw new ValidateItemException(ex, index);
+                    }
+                }
+            }
+        }
+
+    }
+
+    private static class ValidateItemException extends DynFieldValidateException {
+
+        private static final long serialVersionUID = 9011437364983996567L;
+
+        ValidateItemException(Throwable cause, int index) {
+            super(
+                    "Can't validate item %(index) of the collection.",
+                    cause,
+                    "_Cant_validate_item_%(index)_of_the_collection",
+                    serialVersionUID
+            );
+            setValue("index", new Integer(index));
+        }
+    }
+
+    public Object coerce(Object value) throws CoercionException {
+        if ( value == null ) {
+            return value; // O debe devolver this.defaultValue
+        }
+        try {
+            return this.type.getDataType().coerce(value);
+        } catch(Exception ex){
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public String getGroup() {
+        return this.groupName;
+    }
+
+    public DynField setGroup(String groupName) {
+        this.groupName = groupName;
+        return this;
+    }
+
+    public int getOder() {
+        return this.order;
+    }
+
+    public DynField setOrder(int order) {
+        this.order = order;
+        return this;
+    }
+
+    public boolean isHidden() {
+        return this.hidden;
+    }
+
+    public DynField setHidden(boolean hidden) {
+        this.hidden = hidden;
+        return this;
+    }
+
+    public boolean isReadOnly() {
+        return this.isReadOnly;
+    }
+
+    public DynField setReadOnly(boolean isReadOnly) {
+        this.isReadOnly = isReadOnly;
+        return this;
+    }
+
+    public DynField setDefaultFieldValue(Object defaultValue) {
+        try {
+            this.defaultValue = this.coerce(defaultValue);
+        } catch (CoercionException e) {
+            IllegalArgumentException ex = new IllegalArgumentException(e.getLocalizedMessage());
+            ex.initCause(e);
+            throw ex;
+        }
+        return this;
+    }
+
+    public Tags getTags() {
+        return tags;
+    }
+
+    public String getClassNameOfValue() {
+        return this.type.getClassNameOfValue();
+    }
+
+    public DynField setClassOfValue(DynStruct dynStruct) {
+        this.type.setClassOfValue(dynStruct);
+        return this;
+    }
+
+    public DynStruct getDynClassOfValue() {
+        return this.type.getDynClassOfValue();
+    }
+
+    public int getRelationType() {
+        return this.relationType;
+    }
+
+    public DynField setRelationType(int relationType) {
+        this.relationType = relationType;
+        return this;
+    }
+
+    public DynField setElementsType(int type) {
+        this.setTypeOfItems(type);
+        return this;
+    }
+
+    public DynField setElementsType(DynStruct type) {
+        this.setClassOfItems(type);
+        return this;
+    }
+
+    public DynField getElementsType() {
+        throw new UnsupportedOperationException("This operation is not suported nevermore.");
+    }
+
+    public DynField setClassOfItems(DynStruct dynStrct) {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        this.itemsType.setClassOfValue(dynStrct);
+        return this;
+    }
+
+    public DynField setClassOfItems(String theClassNameOfValue) {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        this.itemsType.setClassOfValue(theClassNameOfValue);
+        return this;
+    }
+
+    public String getClassNameOfItems() {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        return this.itemsType.getClassNameOfValue();
+    }
+
+    public DynStruct getDynClassOfItems() {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        return this.itemsType.getDynClassOfValue();
+    }
+
+    public DynField setClassOfItems(Class theClass)
+            throws DynFieldIsNotAContainerException {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        this.itemsType.setClassOfValue(theClass);
+        return this;
+    }
+
+    public Class getClassOfItems() {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        return this.itemsType.getClassOfValue();
+    }
+
+    public DynField setTypeOfItems(int type) {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        this.itemsType.setType(type);
+        return this;
+    }
+
+    public int getTypeOfItems() {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        return this.itemsType.getType();
+    }
+
+    public DynField setValidateElements(boolean validate) {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        this.validateItems = validate;
+        return this;
+    }
+
+    public boolean getValidateElements() {
+        if ( !this.isContainer() ) {
+            throw new IllegalStateException("Can't assign validateElements in non container.");
+        }
+        return this.validateItems;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultTags.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultTags.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultTags.java	(revision 1235)
@@ -0,0 +1,85 @@
+package org.gvsig.tools.dynobject.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.Tags;
+
+public class DefaultTags implements Tags{
+
+	
+	private Map tags = null;
+
+	public Object get(String name) {
+		if(this.tags  == null){
+			return null;
+		}
+		return this.tags.get(name.toLowerCase());
+	}
+	
+	public Object get(String name, int type) throws CoercionException {
+		if(this.tags == null){
+			return null;
+		}
+		DataTypesManager dataman = ToolsLocator.getDataTypesManager();
+		return dataman.coerce(type, this.tags.get(name.toLowerCase()));
+	}
+	
+	public void set(String name, Object value) {
+		if(this.tags == null){
+			this.tags  = new HashMap();
+		}
+		this.tags.put(name.toLowerCase(), value);
+	}
+ 
+	public boolean has(String name) {
+		if(this.tags == null || name == null){
+			return false;
+		}		
+		return this.tags.containsKey(name.toLowerCase());
+	}
+	
+	public int getInt(String name) throws CoercionException {
+		Object x = this.get(name.toLowerCase(),DataTypes.INT);
+		if( x==null ) {
+			return 0;
+		}
+		return ((Integer)x).intValue();
+	}
+	
+	public boolean getBoolean(String name) throws CoercionException {
+		Object x = this.get(name.toLowerCase(),DataTypes.BOOLEAN);
+		if( x==null ) {
+			return false;
+		}
+		return ((Boolean)x).booleanValue();
+	}
+	
+	public Iterator getKeys() {
+		if(this.tags == null){
+			return null;
+		}
+		return this.tags.keySet().iterator();
+	}
+	
+	public Object clone() throws CloneNotSupportedException {
+		DefaultTags newTags = (DefaultTags) super.clone();
+		newTags.add(this);
+		return newTags;
+	}	
+	
+	public void add(Tags tags) {
+		Iterator it = tags.getKeys();
+		if(it != null){
+			while(it.hasNext()){
+				String key = (String) it.next();
+				this.set(key, tags.get(key));
+			}
+		}
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultTags.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClass.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClass.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClass.java	(revision 1235)
@@ -0,0 +1,866 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.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.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynClassName;
+import org.gvsig.tools.dynobject.DynClass_v2;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectException;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.Tags;
+import org.gvsig.tools.dynobject.exception.DynClassNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.exception.ListBaseException;
+
+public class DefaultDynClass implements DynClass_v2{
+
+    public class FieldAndIndex {
+
+        DefaultDynField field;
+        int index;
+
+        FieldAndIndex(DynField field, int index) {
+            this.field = (DefaultDynField) field;
+            this.index = index;
+        }
+
+        public int getIndex() {
+            return this.index;
+        }
+
+        public DefaultDynField getDynField() {
+            return this.field;
+        }
+    }
+
+    public class MethodAndIndex {
+
+        DynMethod method;
+        int index;
+
+        MethodAndIndex(DynMethod method, int index) {
+            this.method = method;
+            this.index = index;
+        }
+
+        public int getIndex() {
+            return this.index;
+        }
+
+        public DynMethod getDynMethod() {
+            return this.method;
+        }
+    }
+
+    
+    DynObjectManager manager;
+
+    private DynClassName name;
+    private String description;
+
+    private boolean isAnonymous;
+
+    private Map classes;
+    private Map declaredFieldsMap;
+    private Map declaredMethodsMap;
+
+    // This attributes are calculated by consolide method
+    private DefaultDynClass[] superClasses;
+    private Map superClassesMap;
+    private DynField[] declaredFields;
+    private Map fieldsMap;
+    private DynField[] fields;
+    private DynMethod[] declaredMethods;
+    private Map methodsMap;
+    private DynMethod[] methods;
+
+    private Tags tags = new DefaultTags();
+    private String label = null;
+    
+    public DefaultDynClass(String name) {
+        this((DynObjectManager)null, (DynClassName)null, (String)null);
+        this.setName( new DefaultDynClassName(name));
+    }
+
+    public DefaultDynClass(DynObjectManager manager, String name,
+        String description) {
+        this(manager, null, name, description);
+    }
+
+    public DefaultDynClass(DynObjectManager manager, String namespace,
+        String name, String description) {
+        this(
+                manager, 
+                manager.createDynClassName(namespace, name), 
+                description
+        );
+    }
+
+    public DefaultDynClass(DynObjectManager manager, DynClassName name,
+        String description) {
+        if( manager == null ) {
+            manager = ToolsLocator.getDynObjectManager();
+        }
+        
+        this.isAnonymous = false;
+        this.classes = new LinkedHashMap();
+        this.declaredFieldsMap = new HashMap();
+        this.declaredMethodsMap = new HashMap();
+
+        this.forceConsolide();  
+
+        this.manager = manager;
+        this.name = name;
+        this.description = description;
+    }
+    
+    public void setName(DynClassName name) {
+        this.name = name;
+    }
+ 
+    public String getName() {
+        return this.name.getName();
+    }
+
+    public String getNamespace() {
+        return this.name.getNamespace();
+    }
+
+    public String getFullName() {
+        return this.name.getFullName();
+    }
+
+    public String toString() {
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append("DynClass").append("[").append(this.hashCode())
+            .append("]").append("( ").append("name='")
+            .append(this.getFullName()).append("', ").append("fields='")
+            .append(this.declaredFieldsMap.toString()).append(" )");
+        return buffer.toString();
+    }
+
+    public DefaultDynClass(DynObjectManager manager, String name,
+        String description, DynClass[] superClases) {
+        this(manager, name, description);
+        for (int i = 0; i < superClases.length; i++) {
+            DynClass dynClass = superClases[i];
+            if (!this.classes.containsKey(dynClass.getFullName())) {
+                this.classes.put(dynClass.getFullName(), dynClass);
+            }
+        }
+    }
+
+    public DynObjectManager getManager() {
+        return this.manager;
+    }
+
+    synchronized public void consolide() {
+        // Use classes and decalredFieldsMap to update all.
+
+        // Updates superClasses array
+        this.superClasses =
+            (DefaultDynClass[]) buildSuperDynClassSet().toArray(
+                new DefaultDynClass[] {});
+
+        // Updates declaredFields array
+        this.declaredFields =
+            (DynField[]) this.declaredFieldsMap.values().toArray(
+                new DynField[] {});
+
+        // Updates declaredMethods array
+        this.declaredMethods =
+            (DynMethod[]) this.declaredMethodsMap.values().toArray(
+                new DynMethod[] {});
+
+        // Updates fieldsMap
+        this.fieldsMap = new LinkedHashMap();
+        int index = 0;
+        for (int i = 0; i < this.declaredFields.length; i++) {
+            this.fieldsMap.put(this.declaredFields[i].getName().toLowerCase(),
+                new FieldAndIndex(this.declaredFields[i], index++));
+        }
+        for (int i = 0; i < this.superClasses.length; i++) {
+            Iterator it =
+                this.superClasses[i].declaredFieldsMap.values().iterator();
+            while (it.hasNext()) {
+                DynField field = (DynField) it.next();
+                if (!this.fieldsMap.containsKey(field.getName().toLowerCase())) {
+                    this.fieldsMap.put(field.getName().toLowerCase(),
+                        new FieldAndIndex(field, index++));
+                }
+            }
+        }
+
+        // Updates methodsMap
+        this.methodsMap = new LinkedHashMap();
+        index = 0;
+        for (int i = 0; i < this.declaredMethods.length; i++) {
+            this.methodsMap.put(this.declaredMethods[i].getName(),
+                new MethodAndIndex(this.declaredMethods[i], index++));
+        }
+        for (int i = 0; i < this.superClasses.length; i++) {
+            Iterator it =
+                this.superClasses[i].declaredMethodsMap.values().iterator();
+            while (it.hasNext()) {
+                DynMethod method = (DynMethod) it.next();
+                if (!this.methodsMap.containsKey(method.getName())) {
+                    this.methodsMap.put(method.getName(), new MethodAndIndex(
+                        method, index++));
+                }
+            }
+        }
+
+        // Updates fields array
+        this.fields = new DynField[this.fieldsMap.size()];
+        int i = 0;
+        Iterator it = this.fieldsMap.values().iterator();
+        while (it.hasNext()) {
+            FieldAndIndex findex = (FieldAndIndex) it.next();
+            DynField field = findex.getDynField();
+            fields[i++] = field;
+        }
+
+        // Updates methods array
+        this.methods = new DynMethod[this.methodsMap.size()];
+        i = 0;
+        it = this.methodsMap.values().iterator();
+        while (it.hasNext()) {
+            MethodAndIndex mindex = (MethodAndIndex) it.next();
+            DynMethod method = mindex.getDynMethod();
+            methods[i++] = method;
+        }
+
+        // Updates superClassesMap
+        this.superClassesMap = new HashMap();
+        for (i = 0; i < this.superClasses.length; i++) {
+            this.superClassesMap.put(this.superClasses[i].getFullName(),
+                this.superClasses[i]);
+        }
+    }
+
+    synchronized private void forceConsolide() {
+        this.superClasses = null;
+        this.superClassesMap = null;
+        this.declaredFields = null;
+        this.fieldsMap = null;
+        this.fields = null;
+        this.declaredMethods = null;
+        this.methodsMap = null;
+        this.methods = null;
+    }
+
+    private Set buildSuperDynClassSet() {
+        Set dynClassParents = new LinkedHashSet();
+        buildSuperDynClassList(this, dynClassParents);
+        return dynClassParents;
+    }
+
+    private void buildSuperDynClassList(DefaultDynClass dynClass, Set allParents) {
+        Collection values = dynClass.classes.values();
+        Iterator it = values.iterator();
+        while (it.hasNext()) {
+            DynClass dc = (DynClass) it.next();
+            allParents.add(dc);
+        }
+        it = values.iterator();
+        while (it.hasNext()) {
+            DefaultDynClass dc = (DefaultDynClass) it.next();
+            buildSuperDynClassList(dc, allParents);
+        }
+    }
+
+    // public Object[] createValues(Object[] oldvalues) {
+    // if (this.fields == null) {
+    // consolide();
+    // }
+    // if (oldvalues != null && oldvalues.length >= this.fields.length) {
+    // return oldvalues;
+    // }
+    // Object[] extended = new Object[this.fields.length];
+    // if (oldvalues != null) {
+    // System.arraycopy(oldvalues, 0, extended, 0, oldvalues.length);
+    // }
+    // return extended;
+    // }
+
+    public Map createValues(Map oldValues) {
+        if (this.fields == null) {
+            consolide();
+        }
+        HashMap extended = new HashMap();
+        if (oldValues != null) {
+            extended.putAll(oldValues);
+        }
+        return extended;
+    }
+
+    public void extendAll(String[] structNames) {
+        if (structNames == null)
+            return;
+
+        for (int i = 0; i < structNames.length; i++) {
+            DynStruct dynStruct = manager.get(structNames[i]);
+            if (dynStruct == null) {
+                throw new DynClassNotFoundException(structNames[i]);
+            }
+            if (this.classes.containsKey(dynStruct.getFullName())) {
+                continue;
+            }
+            this.classes.put(dynStruct.getFullName(), dynStruct);
+        }
+
+        this.forceConsolide();
+    }
+
+    public void extend(DynStruct dynStruct) {
+        if (this.classes.containsKey(dynStruct.getFullName())) {
+            return;
+        }
+        this.classes.put(dynStruct.getFullName(), dynStruct);
+        this.forceConsolide();
+    }
+
+    public void extend(String structName) {
+        DynClass dynClass = manager.get(structName);
+        if (dynClass == null) {
+            throw new DynClassNotFoundException(structName);
+        }
+        extend(dynClass);
+    }
+
+    public void extend(String namespace, String structame) {
+        DynClass dynClass = manager.get(namespace, structame);
+        if (dynClass == null) {
+            throw new DynClassNotFoundException(new DefaultDynClassName(
+                structame).getFullName());
+        }
+        extend(dynClass);
+    }
+
+    public int getFieldIndex(String name) {
+        if (this.fieldsMap == null) {
+            consolide();
+        }
+        FieldAndIndex f =
+            (FieldAndIndex) this.fieldsMap.get(name.toLowerCase());
+        if (f == null) {
+            return -1;
+        }
+        return f.index;
+    }
+
+    public DynField getDeclaredDynField(String name) {
+        return (DynField) this.declaredFieldsMap.get(name.toLowerCase());
+    }
+
+    public DynField[] getDeclaredDynFields() {
+        return this.declaredFields;
+    }
+
+    public String getDescription() {
+        return this.description;
+    }
+
+    public DynField getDynField(String name) {
+        if (this.fieldsMap == null) {
+            consolide();
+        }
+        FieldAndIndex findex =
+            (FieldAndIndex) fieldsMap.get(name.toLowerCase());
+        return findex == null ? null : findex.getDynField();
+    }
+
+    public FieldAndIndex getDynFieldAndIndex(String name) {
+        if (this.fieldsMap == null) {
+            consolide();
+        }
+        return (FieldAndIndex) this.fieldsMap.get(name.toLowerCase());
+    }
+
+    public DynField[] getDynFields() {
+        if (this.fields == null) {
+            consolide();
+        }
+        return this.fields;
+    }
+
+    public DynField addDynField(String name) {
+        DynField field = new DefaultDynField(name, DataTypes.STRING);
+        return this.addDynField(field);
+    }
+
+    public DynField addDynField(String name, int type) {
+        DynField field = null;
+        field = new DefaultDynField(name,type);
+        return this.addDynField(field);
+    }
+
+    public DynField addDynField(DynField field) {
+        declaredFieldsMap.put(field.getName().toLowerCase(), field);
+        try {
+	        if( field.getOder() == 0 ) {
+	        	field.setOrder(declaredFieldsMap.size()+1 );
+	        }
+        } catch(Exception ex) {
+        	// Ignore errors when try to add an automated order
+        }
+        this.forceConsolide();
+        return field;
+    }
+
+    public DynClass[] getSuperDynClasses() {
+        if (this.superClasses == null) {
+            consolide();
+        }
+        return this.superClasses;
+    }
+
+    public DynStruct[] getSuperDynStructs() {
+        return this.getSuperDynClasses();
+    }
+
+    public DynObject newInstance() {
+        return this.manager.createDynObject(this);
+    }
+
+    public boolean isInstance(DynObject dynObject) {
+        if (this.superClassesMap == null) {
+            consolide();
+        }
+        DefaultDynClass objClass = (DefaultDynClass) dynObject.getDynClass();
+        if (this.superClassesMap.containsKey(objClass.getFullName())) {
+            return true;
+        }
+		if (this.getFullName().equals(objClass.getFullName())) {
+			return true;
+		}
+        if (objClass.isAnonymous) {
+            Iterator it = objClass.classes.values().iterator();
+            while (it.hasNext()) {
+                DynClass dc = (DynClass) it.next();
+                if (this.superClassesMap.containsKey(dc.getFullName())) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public void removeDynField(String name) {
+        this.declaredFieldsMap.remove(name.toLowerCase());
+        this.forceConsolide();
+    }
+
+    public void setAnonymous(boolean isAnonymous) {
+        this.isAnonymous = isAnonymous;
+    }
+
+    public boolean isAnonymous() {
+        return isAnonymous;
+    }
+
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DynClass) {
+            return this.getFullName().equals(((DynClass) obj).getFullName());
+        }
+        return false;
+    }
+
+    public void addDynMethod(DynMethod dynMethod) {
+        this.manager.registerDynMethod(this, dynMethod);
+    }
+
+    void addMethod(DynMethod dynMethod) {
+        declaredMethodsMap.put(dynMethod.getName(), dynMethod);
+        this.forceConsolide();
+    }
+
+    public DynMethod getDeclaredDynMethod(String name) {
+        return (DynMethod) this.declaredMethodsMap.get(name);
+    }
+
+    public DynMethod[] getDeclaredDynMethods() {
+        if (this.declaredMethods == null) {
+            consolide();
+        }
+        return this.declaredMethods;
+    }
+
+    public DynMethod getDynMethod(String name) throws DynMethodException {
+        if (this.methodsMap == null) {
+            consolide();
+        }
+        MethodAndIndex mindex = (MethodAndIndex) methodsMap.get(name);
+        return mindex == null ? null : mindex.getDynMethod();
+    }
+
+    public DynMethod getDynMethod(int code) throws DynMethodException {
+        return this.manager.getDynMethod(code);
+    }
+
+    public DynMethod[] getDynMethods() {
+        if (this.methods == null) {
+            consolide();
+        }
+        return this.methods;
+    }
+
+    public void removeDynMethod(String name) {
+        // TODO Auto-generated method stub
+    }
+
+    public void validate(DynObject object) throws DynObjectValidateException {
+        DynField fields[] = this.getDynFields();
+        DynObjectValidateException exceptions =
+            new DynObjectValidateException(this.getFullName());
+        for (int i = 0; i < fields.length; i++) {
+            DynField field = fields[i];
+            try {
+                field.validate(object.getDynValue(field.getName()));
+            } catch (DynFieldValidateException e) {
+                exceptions.add(e);
+            } catch (DynFieldNotFoundException e) {
+                exceptions.add(e);
+            }
+        }
+        if (exceptions.size() > 0) {
+            throw exceptions;
+        }
+    }
+
+    public DynField addDynFieldString(String name) {
+        return addDynField(name,DataTypes.STRING);
+    }
+
+    public DynField addDynFieldDate(String name) {
+        return addDynField(name,DataTypes.DATE);
+    }
+
+    public DynField addDynFieldInt(String name) {
+        return addDynField(name,DataTypes.INT);
+    }
+
+    public DynField addDynFieldLong(String name) {
+        return addDynField(name,DataTypes.LONG);
+    }
+
+    public DynField addDynFieldDouble(String name) {
+        return addDynField(name,DataTypes.DOUBLE);
+    }
+
+    public DynField addDynFieldFloat(String name) {
+        return addDynField(name,DataTypes.FLOAT);
+    }
+
+    public DynField addDynFieldBoolean(String name) {
+        return addDynField(name,DataTypes.BOOLEAN);
+    }
+
+    public DynField addDynFieldFolder(String name) {
+        return addDynField(name,DataTypes.FOLDER);
+    }
+
+    public DynField addDynFieldFile(String name) {
+        return addDynField(name,DataTypes.FILE);
+    }
+
+    public DynField addDynFieldURL(String name) {
+        return addDynField(name,DataTypes.URL);
+    }
+
+    public DynField addDynFieldURI(String name) {
+        return addDynField(name,DataTypes.URI);
+    }
+
+    public DynField addDynFieldArray(String name) {
+        return addDynField(name,DataTypes.ARRAY);
+    }
+
+    public DynField addDynFieldObject(String name) {
+        return addDynField(name,DataTypes.OBJECT);
+    }
+    
+    public DynField addDynFieldChoice(String name, int type,
+        Object defaultValue, DynObjectValueItem[] values) {
+        return addDynFieldChoice(name, type, defaultValue, values, false, true);
+    }
+
+    public DynField addDynFieldChoice(String name, int type,
+        Object defaultValue, DynObjectValueItem[] values, boolean mandatory,
+        boolean persistent) {
+        return addDynField(name,type)
+            .setDefaultFieldValue(defaultValue).setMandatory(mandatory)
+            .setPersistent(persistent).setAvailableValues(values)
+            .setDescription(description);
+    }
+
+    public DynField addDynFieldRange(String name, int type,
+        Object defaultValue, Object min, Object max) {
+        return addDynFieldRange(name, type, defaultValue, min, max, false, true);
+    }
+
+    public DynField addDynFieldRange(String name, int type,
+        Object defaultValue, Object min, Object max, boolean mandatory,
+        boolean persistent) {
+        return addDynField(name,type)
+            .setDefaultFieldValue(defaultValue).setMandatory(mandatory)
+            .setPersistent(persistent).setMinValue(min).setMaxValue(max);
+    }
+
+    public DynField addDynFieldSingle(String name, int type, Object defaultValue) {
+        return addDynFieldSingle(name, type, defaultValue, false, true);
+    }
+
+    public DynField addDynFieldSingle(String name, int type,
+        Object defaultValue, boolean mandatory, boolean persistent) {
+        return addDynField(name,type)
+            .setDefaultFieldValue(defaultValue).setMandatory(mandatory)
+            .setPersistent(persistent);
+    }
+
+
+    
+        public DynField addDynFieldObject(String name, String dynObjectFullName) {
+        return addDynField(name).setType(DataTypes.DYNOBJECT).setSubtype(dynObjectFullName);
+    }
+
+    public DynField addDynFieldObjectList(String name, String fullDynObjectName) {
+        DynField listDynField = this.addDynFieldList(name)
+            .setElementsType(DataTypes.DYNOBJECT)
+            .setSubtype(fullDynObjectName);
+        return listDynField;
+    }
+
+    public DynField addDynFieldList(String name) {
+        return addDynField(name,DataTypes.LIST);
+    }
+
+    public DynField addDynFieldMap(String name) {
+        return addDynField(name).setType(DataTypes.MAP);
+    }
+
+    public DynField addDynFieldSet(String name) {
+        return addDynField(name).setType(DataTypes.SET);
+    }
+
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setNamespace(String namespace) {
+        this.name.setNamespace(namespace);
+    }
+
+    public void check() throws ListBaseException {
+        ListBaseException exceptions = null;
+
+        if (name == null) {
+            exceptions =
+                CheckDynClassListException.add(exceptions, name, "name", name);
+        }
+        DynField[] fields = this.getDynFields();
+        for (int i = 0; i < fields.length; i++) {
+            try {
+                DefaultDynField field = (DefaultDynField) fields[i];
+                field.check();
+            } catch (Exception ex) {
+                exceptions =
+                    CheckDynClassListException.add(exceptions, name, ex);
+            }
+        }
+        if (exceptions != null) {
+            throw exceptions;
+        }
+    }
+
+    public static class CheckDynClassListException extends ListBaseException {
+
+        /**
+		 * 
+		 */
+        private static final long serialVersionUID = 9042601577056507657L;
+
+        public static class CheckDynClassException extends DynObjectException {
+
+            /**
+			 * 
+			 */
+            private static final long serialVersionUID = -1447120375445458639L;
+
+            public CheckDynClassException(String attrname, Object attrvalue) {
+                super("Wrong value %(value) for attribute %(name).",
+                    "Wrong_value_XvalueX_for_attribute_XnameX",
+                    serialVersionUID);
+            }
+        }
+
+        public CheckDynClassListException(DynClassName name) {
+            super("Inconsistent DynClass %(name) definition.",
+                "_Inconsistent_DynClass_XnameX_definition", serialVersionUID);
+            String s;
+            if (name == null) {
+                s = "[unknow]";
+            } else {
+                s = name.getFullName();
+            }
+            setValue("name", s);
+        }
+
+        public static ListBaseException add(ListBaseException exceptions,
+            DynClassName name, String attrname, Object attrvalue) {
+            if (exceptions == null) {
+                exceptions = new CheckDynClassListException(name);
+            }
+            exceptions.add(new CheckDynClassException(attrname, attrvalue));
+            return exceptions;
+        }
+
+        public static ListBaseException add(ListBaseException exceptions,
+            DynClassName name, Exception ex) {
+            if (exceptions == null) {
+                exceptions = new CheckDynClassListException(name);
+            }
+            exceptions.add(ex);
+            return exceptions;
+        }
+    }
+
+    private boolean isExtendable(Set superClassesSet, DynStruct dynStruct) {
+
+        if ((superClassesSet == null) || (superClassesSet.isEmpty())) {
+            return true;
+        }
+
+        if (superClassesSet.contains(dynStruct)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public boolean isExtendable(DynStruct dynStruct) {
+
+        if (dynStruct == null) {
+            return false;
+        }
+
+        if (this.fieldsMap == null) {
+            consolide();
+        }
+        Set superClassesSet = buildSuperDynClassSet();
+        return isExtendable(superClassesSet, dynStruct);
+    }
+
+    private void removeDynStruct(DynStruct superDynStruct) {
+        if (this.classes.containsKey(superDynStruct.getFullName())) {
+            this.classes.remove(superDynStruct.getFullName());
+        }
+    }
+
+    public void remove(DynStruct superDynStruct) {
+        if (superDynStruct != null) {
+            this.removeDynStruct(superDynStruct);
+            this.forceConsolide();
+        }
+    }
+
+    public void removeAll(DynStruct[] superDynStruct) {
+        if (superDynStruct != null) {
+            for (int i = 0; i < superDynStruct.length; i++) {
+                removeDynStruct(superDynStruct[i]);
+            }
+            this.consolide();
+        }
+    }
+
+    public void extend(DynStruct[] structs) {
+        if (structs != null) {
+            for (int i = 0; i < structs.length; i++) {
+                extend(structs[i]);
+            }
+            this.consolide();
+        }
+    }
+    
+    public Tags getTags() {
+    	return tags;
+    }
+
+    public String getLabel() {
+        if( this.label == null ) {
+            if( this.getTags().get("label") == null ) {
+                return this.getName();
+            }
+            return (String) this.getTags().get("label");
+        }
+        return this.label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public void renameField(String oldname, String newName) {
+        DefaultDynField oldfield = (DefaultDynField) this.getDynField(oldname);
+        if( oldfield == null ) {
+            throw new RuntimeException("field name do not exists.");
+        }
+        DynField newfield = this.getDynField(newName);
+        if( newfield != null ) {
+            throw new RuntimeException("field name already exists.");
+        }
+        declaredFieldsMap.remove(oldfield);
+        oldfield.setName(newName);
+        declaredFieldsMap.put(oldfield.getName().toLowerCase(), oldfield);        
+    }
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClassName.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClassName.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClassName.java	(revision 1235)
@@ -0,0 +1,124 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import org.gvsig.tools.dynobject.DynClassName;
+
+/**
+ * Default {@link DynClassName} implementation.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultDynClassName implements DynClassName {
+	private static final String SEPARATOR = ":";
+	
+	private String name;
+	private String namespace;
+	
+	public DefaultDynClassName(String namespace, String name) {
+		setNamespace(namespace);
+		setName(name);
+	}
+	
+	public DefaultDynClassName(String fullname) {
+		int x=fullname.indexOf(SEPARATOR);
+		int y=fullname.lastIndexOf(SEPARATOR);
+		if( x>-1 ) {
+			// Separator should only be present once
+			if (x==y){
+				setNamespace(fullname.substring(0, x));
+				setName(fullname.substring(x+1));				
+			}else{
+				throw new IllegalArgumentException("Fullname '" + fullname + "' not allowed. Only one '" + SEPARATOR + "' is possible.");				
+			}
+		} else {
+			this.namespace = null;
+			setName(fullname);
+		}
+	}
+	
+	public DefaultDynClassName(String[] name) {
+		setNamespace(name[0]);
+		setName(name[1]);
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public String getNamespace() {
+		return namespace;
+	}
+	
+	public String getFullName() {
+    	if( namespace == null ) {
+    		return name;
+    	}
+    	return namespace + SEPARATOR + name;
+	}
+
+	public void setNamespace(String namespace) {
+		if(namespace!=null){
+            if (namespace.indexOf(SEPARATOR) <= -1) {
+				this.namespace = namespace;
+			}else{
+				throw new IllegalArgumentException("Namespace '" + namespace + "' not allowed. Character " + SEPARATOR + " forbidden whithin a dynClass' namespace'");
+			}
+		}else{
+			this.namespace = null;
+		}
+	}
+
+	public void setName(String name) {
+		if(name!=null){
+            if (name.indexOf(SEPARATOR) <= -1) {
+				this.name = name;
+			}else{
+				throw new IllegalArgumentException("Name '" + name + "' not allowed. Character '" + SEPARATOR + "' is not valid within a dynClass' name.");
+			}
+		}else{
+			throw new IllegalArgumentException("Null value unsupported for a dynClass' name.");
+		}
+	}
+
+	public int hashCode() {
+		return getFullName().hashCode();
+	}
+
+	public boolean equals(Object obj) {
+		if (this == obj) {
+			return true;
+		}
+		if (obj instanceof DynClassName) {
+			DynClassName obj2 = (DynClassName) obj;
+			return getFullName().equalsIgnoreCase(obj2.getFullName());
+		}
+		return false;
+	}
+	
+	public String toString() {
+		return this.getFullName();
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynClassName.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObject.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObject.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynObject.java	(revision 1235)
@@ -0,0 +1,311 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.gvsig.tools.ToolsLocator;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+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.DynObjectManager;
+import org.gvsig.tools.dynobject.DynObjectRuntimeException;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.dynobject.impl.DefaultDynClass.FieldAndIndex;
+
+public class DefaultDynObject implements DelegatedDynObject {
+
+    protected DynClass dynClass;
+    protected Map values;
+    protected DynObject[] delegateds;
+
+    public DefaultDynObject(DynStruct dynClass) {
+        this.dynClass = (DynClass) dynClass;
+        this.delegateds = null;
+        this.values = createValues(null);
+    }
+
+    private Map createValues(Map oldValues) {
+        HashMap extended = new HashMap();
+        if ( oldValues != null ) {
+            extended.putAll(oldValues);
+        }
+        return extended;
+    }
+
+    public void implement(DynClass dynClass) {
+        this.dynClass = (DefaultDynClass) ((DefaultDynObjectManager) ((DefaultDynClass) dynClass)
+                .getManager()).get(new DynClass[]{this.dynClass, dynClass});
+        this.values = createValues(this.values);
+    }
+
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        boolean defined = false;
+        Object defaultValue = null;
+        name = name.toLowerCase();
+        
+        
+        DynField field = dynClass.getDynField(name);
+        if( field != null ) {
+            if( values.containsKey(name) ) {
+                return values.get(name);
+            }
+            defined = true;
+            defaultValue = field.getDefaultValue();
+        }
+//        
+//        FieldAndIndex fieldAndIndex = dynClass.getDynFieldAndIndex(name);
+//        if ( fieldAndIndex != null ) {
+//            if ( values.containsKey(name) ) {
+//                return values.get(name);
+//            }
+//            defined = true;
+//            defaultValue = fieldAndIndex.getDynField().getDefaultValue();
+//        }
+        if ( delegateds != null ) {
+            for ( int i = 0; i < delegateds.length; i++ ) {
+                DynObject dynObj = delegateds[i];
+                try {
+                    if ( dynObj.hasDynValue(name) ) {
+                        return dynObj.getDynValue(name);
+                    } else {
+                        defined = true;
+                        defaultValue = dynObj.getDynValue(name);
+                    }
+                } catch (DynFieldNotFoundException ex) {
+                    ;
+                }
+            }
+        }
+        if ( defined ) {
+            return defaultValue;
+        }
+        throw new DynFieldNotFoundException(name, dynClass.getName());
+    }
+
+    public void setDynValue(String name, Object value)
+            throws DynFieldNotFoundException {
+        name = name.toLowerCase();
+
+        if ( this.dynClass.getDynField(name) == null ) {
+            throw new DynFieldNotFoundException(name, this.getDynClass()
+                    .getName());
+        }
+
+        try {
+            values.put(name, this.dynClass.getDynField(name).coerce(value));
+        } catch (CoercionException e) {
+            throw new CoerceValueException(this.dynClass, name, value, e);
+        }
+    }
+
+    public class CoerceValueException extends DynObjectRuntimeException {
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 8974502669097158348L;
+
+        public CoerceValueException(DynStruct dynStruct, String fieldName,
+                Object value, Throwable cause) {
+            super(
+                    "Can't convert value %(value) for field %(field) of class %(class).",
+                    cause,
+                    "Cant_convert_value_XvalueX_for_field_XfieldX_of_class_XclassX",
+                    serialVersionUID);
+            setValue("field", fieldName);
+            setValue("class", dynStruct.getFullName());
+            try {
+                setValue("value", value.toString());
+            } catch (Exception e1) {
+                setValue("value", "???");
+            }
+        }
+
+    }
+
+    public boolean instanceOf(DynClass dynClass) {
+        return dynClass.isInstance(this);
+    }
+
+    public DynClass getDynClass() {
+        return this.dynClass;
+    }
+
+    public boolean hasDynValue(String name) throws DynFieldNotFoundException {
+        boolean defined = false;
+        name = name.toLowerCase();
+        
+        DynField field = dynClass.getDynField(name);
+        if( field!=null ) {
+            if ( this.values.containsKey(name) ) {
+                return true;
+            }
+            defined = true;
+        }
+        
+//        int index = dynClass.getFieldIndex(name); xxxx
+//        if ( index >= 0 ) {
+//            if ( this.values.containsKey(name) ) {
+//                return true;
+//            }
+//            defined = true;
+//        }
+        if ( delegateds != null ) {
+            for ( int i = 0; i < delegateds.length; i++ ) {
+                DynObject dynObj = delegateds[i];
+                try {
+                    if ( dynObj.hasDynValue(name) ) {
+                        return true;
+                    } else {
+                        defined = true;
+                    }
+                } catch (DynFieldNotFoundException ex) {
+                    ;
+                }
+            }
+        }
+        if ( defined ) {
+            return false;
+        }
+        throw new DynFieldNotFoundException(name, dynClass.getName());
+    }
+
+    public void delegate(DynObject dynObjects) {
+        if ( delegateds == null ) {
+            this.delegateds = new DynObject[1];
+            this.delegateds[0] = dynObjects;
+            return;
+        }
+        DynObject[] newValues = new DynObject[this.delegateds.length + 1];
+        System.arraycopy(delegateds, 0, newValues, 0, delegateds.length);
+        newValues[delegateds.length] = dynObjects;
+        this.delegateds = newValues;
+    }
+
+    public Object invokeDynMethod(String name, DynObject context)
+            throws DynMethodException {
+        throw new IllegalArgumentException("self required");
+    }
+
+    public Object invokeDynMethod(int code, DynObject context) throws DynMethodException {
+        throw new IllegalArgumentException("self required");
+    }
+
+    public Object invokeDynMethod(Object self, String methodName,
+            DynObject context) throws DynMethodException {
+        DynMethod method = this.dynClass.getDynMethod(methodName);
+        if ( method == null ) {
+            if ( delegateds != null ) {
+                for ( int i = 0; i < delegateds.length; i++ ) {
+                    try {
+                        return delegateds[i].invokeDynMethod(methodName,
+                                context);
+                    } catch (DynMethodNotSupportedException e) {
+                        // continue next delegated
+                    }
+                }
+
+            }
+            throw new DynMethodNotSupportedException(methodName, self
+                    .getClass().getName());
+
+        }
+        return method.invoke(self, context);
+    }
+
+    public Object invokeDynMethod(Object self, int methodCode, DynObject context) throws DynMethodException {
+        DynMethod method = this.dynClass.getDynMethod(methodCode);
+        if ( method == null ) {
+            if ( delegateds != null ) {
+                for ( int i = 0; i < delegateds.length; i++ ) {
+                    try {
+                        return delegateds[i].invokeDynMethod(methodCode,
+                                context);
+                    } catch (DynMethodNotSupportedException e) {
+                        // continue next delegated
+                    }
+                }
+                throw new DynMethodNotSupportedException(methodCode, self
+                        .getClass().getName());
+
+            } else {
+                throw new DynMethodNotSupportedException(methodCode, self
+                        .getClass().getName());
+            }
+        }
+        DynObjectManager manager = ToolsLocator.getDynObjectManager();
+        return manager.invokeDynMethod(self, methodCode, context);
+    }
+
+    public void clear() {
+        DynField[] fields = getDynClass().getDeclaredDynFields();
+
+        for ( int i = 0; i < fields.length; i++ ) {
+            this.setDynValue(fields[i].getName(), fields[i].getDefaultValue());
+        }
+    }
+
+    public String toString() {
+        return DefaultDynObject.toString(this);
+    }
+
+    public static String toString(DynObject obj) {
+        StringBuffer buffer = new StringBuffer();
+
+        DynClass dynClass = obj.getDynClass();
+        buffer.append("DynClass name: ").append(dynClass.getName()).append(
+                ";  Fields: ");
+
+        DynField[] fields = dynClass.getDeclaredDynFields();
+
+        if ( fields == null || fields.length == 0 ) {
+            buffer.append("(none)");
+        } else {
+            buffer.append("[");
+            for ( int i = 0; i < fields.length; i++ ) {
+                if ( i != 0 ) {
+                    buffer.append(", ");
+                }
+                buffer.append(fields[i].getName()).append(" = ")
+                        .append(obj.getDynValue(fields[i].getName()));
+            }
+            buffer.append("]");
+        }
+        return buffer.toString();
+    }
+
+    public boolean hasEmptyValues() {
+        return this.values.isEmpty();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/MultiDynObjectSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/MultiDynObjectSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/MultiDynObjectSet.java	(revision 1235)
@@ -0,0 +1,208 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.Observer;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Fa�ade for a list of {@link DynObjectSet}s as if they were an only contiguous
+ * set of {@link DynObject}s.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class MultiDynObjectSet implements DynObjectSet {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(MultiDynObjectSet.class);
+
+    private final DynObjectSet[] innerSets;
+
+    /**
+     * Creates a new {@link MultiDynObjectSet} with the list of
+     * {@link DynObjectSet}s to fa�ade.
+     */
+    public MultiDynObjectSet(DynObjectSet[] innerSets) {
+        this.innerSets = innerSets == null ? new DynObjectSet[0] : innerSets;
+    }
+
+    public void dispose() {
+        for (int i = 0; i < innerSets.length; i++) {
+            innerSets[i].dispose();
+        }
+    }
+
+    public void accept(Visitor visitor, long firstValueIndex)
+        throws BaseException {
+
+        // Find the set where the global index points to
+        int currentSet = 0;
+        long currentIndex = 0;
+        while (currentIndex + innerSets[currentSet].getSize() <= firstValueIndex) {
+            currentIndex += innerSets[currentSet].getSize();
+            currentSet++;
+        }
+        // Get the relative index into the current set
+        long firstIndexFromCurrentSet = firstValueIndex - currentIndex;
+
+        // Visit the current set beginning from the relative index
+        innerSets[currentSet].accept(visitor, firstIndexFromCurrentSet);
+
+        // Finally, visit the remaining sets fully.
+        for (int i = currentSet; i < innerSets.length; i++) {
+            innerSets[i].accept(visitor);
+        }
+    }
+
+    public void accept(Visitor visitor) throws BaseException {
+        accept(visitor, 0);
+    }
+
+    public long getSize() throws BaseException {
+        long size = 0;
+        for (int i = 0; i < innerSets.length; i++) {
+            size += innerSets[i].getSize();
+        }
+        return size;
+    }
+
+    public DisposableIterator iterator(long index) throws BaseException {
+        return new MultiDynObjectSetDisposableIterator(innerSets);
+    }
+
+    public DisposableIterator iterator() throws BaseException {
+        return iterator(0);
+    }
+
+    public boolean isEmpty() throws BaseException {
+        for (int i = 0; i < innerSets.length; i++) {
+            if (!innerSets[i].isEmpty()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @author gvSIG Team
+     * @version $Id$
+     * 
+     */
+    public static class MultiDynObjectSetDisposableIterator implements
+        DisposableIterator {
+
+        private DisposableIterator currentIterator = null;
+        private int currentSet = 0;
+        private final DynObjectSet[] innerSets;
+
+        public MultiDynObjectSetDisposableIterator(DynObjectSet[] innerSets)
+            throws BaseException {
+            this.innerSets = innerSets;
+            if ((currentIterator == null) && (currentSet < innerSets.length)) {
+                currentIterator = innerSets[currentSet].iterator();
+            }
+        }
+
+        public void dispose() {
+            if (currentIterator != null) {
+                currentIterator.dispose();
+            }
+        }
+
+        private DisposableIterator getCurrentIterator() {
+            while (!currentIterator.hasNext()
+                && (currentSet < innerSets.length - 1)) {
+                currentSet++;
+                try {
+                    currentIterator = innerSets[currentSet].iterator();
+                } catch (BaseException e) {
+                    LOG.error(
+                        "Could no get the iterator of the internal DynObjectSet num. "
+                            + currentSet + ": " + innerSets[currentSet], e);
+                }
+            }
+            return currentIterator;
+        }
+
+        public boolean hasNext() {
+            DisposableIterator currentIterator = getCurrentIterator();
+            return currentIterator == null ? false : currentIterator.hasNext();
+        }
+
+        public Object next() {
+            DisposableIterator currentIterator = getCurrentIterator();
+            return currentIterator == null ? null : currentIterator.next();
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException(
+                "Unable to remove on composed DynObjectSet iterator");
+        }
+    }
+
+    public void addObserver(Observer o) {
+        throw new UnsupportedOperationException("This DynObjectSet "
+            + "implementation does not support edition, so it doesn't "
+            + "provide notifications");
+    }
+
+    public void deleteObserver(Observer o) {
+        throw new UnsupportedOperationException("This DynObjectSet "
+            + "implementation does not support edition, so it doesn't "
+            + "provide notifications");
+    }
+
+    public void deleteObservers() {
+        throw new UnsupportedOperationException("This DynObjectSet "
+            + "implementation does not support edition, so it doesn't "
+            + "provide notifications");
+    }
+
+    public boolean isDeleteEnabled() {
+        return false;
+    }
+
+    public void delete(DynObject dynObject) throws BaseException {
+        throw new UnsupportedOperationException("This DynObjectSet "
+            + "implementation does not support DynObject deletion");
+    }
+
+    public boolean isUpdateEnabled() {
+        return false;
+    }
+
+    public void update(DynObject dynObject) throws BaseException {
+        throw new UnsupportedOperationException("This DynObjectSet "
+            + "implementation does not support DynObject update");
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass_v2.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass_v2.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynClass_v2.java	(revision 1235)
@@ -0,0 +1,30 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.tools.dynobject;
+
+
+public interface DynClass_v2 extends DynClass, DynStruct_v2 {
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynMethod.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynMethod.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynMethod.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dynobject;
+
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+
+public interface DynMethod {
+	public Object invoke(Object self, DynObject context)
+	throws DynMethodException;
+
+	public String getName();
+
+	public String getDescription();
+
+	public int getCode() throws DynMethodNotSupportedException;
+	
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationException.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.operations;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+
+public class OperationException extends BaseException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -2344772588507587265L;
+	private final static String MESSAGE_FORMAT = "Error with operation.";
+	private final static String MESSAGE_KEY = "_OperationException";
+
+	protected Map values = new HashMap();
+
+	public OperationException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public OperationException(String messageFormat, String messageKey,
+			long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+	public OperationException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+
+	protected void setValue(String name, Object value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operation.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operation.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operation.java	(revision 1235)
@@ -0,0 +1,35 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations;
+
+public interface Operation {
+	public Object invoke(Object self, OperationContext context)
+			throws OperationException;
+
+	public String getName();
+
+	public String getDescription();
+
+	public int getCode() throws OperationNotSupportedException;
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/impl/DefaultOperationManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/impl/DefaultOperationManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/impl/DefaultOperationManager.java	(revision 1235)
@@ -0,0 +1,220 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.operations.Operation;
+import org.gvsig.tools.operations.OperationContext;
+import org.gvsig.tools.operations.OperationException;
+import org.gvsig.tools.operations.OperationManager;
+import org.gvsig.tools.operations.OperationNotSupportedException;
+
+public class DefaultOperationManager implements OperationManager {
+
+	private class OperationInfo {
+		Class theClass;
+		int code;
+		Operation operation;
+
+		OperationInfo(Class theClass, int code, Operation operation) {
+			this.theClass = theClass;
+			this.code = code;
+			this.operation = operation;
+		}
+
+		String getKey() {
+			return theClass.getName() + ":" + operation.getName();
+		}
+	}
+
+	private Operation[] operations;
+	private Map operationsInfoMap;
+	private OperationInfo[] operationsInfo;
+
+	public DefaultOperationManager() {
+		operationsInfoMap = new HashMap();
+		operations = new Operation[1];
+	}
+
+	public int registerOperation(Operation operation, Class theClass) {
+		OperationInfo info = new OperationInfo(theClass, 0, operation);
+		OperationInfo oldInfo = (OperationInfo) operationsInfoMap.get(info
+				.getKey());
+		if (oldInfo != null) {
+			// Update the operation
+			oldInfo.theClass = theClass;
+			oldInfo.operation = operation;
+			return oldInfo.code;
+		}
+		if (operations == null) {
+			operations = new Operation[1];
+			operationsInfo = new OperationInfo[1];
+			info.code = 0;
+		} else {
+			Operation[] temp1 = new Operation[operations.length + 1];
+			System.arraycopy(operations, 0, temp1, 0, operations.length);
+			OperationInfo[] temp2 = new OperationInfo[operationsInfo.length + 1];
+			System
+					.arraycopy(operationsInfo, 0, temp2, 0,
+							operationsInfo.length);
+			info.code = operations.length - 1;
+		}
+		operations[info.code] = info.operation;
+		operationsInfo[info.code] = info;
+		operationsInfoMap.put(info.getKey(), info);
+		return info.code;
+	}
+
+	private String getKey(Object obj, String name) {
+		return obj.getClass().getName() + ":" + name;
+	}
+
+	private String getKey(Class theClass, String name) {
+		return theClass.getName() + ":" + name;
+	}
+
+	public Operation getOperation(Object obj, String name)
+			throws OperationNotSupportedException {
+		OperationInfo info = (OperationInfo) operationsInfoMap.get(getKey(obj,
+				name));
+		if (info == null) {
+			throw new OperationNotSupportedException(obj.getClass(), name);
+		}
+		return info.operation;
+	}
+
+	public Operation getOperation(Class theClass, String name)
+			throws OperationNotSupportedException {
+		OperationInfo info = (OperationInfo) operationsInfoMap.get(getKey(
+				theClass, name));
+		if (info == null) {
+			throw new OperationNotSupportedException(theClass, name);
+		}
+		return info.operation;
+	}
+
+	public Operation getOperation(Object obj, int code)
+			throws OperationNotSupportedException {
+		if (code >= operationsInfo.length) {
+			throw new OperationNotSupportedException(obj.getClass(), code);
+		}
+		OperationInfo info = operationsInfo[code];
+		if (!info.theClass.isAssignableFrom(obj.getClass())) {
+			throw new OperationNotSupportedException(obj.getClass(), code);
+		}
+		return info.operation;
+	}
+
+	public Operation getOperation(Class theClass, int code)
+			throws OperationNotSupportedException {
+		if (code >= operationsInfo.length) {
+			throw new OperationNotSupportedException(theClass, code);
+		}
+		OperationInfo info = operationsInfo[code];
+		if (!info.theClass.isAssignableFrom(theClass)) {
+			throw new OperationNotSupportedException(theClass, code);
+		}
+		return info.operation;
+	}
+
+	public boolean hasOperation(Object obj, String name) {
+		try {
+			Operation op = getOperation(obj, name);
+			return op != null;
+		} catch (OperationNotSupportedException e) {
+			return false;
+		}
+	}
+
+	public boolean hasOperation(Object obj, int code) {
+		try {
+			Operation op = getOperation(obj, code);
+			return op != null;
+		} catch (OperationNotSupportedException e) {
+			return false;
+		}
+	}
+
+	public boolean hasOperation(Class theClass, String name) {
+		try {
+			Operation op = getOperation(theClass, name);
+			return op != null;
+		} catch (OperationNotSupportedException e) {
+			return false;
+		}
+	}
+
+	public boolean hasOperation(Class theClass, int code) {
+		try {
+			Operation op = getOperation(theClass, code);
+			return op != null;
+		} catch (OperationNotSupportedException e) {
+			return false;
+		}
+	}
+
+	public Object invokeOperation(Object obj, String name,
+			OperationContext context) throws OperationException {
+		Operation op = getOperation(obj, name);
+		return op.invoke(obj, context);
+	}
+
+	public Object invokeOperation(Object obj, int code, OperationContext context)
+			throws OperationException {
+		try {
+			/*
+			 * Intentamos ejecutar la operacion, y si peta ya aremos las
+			 * comprobaciones oportunas para lanzar la excepcion que toque.
+			 *
+			 * Asi evitamos codigo de comprobacion para los casos que valla bien
+			 * que deberian ser la mayoria.
+			 */
+			return operations[code].invoke(obj, context);
+		} catch (RuntimeException e) {
+			getOperation(obj, code);
+			throw e;
+		} catch (OperationException e) {
+			getOperation(obj, code);
+			throw e;
+		}
+	}
+
+	public int getOperationCode(Class theClass, String name)
+			throws OperationNotSupportedException {
+		OperationInfo info = (OperationInfo) operationsInfoMap.get(getKey(
+				theClass, name));
+		if (info == null) {
+			throw new OperationNotSupportedException(theClass, name);
+		}
+		return info.code;
+	}
+
+	public int registerOperation(Operation operation, Object obj) {
+		return registerOperation(operation, obj.getClass());
+	}
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operations.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operations.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/Operations.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations;
+
+
+public interface Operations {
+
+	public Object invokeOperation(int code, OperationContext context)
+			throws OperationException, OperationNotSupportedException;
+
+	public Object invokeOperation(String name, OperationContext context)
+			throws OperationException, OperationNotSupportedException;
+
+
+	public Object getOperation(int code)
+			throws OperationException,
+			OperationNotSupportedException;
+
+	public Object getOperation(String name)
+			throws OperationException,
+			OperationNotSupportedException;
+
+
+	public boolean hasOperation(int code);
+
+	public boolean hasOperation(String name);
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/AbstractOperation.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/AbstractOperation.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/AbstractOperation.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations;
+
+import org.gvsig.tools.ToolsLocator;
+
+public abstract class AbstractOperation {
+
+	protected String name;
+	protected String description;
+
+	public AbstractOperation(String name, String descrption) {
+		this.description = descrption;
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Get the operation code associated to this operation.
+	 * 
+	 * Overwrite this method for optimize.
+	 * 
+	 * @return the operation code
+	 * @throws OperationNotSupportedException
+	 */
+	public int getCode() throws OperationNotSupportedException {
+		OperationManager manager = ToolsLocator.getOperationManager();
+		return manager.getOperationCode(this.getClass(), name);
+	}
+
+	/**
+	 * Invokes this operation in the context.
+	 *
+	 * @param self
+	 *            the object to which apply this operation
+	 * @param ctx
+	 *            Parameter container
+	 * @return Place-holder object that may contain any specific return value.
+	 * @throws OperationException
+	 *             The implementation is responsible to throw this exception
+	 *             when needed.
+	 */
+	public abstract Object invoke(Object self, OperationContext context)
+			throws OperationException;
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationContext.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationContext.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationContext.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations;
+
+public interface OperationContext {
+
+	/**
+	 * Returns an attribute given its name.
+	 * If it does not exist returns <code>null</code>
+	 * @param name
+	 * @return attribute
+	 */
+	public abstract Object getAttribute(String name);
+
+	/**
+	 * Sets an attribute
+	 * @param name
+	 * @param value
+	 */
+	public abstract void setAttribute(String name, Object value);
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationNotSupportedException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationNotSupportedException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationNotSupportedException.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.operations;
+
+
+public class OperationNotSupportedException extends OperationException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -6662679326425178742L;
+	private static final String MESSAGE_KEY = "_OperationNotSupportedException";
+	private static final String MESSAGE_FORMAT = "Operation %(operationName)s with code %(operationCode)s not supported in %(theClass)s.";
+
+	public OperationNotSupportedException(Class theClass, String operationName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("operationCode", new Integer(-1));
+		setValue("operationName", operationName);
+		setValue("theClass", theClass);
+	}
+
+	public OperationNotSupportedException(Class theClass, int code) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("operationCode", new Integer(code));
+		setValue("operationName", "unknow");
+		setValue("theClass", theClass);
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/operations/OperationManager.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.operations;
+
+public interface OperationManager {
+
+	public int getOperationCode(Class aClass, String name)
+			throws OperationNotSupportedException;
+
+	public Operation getOperation(Object obj, String name)
+			throws OperationNotSupportedException;
+
+	public Operation getOperation(Object obj, int code)
+			throws OperationNotSupportedException;
+
+	public Operation getOperation(Class aClass, String name)
+			throws OperationNotSupportedException;
+
+	public Operation getOperation(Class aClass, int code)
+			throws OperationNotSupportedException;
+
+	public Object invokeOperation(Object obj, String name,
+			OperationContext context) throws OperationException;
+
+	public Object invokeOperation(Object obj, int code, OperationContext context)
+			throws OperationException;
+
+	public boolean hasOperation(Object obj, String name);
+
+	public boolean hasOperation(Object obj, int code);
+
+	public boolean hasOperation(Class aClass, String name);
+
+	public boolean hasOperation(Class aClass, int code);
+
+	public int registerOperation(Operation operation, Object obj);
+
+	public int registerOperation(Operation operation, Class aClass);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractMultiPersistenceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractMultiPersistenceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractMultiPersistenceFactory.java	(revision 1235)
@@ -0,0 +1,176 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public abstract class AbstractMultiPersistenceFactory implements PersistenceFactory  {
+
+	protected List classes;
+	protected List definitions;
+	protected Map nameToDefinition;
+	protected Map nameToClass;
+
+	protected AbstractMultiPersistenceFactory() {
+		this.definitions = new ArrayList();
+		this.classes = new ArrayList();
+		this.nameToDefinition = new HashMap();
+		this.nameToClass = new HashMap();
+		this.makeDefinitions();
+	}
+
+	protected DynStruct addDefinition(Class managedClass, String name, String description) {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+
+		DynClass definition = dynman.createDynClass(PersistenceManager.PERSISTENCE_NAMESPACE, name, description);
+		dynman.add(definition);
+		
+		this.definitions.add(definition);
+		this.nameToDefinition.put(managedClass.getName(), definition);
+		this.nameToDefinition.put(definition.getFullName(), definition);
+		if( definition.getNamespace().equals(PersistenceManager.PERSISTENCE_NAMESPACE) ) {
+			this.nameToDefinition.put(definition.getName(), definition);
+		}
+		
+//		this.classes.add(managedClass);
+//		this.nameToClass.put(managedClass.getName(), managedClass);
+//		this.nameToClass.put(definition.getFullName(), managedClass);
+//		if( definition.getNamespace().equals(PersistenceManager.PERSISTENCE_NAMESPACE) ) {
+//			this.nameToClass.put(definition.getName(), managedClass);
+//		}
+		addManagedClass(managedClass,definition);
+		
+		return definition;
+	}
+    
+	protected void addManagedClass(Class managedClass, DynClass definition ) {
+		if( !this.classes.contains(managedClass) ) {
+			this.classes.add(managedClass);
+		}
+		this.nameToClass.put(managedClass.getName(), managedClass);
+		this.nameToClass.put(definition.getFullName(), managedClass);
+		if( definition.getNamespace().equals(PersistenceManager.PERSISTENCE_NAMESPACE) ) {
+			this.nameToClass.put(definition.getName(), managedClass);
+		}
+	}
+	
+	public String toString() {
+    	StringBuffer buffer = new StringBuffer();
+    	
+    	buffer.append(this.getClass().getName()).append("[").append(this.hashCode()).append("]").append("( ")
+    		.append("managedClasses='").append(this.classes.toString()).append("', ")
+    		.append("structs='").append(this.definitions.toString())
+    		.append(" )");
+    	return buffer.toString();
+    }
+    
+	public void loadFromState(PersistentState state, Object object)
+			throws PersistenceException {
+				// By default nothing to do here, the object hasn't any more
+				// properties to set.
+			}
+
+	public String getDomainName() {
+		return PersistenceManager.DEFAULT_DOMAIN_NAME;
+	}
+
+	public String getDomainURL() {
+		return PersistenceManager.DEFAULT_DOMAIN_URL;
+	}
+
+	public List getDefinitions() {
+		return definitions;
+	}
+
+	public List getManagedClasses() {
+		return   this.classes ;
+	}
+	
+	public DynStruct getDefinition(String className) {
+		return (DynStruct) this.nameToDefinition.get(className);
+	}
+	
+	public boolean manages(Object object) {
+		return this.manages(object.getClass());
+	}
+
+	public boolean manages(Class theClass) {
+		Iterator it =  this.getManagedClasses().iterator();
+		while( it.hasNext() ) {
+			Class theInterface = (Class) it.next();
+			if(  theInterface.isAssignableFrom(theClass) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public boolean manages(PersistentState state) {
+		return this.nameToClass.get( state.getTheClassName()) != null ;
+	}
+
+	public Class getManagedClass(PersistentState state) {
+		return (Class) this.nameToClass.get( state.getTheClassName()) ;
+	}
+	
+	public Class getManagedClass(String name) {
+		return (Class) this.nameToClass.get(name) ;
+	}
+	
+	public Class getManagedClass(Object object) {
+		Iterator it =  this.getManagedClasses().iterator();
+		while( it.hasNext() ) {
+			Class theInterface = (Class) it.next();
+			if(  theInterface.isInstance(object) ) {
+				return theInterface;
+			}
+		}
+		return null;
+	}
+	
+	public String getManagedClassName(Object object) {
+		Class clazz = this.getManagedClass(object);
+		if (clazz != null){
+			return clazz.getName();
+		}
+		return null;
+	}
+
+	/**
+	 * Create DynStruct definition and call to {@link #addDefinition(Class, DynStruct)}
+	 * to add to the factory.
+	 */
+	abstract protected void makeDefinitions();
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractMultiPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistenceManagerServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistenceManagerServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistenceManagerServices.java	(revision 1235)
@@ -0,0 +1,54 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.spi;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public interface PersistenceManagerServices extends PersistenceManager {
+
+	public PersistentStateServices createState(Object theOriginal, PersistentContextServices context) throws PersistenceException;
+
+	public PersistentContextServices getNewContext();
+	
+	public List getWrappedList(List list, PersistentContextServices context);
+
+	public Map getWrappedMap(Map map, PersistentContextServices context);
+
+	public Set getWrappedSet(Set set, PersistentContextServices context);
+	
+	public PersistentStateServices createPersistentState(	PersistentContextServices context);
+
+	public PersistentStateServices createPersistentState(	PersistentContextServices context, PersistentIdentifier id);
+	
+	public Map getDomains();
+	
+	public List getDomainDefinitions(String domainName);
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistenceManagerServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentIdentifier.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentIdentifier.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentIdentifier.java	(revision 1235)
@@ -0,0 +1,28 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.spi;
+
+public interface PersistentIdentifier {
+	// This interface don't expose nothing.
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentIdentifier.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentStateServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentStateServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentStateServices.java	(revision 1235)
@@ -0,0 +1,48 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.spi;
+
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public interface PersistentStateServices extends PersistentState {
+
+	public PersistentIdentifier  getId();
+
+	public void setTheClassName(String className);
+
+	public void setFactory(PersistenceFactory factory);
+	
+	/**
+	 * Return the internal value stored in the state associated to the 
+	 * name passed as parameter.
+	 * 
+	 * @param name
+	 * @return
+	 */
+	public Object getValue(String name) ;
+
+	public void setValue(String name, Object value) throws PersistenceException ;
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentStateServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentContextServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentContextServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentContextServices.java	(revision 1235)
@@ -0,0 +1,230 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+package org.gvsig.tools.persistence.spi;
+
+
+import org.gvsig.tools.persistence.PersistentContext;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+public interface PersistentContextServices extends PersistentContext {
+
+
+	public interface ObjectReference {
+		
+		/**
+		 * Return the persistent identifier associated to the
+		 * object reference.
+		 * 
+		 * @return the persistent identifier as PersistentIdentifier. 
+		 */
+		public PersistentIdentifier getId();
+		
+		/**
+		 * Return the object associated to the object reference.
+		 * If the object reference don't has an object associated
+		 * then create if from the state, associate to the reference
+		 * and return it..
+		 * 
+		 * @return object.
+		 */
+		public Object getObject();
+		
+		/**
+		 * Return true if the reference has an object associated.
+		 * 
+		 * @return
+		 */
+		public boolean hasObject();
+		
+		/**
+		 * Return the state associated to this object reference.
+		 *  
+		 * @return the state as a PersistentState.
+		 */
+		public PersistentState getState();
+	}
+	
+	public void setRootId(PersistentIdentifier id);
+
+	public ObjectReference getRoot() throws PersistenceException;
+
+	/**
+	 * Return the object reference associated to the id indicated
+	 * as parameter.
+	 * 
+	 * Can't create a new object reference for the passed object
+	 * if it not exists. If not has object reference associated to the
+	 * id passed return null.
+	 * 
+	 * @param id
+	 * @return the object reference or null.
+	 */
+	public ObjectReference get(PersistentIdentifier id);
+	
+	/**
+	 * Return the object reference associated to the object 
+	 * passed as parameter.
+	 * 
+	 * Can't create a new object reference for the passed object
+	 * if it not exists. If not has object reference associated to the
+	 * id passed return null.
+	 *  
+	 * @param obj
+	 * @return the object reference or null.
+	 */
+	public ObjectReference get(Object obj);
+
+	
+	/**
+	 * Return the object reference associated to the state passed as parameter.
+	 * If not exists an object reference associated to the state, then a new
+	 * object reference is created, registered and returned.
+	 * 
+	 * Don't modify or update the object in the reference, it can be null.
+	 *  
+	 * @param state
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public ObjectReference get(PersistentState state) throws PersistenceException ;
+
+	/**
+	 * Update the object referenced by ref, recreating it with this 
+	 * state,
+	 * 
+	 * @param ref
+	 * @throws PersistenceException
+	 */
+	public void update(ObjectReference ref) throws PersistenceException;
+
+
+	/**
+	 * Add a reference to the object associated to the state.
+	 * If reference already exits and obj not is null, it is updated
+	 * with obj.
+	 * 
+	 * If obj is null, the add the object reference with the state
+	 * and the object to null.
+	 * 
+	 * Return the created or updated object reference. 
+	 *  
+	 * @param state
+	 * @param obj
+	 * @return the object reference.
+	 * @throws PersistenceException
+	 */
+	public ObjectReference add(PersistentState state, Object obj) throws PersistenceException;
+	
+	/**
+	 * Add a new reference associated to the identifier passed as 
+	 * parameter.
+	 * If already exists an object reference for this id, return this.
+	 * 
+	 * @param id
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public ObjectReference add(PersistentIdentifier id) throws PersistenceException ;
+	
+	/**
+	 * Clear the instances of references previously recreated
+	 *
+	 */
+	public void clear();
+
+	/**
+	 * @deprecated
+	 */
+	public PersistentState getState(Integer id) throws PersistenceException;
+
+	/**
+	 * @deprecated
+	 */
+	public PersistentState getState(Object obj) throws PersistenceException;
+
+	/**
+	 * Return the id associated to the object passed as parameter.
+	 * If object is not loaded, all objects in context are loaded.
+	 * 
+	 * @param obj
+	 * @return id of the object.
+	 * @throws PersistenceException
+	 * @deprecated
+	 */
+	public PersistentIdentifier getId(Object obj) throws PersistenceException;
+
+	/**
+	 * @deprecated
+	 */
+	public Object getObject(Integer id) throws PersistenceException;
+
+	/**
+	 * Get a valid new persistent identifier.
+	 * 
+	 * @return the identifier
+	 */
+	public PersistentIdentifier getNewIdentifier();
+	
+	/**
+	 * Create a new identifier based on the string passed as parameter
+	 * and return this. 
+	 *
+	 * Throws a exception if the identifier passed as parameter has
+	 * conflict with another identifier.
+	 * 
+	 * @param id
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public PersistentIdentifier getIdentifier(String id) throws PersistenceException;
+
+	/**
+	 * Set flag to collect errors. If this flags is true, 
+	 * all errors in sets in state, or in saveToState are collected
+	 * for throw later.
+	 * 
+	 * @param collectErrors
+	 */
+	public void setCollectErrors(boolean collectErrors);
+
+	/**
+	 * Get information about if collect errors or launch it
+	 * when produce.
+	 * 
+	 * @return
+	 */
+	public boolean getCollectErrors();
+
+	/**
+	 * Validate al statetes en the context.
+	 */
+	public void validate(int mode) throws PersistenceValidateExceptions;
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/spi/PersistentContextServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceFactory.java	(revision 1235)
@@ -0,0 +1,233 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence;
+
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * <p>
+ * Interface for factories of objects that no implements {@link Persistent} and
+ * must be supported by {@link PersistenceManager}.
+ * </p>
+ *
+ * <p>
+ * This can be used when the objects to persist can't be created by empty
+ * constructor.
+ *</p>
+ *
+ * @author jmvivo
+ */
+public interface PersistenceFactory {
+
+//	/**
+//	 * <p>
+//	 * Create a instance of <code>classToUse</code> from <code>state</code>
+//	 * data.
+//	 * </p>
+//	 * <p>
+//	 * <b>Note:</b>If possible, this method should only create the object 
+//	 * instance and set the object properties in the
+//	 * {@link #loadFromState(PersistentState, Object)} method, as it will
+//	 * be called afterwards.
+//	 * </p>
+//	 *
+//	 *
+//	 * @param state
+//	 * @param classToUse
+//	 * @return new instante of <code>classToUse</code>
+//	 * @deprecated use instead {@link #createFromState(PersistentState)} 
+//	 */
+//	public Object createFromState(PersistentState state, Class classToUse)
+//	throws PersistenceException;
+
+	/**
+	 * Create an instance of the object represented by the state.
+	 * 
+	 * This method can't call {@link #loadFromState(PersistentState, Object)} only create 
+	 * the object. 
+	 * 
+	 * @param state
+	 * @return the object
+	 */
+	public Object createFromState(PersistentState state)	throws PersistenceException;
+
+	
+	/**
+	 * Load a instance of <code>classToUse</code> from <code>state</code> data.
+	 *
+	 * @param state
+	 * @param object
+	 */
+	public void loadFromState(PersistentState state, Object object)
+			throws PersistenceException;
+
+	/**
+	 * Fill <code>state</code> with data to persist of <code>obj</code>.
+	 * 
+	 * @param state
+	 * @param obj
+	 * @throws PersistenceException
+	 */
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException;
+
+	/**
+	 * Informs if <code>object</code> is managed by this factory.
+	 *
+	 * @param object
+	 * @return true if the object is managed by the factory.
+	 */
+	public boolean manages(Object object);
+
+	/**
+	 * Informs if <code>theClass</code> is managed by this factory.
+	 *
+	 * @param class to check.
+	 * @return true if the class is managed by the factory.
+	 */
+	public boolean manages(Class theClass);
+
+	/**
+	 * Informs if this factory can recreate the object represented by
+	 * <code>state</code>.
+	 *
+	 * @param object
+	 * @return
+	 */
+	public boolean manages(PersistentState state);
+
+	/**
+	 * Return a List of the definition managed by this factory where the key is
+	 * <code>className</code> and value is <code>definition</code>
+	 *
+	 * @return Map<String, DynStruct>
+	 */
+	public List getDefinitions();
+		
+	/**
+	 * Returns the associated definition to the java class name
+	 * @param className of a java Class
+	 * @return the related definition or null if not managed by this factory
+	 */
+	public DynStruct getDefinition(String className);
+	
+	/**
+	 * Returns the domain name of the objects persisted by this factory.
+	 * @return the domain name
+	 */
+	public String getDomainName();
+	
+	/**
+	 * Returns the domain URL to use for the schema.
+	 * @return the domain URL
+	 */
+	public String getDomainURL();
+	
+	/**
+	 * Return the list of classes or interfaces managed by this
+	 * factory. 
+	 * Can return null if factory not use it.
+	 * 
+	 * @return List of interfaces the factory manage
+	 */
+	public List getManagedClasses();
+	
+	/**
+	 * Return the class or interface the factory asociate to
+	 * the object.
+	 * Can return null if factory not asociate an interface to
+	 * the object.
+	 * 
+	 * @param object
+	 * @return interface the factory manage asociated to the object.
+	 */
+	public Class getManagedClass(Object object);
+	
+	/**
+	 * Return the name class or interface the factory asociate to
+	 * the object.
+	 * Can return null if factory not asociate an interface to
+	 * the object.
+	 * 
+	 * @param object
+	 * @return interface the factory manage asociated to the object.
+	 */
+	public String getManagedClassName(Object object);
+
+	/**
+	 * Return the class or interface the factory asociate to
+	 * the object.
+	 * Can return null if factory not asociate an interface to
+	 * the object.
+	 * 
+	 * @param state
+	 * @return interface or class  the factory manage asociated to the state.
+	 */
+	public Class getManagedClass(PersistentState state);
+
+	/**
+	 * Return the class or interface the factory asociate to
+	 * the java class name.
+	 * Can return null if factory not asociate an interface to
+	 * that name.
+	 * 
+	 * @param name
+	 * @return interface or class the factory manage asociated to the name.
+	 */
+	public Class getManagedClass(String name);
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/AddDefinitionException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/AddDefinitionException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/AddDefinitionException.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+
+public class AddDefinitionException extends PersistenceRuntimeException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2173459987313661011L;
+	private final static String MESSAGE_FORMAT = "Can't add definition to persistence manager.";
+	private final static String MESSAGE_KEY = "_AddDefinitionException";
+
+	public AddDefinitionException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+	
+	protected AddDefinitionException(String message, String key, long code) {
+		super(message, key, code);
+	}
+	
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/AddDefinitionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceValidateExceptions.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceValidateExceptions.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceValidateExceptions.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.tools.persistence.exception;
+
+import java.util.List;
+
+/**
+ * @author jmvivo
+ * 
+ */
+public class PersistenceValidateExceptions extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 3418942854055550877L;
+
+	public PersistenceValidateExceptions(String name) {
+		super("Errors found validating '%(name)'.",
+				"_errors_found_validating_XnameX", serialVersionUID);
+		this.setValue("name", name);
+	}
+
+	public PersistenceValidateExceptions(String name, List exceptions) {
+		this(name);
+		this.addAll(exceptions);
+	}
+
+	public PersistenceValidateExceptions(List exceptions) {
+		super("Errors found validating persistent state.",
+				"_errors_found_validating_persistent_state", serialVersionUID);
+		this.addAll(exceptions);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceValidateExceptions.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/DuplicatePersistentDefinitionException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/DuplicatePersistentDefinitionException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/DuplicatePersistentDefinitionException.java	(revision 1235)
@@ -0,0 +1,41 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+
+public class DuplicatePersistentDefinitionException extends AddDefinitionException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1602874498275832708L;
+	private final static String MESSAGE_FORMAT = "Duplicated name (%(name)s) in definition for persistence.";
+	private final static String MESSAGE_KEY = "_DuplicatePersistentDefinitionException";
+
+	public DuplicatePersistentDefinitionException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name",name);
+	}
+	
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/DuplicatePersistentDefinitionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceException.java	(revision 1235)
@@ -0,0 +1,62 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+import org.gvsig.tools.exception.ListBaseException;
+
+public class PersistenceException extends ListBaseException {
+	private static final long serialVersionUID = -3729654883985281840L;
+	private final static String MESSAGE_FORMAT = "Error getting or setting the state of an object.";
+	private final static String MESSAGE_KEY = "_error_getting_or_setting_the_state_of_an_object";
+
+	/**
+	 * 
+	 * @param messageFormat
+	 * @deprecated No debe usarse este constructor, si lo necesitas, seguramente tendrias que 
+	 *                          crear una excepcion mas concreta que deribe de esta.
+	 */
+	public PersistenceException(String messageFormat) {
+		super(messageFormat, MESSAGE_KEY, serialVersionUID);
+	}
+
+	public PersistenceException(Throwable cause) {
+		this(MESSAGE_FORMAT, cause);
+	}
+
+	public PersistenceException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+
+	protected PersistenceException(String messageFormat, String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+	}
+	
+	protected PersistenceException(String messageFormat, Throwable cause, String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public PersistenceException(String messageFormat, Throwable cause) {
+		super(messageFormat, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceIdentifierException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceIdentifierException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceIdentifierException.java	(revision 1235)
@@ -0,0 +1,52 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class PersistenceIdentifierException extends PersistenceException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 7471132922648901248L;
+	private final static String MESSAGE_FORMAT = "Invalid persistence identifier %(id)'.";
+	private final static String MESSAGE_KEY = "_PersistenceIdentifierException";
+
+	private Object id;
+
+	public PersistenceIdentifierException(Object id){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.id = id;
+	}
+
+	public Object getId() {
+		return this.id;
+	}
+
+   protected Map values() {
+		return Collections.singletonMap("id", id.toString());
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceIdentifierException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/FieldNotDeclaredException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/FieldNotDeclaredException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/FieldNotDeclaredException.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class FieldNotDeclaredException extends PersistenceException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2004462745021928700L;
+	private final static String MESSAGE_FORMAT = "Field '%(field) not declared for class %(class)'.";
+	private final static String MESSAGE_KEY = "_PersistenceClassNotRegistered";
+	private String fieldName;
+	private String theClass;
+
+	public FieldNotDeclaredException(String fieldName, Class theClass) {
+		this(fieldName, theClass.getName());
+	}
+
+	public FieldNotDeclaredException(String fieldName, String theClass){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.theClass = theClass;
+		this.fieldName = fieldName;
+	}
+
+   protected Map values() {
+	   Map values = new HashMap();
+	   values.put("class", this.theClass);
+	   values.put("field", this.fieldName);
+	   return values;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/FieldNotDeclaredException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceCreateException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceCreateException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceCreateException.java	(revision 1235)
@@ -0,0 +1,70 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+import java.lang.reflect.Constructor;
+
+public class PersistenceCreateException extends PersistenceRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1173336779528392650L;
+	private final static String MESSAGE_FORMAT1 = "Can't create new instance of '%(class)'.";
+	private final static String MESSAGE_FORMAT2 = "Can't create new instance of '%(class)', need a public contructor without arguments.";
+	private final static String MESSAGE_KEY = "_PersistenceCreateException";
+
+	public PersistenceCreateException(Class theClass, Throwable cause) {
+		super(MESSAGE_FORMAT1, cause, MESSAGE_KEY, serialVersionUID);
+		if( theClass == null ) {
+			this.setValue("class", "UNKNOW");
+		} else {
+			this.setValue("class", theClass.getName());
+			if( cause instanceof InstantiationException ) {
+				boolean needEmptyConstructor = true;
+				Constructor[] constructors = theClass.getConstructors();
+				for( int  i=0; i<constructors.length; i++ ) {
+					Constructor constructor = constructors[i];
+					Class[] parameters = constructor.getParameterTypes();
+					if( parameters.length == 0) {
+						needEmptyConstructor = false;
+					}
+				}
+				if( needEmptyConstructor ) {
+					this.setFormatString(MESSAGE_FORMAT2);
+				}
+			}
+		}
+	}
+
+	public PersistenceCreateException(String theClass, Throwable cause) {
+		super(MESSAGE_FORMAT1, cause, MESSAGE_KEY, serialVersionUID);
+		if( theClass == null ) {
+			this.setValue("class", "UNKNOW");
+		} else {
+			this.setValue("class", theClass);
+		}
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceCreateException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceRuntimeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceRuntimeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceRuntimeException.java	(revision 1235)
@@ -0,0 +1,85 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.exception;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+/**
+ * @author jjdelcerro
+ *
+ */
+public class PersistenceRuntimeException extends BaseRuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4841603992914665115L;
+
+
+	public PersistenceRuntimeException(BaseException exception) {
+		super(exception);
+	}
+
+ 	protected PersistenceRuntimeException(String message, String key, long code) {
+ 		// Don't make public this method.
+		super(message, key, code);
+	}
+
+	protected PersistenceRuntimeException(String message, Throwable cause, String key, long code) {
+ 		// Don't make public this method.
+		super(message, cause, key, code);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceClassNotRegistered.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceClassNotRegistered.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceClassNotRegistered.java	(revision 1235)
@@ -0,0 +1,80 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.exception;
+
+
+/**
+ * @author jmvivo
+ *
+ */
+public class PersistenceClassNotRegistered extends PersistenceException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -5117203477405844983L;
+	private final static String MESSAGE_FORMAT = "Class not registered in manager '%(class)'.";
+	private final static String MESSAGE_KEY = "_PersistenceClassNotRegistered";
+
+	public PersistenceClassNotRegistered(Class theClass) {
+		this(theClass.getName());
+	}
+
+	public PersistenceClassNotRegistered(String theClass){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("class", theClass);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceClassNotRegistered.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceWriteExeption.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceWriteExeption.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceWriteExeption.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+
+public class PersistenceWriteExeption extends PersistenceRuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6059143552335997976L;
+	private final static String MESSAGE_FORMAT1 = "Can't write object.";
+	private final static String MESSAGE_KEY = "_Cant_write_object";
+
+	public PersistenceWriteExeption(Throwable cause) {
+		super(MESSAGE_FORMAT1, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceWriteExeption.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceTypeNotSupportedException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceTypeNotSupportedException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceTypeNotSupportedException.java	(revision 1235)
@@ -0,0 +1,85 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.exception;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+
+
+public class PersistenceTypeNotSupportedException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4330166940284544121L;
+	private final static String MESSAGE_FORMAT = "Can't persist '%(className)' values of attribute '%(attributeName)'.";
+	private final static String MESSAGE_KEY = "_PersistenceTypeNotSupportedException";
+
+	public static final String UNKNOW_ATTRIBUTE = "_unknow_";
+	private String className;
+	private String attributeName;
+	private Map values;
+
+	public PersistenceTypeNotSupportedException(Class theClass) {
+		this(theClass.getName());
+	}
+	public PersistenceTypeNotSupportedException(String className) {
+		this(className, UNKNOW_ATTRIBUTE);
+	}
+
+	public PersistenceTypeNotSupportedException(Class theClass,
+			String attributeName) {
+		this(theClass.getName(), attributeName);
+	}
+
+	public PersistenceTypeNotSupportedException(String className,
+			String attributeName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.className = className;
+		if( attributeName == null ) {
+			this.attributeName = UNKNOW_ATTRIBUTE;
+		}else {
+			this.attributeName = attributeName;
+		}
+	}
+
+	public void setAttributeName(String attributeName) {
+		if (UNKNOW_ATTRIBUTE.equals(this.attributeName)) {
+			this.attributeName = attributeName;
+			this.values = null;
+		}
+	}
+
+    protected Map values() {
+    	if (values == null) {
+			Map values = new TreeMap();
+			values.put("className", className);
+			values.put("attributeName", attributeName);
+			this.values = Collections.unmodifiableMap(values);
+		}
+		return values;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/exception/PersistenceTypeNotSupportedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceManager.java	(revision 1235)
@@ -0,0 +1,558 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.AddDefinitionException;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceCreateException;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+/**
+ * <p>
+ * This interface contains the necessary methods to get a persistent
+ * representation of an object, suitable for storage or transmission, and to
+ * create a an object from its persistent representation.
+ * </p>
+ * 
+ * @author The gvSIG project <http://www.gvsig.org>
+ * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
+ * @author IVER T.I. <http://www.iver.es>
+ */
+public interface PersistenceManager {
+
+	public interface Factories extends List {
+
+		/**
+		 * Add a new factory to the list registering an alias.
+		 * 
+		 * If factory already registered anly add the alias.
+		 * 
+		 * @param factory
+		 * @param classNameAlias
+		 * @return true when ok.
+		 */
+		public boolean add(PersistenceFactory factory, String classNameAlias);
+
+		/**
+		 * Add a new class to the factory.
+		 * 
+		 * @param factory
+		 * @return true when ok
+		 */
+		public boolean add(PersistenceFactory factory);
+
+		/**
+		 * Return factory associated to class passed as parameter.
+		 * 
+		 * @param class name
+		 * 
+		 * @return Persistence factory that manage the class
+		 */
+		public abstract PersistenceFactory get(Class theClass);
+
+		/**
+		 * Return factory associated to the object passed as parameter.
+		 * 
+		 * @param object
+		 * 
+		 * @return Persistence factory that manage object
+		 */
+		public PersistenceFactory get(Object object);
+
+		/**
+		 * Return factory associated to the object stored in the state.
+		 * 
+		 * @param state
+		 * 
+		 * @return Persistence factory that manage the state
+		 */
+		public PersistenceFactory get(PersistentState state);
+
+	}
+
+	/**
+	 * The namespace used on the definition of DynClasses used by the
+	 * persistence manager.
+	 */
+	public static final String PERSISTENCE_NAMESPACE = "Persistence";
+	public static final String PERSISTENCE_DYNOBJECT_NAMESPACE = "PersistenceDynObject";
+	public static final String DEFAULT_DOMAIN_URL = "http://www.gvsig.org";
+	public static final String DEFAULT_DOMAIN_NAME = "gvsig";
+
+	/**
+	 * <p>
+	 * Validation Mode -- MANDATORY: Validation is active, so
+	 * {@link PersistenceManager#create(org.gvsig.tools.persistence.PersistentState)}
+	 * and {@link PersistenceManager#getState(Object)} will throw validation
+	 * exceptions if validation errors are found.
+	 * </p>
+	 * <p>
+	 * If an undeclared attribute or class is found, this will be considered a
+	 * validation error.
+	 * </p>
+	 */
+	static public final int MANDATORY = 3;
+	/**
+	 * <p>
+	 * Validation Mode -- MANDATORY_IF_DECLARED: Validation is active, but it
+	 * will be only applied to Persistent objects which have been registered.
+	 * {@link PersistenceManager#create(org.gvsig.tools.persistence.PersistentState)}
+	 * and {@link PersistenceManager#getState(Object)} methods will throw
+	 * validation exceptions if validation errors are found.
+	 * </p>
+	 */
+	static public final int MANDATORY_IF_DECLARED = 2;
+	/**
+	 * <p>
+	 * Validation Mode - DISABLED: No validation is performed at all. In this
+	 * mode, {@link PersistenceManager#ge}
+	 * </p>
+	 */
+	static public final int DISABLED = 0;
+
+	/**
+	 * <p>
+	 * Creates a persistent state from an Persistent object.
+	 * </p>
+	 * 
+	 * @param obj
+	 *            The Persistent object to be persisted
+	 * 
+	 * @return A PersistentState object, which stores the state of the provided
+	 *         Persistent Object.
+	 * @throws PersistenceException
+	 */
+	public PersistentState getState(Object obj) throws PersistenceException;
+
+	/**
+	 * Creates a persistent state from an Persistent object.
+	 *
+	 * When collectAllErrors is true, try to continue when an error
+	 * is detected, and raise all errors when finish the process.
+	 * 
+	 * @param obj
+	 * @param collectAllErrors
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public PersistentState getState(Object obj, boolean collectAllErrors) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Instantiates an object from a persistent state. The PersistentState
+	 * object knows the class of the persisted object, and instantiates it by
+	 * using introspection. The object must implement the Persistent interface
+	 * so that it can understand the PersistentState.
+	 * </p>
+	 * 
+	 * @param state
+	 *            The state of the object to be instantiated
+	 * @return A new object whose state is the same as the provided
+	 *         <code>state</code> object.
+	 * 
+	 * @throws PersistenceException
+	 * @throws PersistenceCreateException
+	 */
+	public Object create(PersistentState state) throws PersistenceException,
+			PersistenceCreateException;
+
+	/**
+	 * <p>
+	 * Associates an alias with a class. This is similar to a symbolic link,
+	 * which allows to access the class by means of its alias.
+	 * </p>
+	 * 
+	 * <p>
+	 * When an alias is defined, it replaces any class whose qualified name is
+	 * equal to the alias. Therefore, this class will never be instantiated, and
+	 * instead the class pointed by the the alias will be instantiated.
+	 * </p>
+	 * 
+	 * <p>
+	 * For example, if the following alias is defined:
+	 * </p>
+	 * 
+	 * <pre>
+	 * Class aClass = org.gvsig.fmap.mapcontext.rendering.symbols.SimpleMarkerSymbol.class;
+	 * manager.addAlias(
+	 * 		&quot;org.gvsig.fmap.mapcontext.rendering.symbols.ArrowMarkerSymbol&quot;, aClass);
+	 * </pre>
+	 * <p>
+	 * then, SimpleMarkerSymbol will be instantiated instead of
+	 * ArrowMarkerSymbol from any PersistentState which references
+	 * ArrowMarkerSymbol.
+	 * </p>
+	 * 
+	 * <p>
+	 * Aliases are useful to provided backward-compatibility paths (as old no
+	 * existing classes may be aliased to substitution classes), but are also
+	 * useful to avoid limitations on ClassLoaders. As a Class object is
+	 * provided, it will be possible to instantiate it even if the current
+	 * ClassLoader has no direct visibility of the class to instantiate.
+	 * </p>
+	 * 
+	 * @param alias
+	 *            The alias to reference a class
+	 * @param aClass
+	 *            The class to be referenced by the alias
+	 * 
+	 * @throws PersistenceClassNotRegistered
+	 *             if <code>aClass</code> is not registered
+	 */
+	public void addAlias(String alias, Class theClass)
+			throws PersistenceClassNotRegistered;
+
+	/**
+	 * Add a new definition to the class in the persistent manager.
+	 * 
+	 * The new definition is defined in the namespace by default for DynClasses
+	 * used in persistence.
+	 * 
+	 * if domainName or domainURL are null, values by default arent supplied by
+	 * the manager.
+	 * 
+	 * <b>Note:</b> A <code>domainName</code> can by in only one
+	 * <code>domainURL</code>. If you try to register the same
+	 * <code>domainName</code> with two URL an exception will be raised. </p>
+	 * 
+	 * @param persistentClass
+	 * @param name
+	 *            of the new definition
+	 * @param description
+	 *            of the new definition, can be null.
+	 * @param domainName
+	 *            , can be null.
+	 * @param domainURL
+	 *            , can be null.
+	 * @return the new definition
+	 */
+	public DynStruct addDefinition(Class persistentClass, String name,
+			String description, String domainName, String domainURL)
+			throws AddDefinitionException;
+
+	
+	/**
+	 * Add a new definition to the class in the persistent manager.
+	 * 
+	 * @param theClass
+	 *            to be persistent
+	 * @param name
+	 *            of the class definition to associate to theClass
+	 * @param definitions
+	 *            input stream from load the definitions of classes
+	 * @param loader
+	 *            , loader to resolve references to classes
+	 * @param domainName
+	 *            (can be null)
+	 * @param domainUrl
+	 *            (can be null)
+	 * @return
+	 * 
+	 * @see #addDefinition(Class, String, String, String, String)
+	 */
+	public DynStruct addDefinition(Class theClass, String name,
+			InputStream definitions, ClassLoader loader, String domainName,
+			String domainUrl) throws AddDefinitionException;
+
+	/**
+	 * Add a new definition to the class in the persistent manager.
+	 * 
+	 * @param theClass
+	 *            to be persistent
+	 * @param name
+	 *            of the class definition to associate to theClass
+	 * @param definitions
+	 *            , map from get the definition of the class
+	 * @param domainName
+	 *            (can be null)
+	 * @param domainUrl
+	 *            (can be null)
+	 * @return
+	 * 
+	 * @see #addDefinition(Class, String, String, String, String)
+	 */
+	public DynStruct addDefinition(Class theClass, String name,
+			Map definitions, String domainName, String domainUrl)
+			throws AddDefinitionException;
+
+	/**
+	 * Add a new definition to the class in the persistent manager.
+	 * 
+	 * @param definition
+	 *            , TODO
+	 * @param domainName
+	 *            (can be null)
+	 * @param domainUrl
+	 *            (can be null)
+	 * @return
+	 * 
+	 * @see #addDefinition(Class, String, String, String, String)
+	 */
+	public DynStruct addDefinition(DynStruct definition, String domainName,
+			String domainUrl)
+			throws AddDefinitionException;
+
+	/**
+	 * <p>
+	 * Register an instance of {@link PersistenceFactory} that can manage some
+	 * objects that requires an especial construction or persistence. This
+	 * factory will use the default domain name and URL.
+	 * </p>
+	 * 
+	 * 
+	 * @param factory
+	 */
+	public void registerFactory(PersistenceFactory factory);
+
+	public void unregisterFactory(PersistenceFactory factory);
+
+	/**
+	 * <p>
+	 * Unregister a registered class from the manager.
+	 * </p>
+	 * 
+	 * @param persistentClass
+	 * 
+	 * @see #registerClass(Class, DynStruct, String)
+	 * 
+	 * @throws PersistenceClassNotRegistered
+	 *             if <code>persistentClass</code> is not registered
+	 */
+	public void unregisterClass(Class theClass)
+			throws PersistenceClassNotRegistered;
+
+	/**
+	 * <p>
+	 * Unregister a registered java class from the manager.
+	 * </p>
+	 * 
+	 * @param className the java class name to unregister
+	 * 
+	 * @see #registerClass(Class)
+	 * 
+	 * @throws PersistenceClassNotRegistered
+	 *             if <code>className</code> is not registered
+	 */
+	public void unregisterClass(String className)
+			throws PersistenceClassNotRegistered;
+
+	/**
+	 * <p>
+	 * Validates persistent state by using the corresponding registered
+	 * attribute definition. <code>mode</code> specifies what to do when a
+	 * definition of a state class is not registered.
+	 * </p>
+	 * 
+	 * @param state
+	 * @param mode
+	 * @throws PersistenceValidateExceptions
+	 * 
+	 */
+	public void validate(PersistentState state, int mode)
+			throws PersistenceValidateExceptions;
+
+	/**
+	 * <p>
+	 * Validates all persistent state related to the <code>state</code> by using
+	 * the corresponding registered attribute definition. <code>mode</code>
+	 * specifies what to do when a definition of a state class is not
+	 * registered.
+	 * </p>
+	 * 
+	 * @param state
+	 * @param mode
+	 * 
+	 * @throws PersistenceValidateExceptions
+	 * 
+	 * @see {@link #setAutoValidation(int)}
+	 * 
+	 */
+	public void validateAll(PersistentState state, int mode)
+			throws PersistenceValidateExceptions;
+
+	/**
+	 * <p>
+	 * If the provided persistent class has registered an attribute definition
+	 * in this manager, then this method returns that definition. Otherwise, it
+	 * returns null.
+	 * </p>
+	 * 
+	 * @param persistentClass
+	 *            The class whose corresponding attribute definition is to be
+	 *            retrieved.
+	 * 
+	 * @return The attribute definition corresponding to the provided persistent
+	 *         class, or null otherwise.
+	 */
+	public DynStruct getDefinition(Class persistentClass);
+
+	/**
+	 * <p>
+	 * Return the associated definition to the java class name passed as parameter.
+	 * </p>
+	 * 
+	 * @param name of the java class to retrieve definition
+	 * 
+	 * @return The attribute definition corresponding to the provided java
+	 *         class, or null otherwise.
+	 */
+	public DynStruct getDefinition(String name);
+
+	/**
+	 * <p>
+	 * Return the associated definition to the dynClass name passed as parameter.
+	 * </p>
+	 * 
+	 * @param name of the dynClass to retrieve definition
+	 * 
+	 * @return The attribute definition corresponding to the provided dynClass, or null otherwise.
+	 */
+	public DynStruct getDynObjectDefinition(String className);
+
+	/**
+	 * <p>
+	 * De-serializes an state from the data read from the provided
+	 * <code>reader</code>. Depending on the implementation the serialized data
+	 * may have different formats, such as XML or binary data.
+	 * </p>
+	 * 
+	 * <p>
+	 * Note that a particular implementation will only be able to de-serialize
+	 * data which has been serialized by the same implementation.
+	 * </p>
+	 * 
+	 * @param reader
+	 * @return
+	 */
+	public PersistentState loadState(InputStream in)
+			throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Serializes the {@link PersistentState} and writes the serialized data in
+	 * the provided {@link OutputStream}. Depending on the implementation the
+	 * serialized data may have different formats, such as XML or binary data.
+	 * </p>
+	 * 
+	 * <p>
+	 * Note that a particular implementation will only be able to de-serialize
+	 * data which has been serialized by the same implementation.
+	 * </p>
+	 * 
+	 * @param out
+	 * @return
+	 * @throws PersistenceValidateExceptions
+	 */
+	public void saveState(PersistentState state, OutputStream out)
+			throws PersistenceException, PersistenceValidateExceptions;
+
+	/**
+	 * <p>
+	 * De-serializes an state from the data read from the provided
+	 * <code>is</code>. Depending on the implementation the serialized data
+	 * may have different formats, such as XML or binary data.
+	 * </p>
+	 * 
+	 * <p>
+	 * Note that a particular implementation will only be able to de-serialize
+	 * data which has been serialized by the same implementation.
+	 * </p>
+	 * 
+	 * @param reader
+	 * @return
+	 * 
+	 * @param is
+	 * @return
+	 */
+	public Object getObject(InputStream is);
+	
+	/**
+	 * <p>
+	 * Serializes the object "obj" and writes the serialized data in
+	 * the provided {@link OutputStream}. Depending on the implementation the
+	 * serialized data may have different formats, such as XML or binary data.
+	 * </p>
+	 * 
+	 * <p>
+	 * Note that a particular implementation will only be able to de-serialize
+	 * data which has been serialized by the same implementation.
+	 * </p>
+	 * 
+	 * @param os
+	 * @param obj
+	 */
+	public void putObject(OutputStream os, Object obj);
+	
+	/**
+	 * <p>
+	 * Sets the validation which will be applied in {@link #getState(Object)},
+	 * {@link #create(PersistentState)} methods. Validation ensures that
+	 * persisted or de-persisted objects match the declared definition (which
+	 * must have been previously registered by using
+	 * {@link #registerClass(Class, DynStruct)}).
+	 * </p>
+	 * 
+	 * <p>
+	 * When automatic validation is enabled (MANDATORY or
+	 * MANDATORY_IF_DECLARED), a ValidationException will be thrown by
+	 * {@link #getState(Object)}, {@link #create(PersistentState)} if a
+	 * validation error is found.
+	 * </p>
+	 * 
+	 * @param validationMode
+	 *            On of the following values: {@link #DISABLED},
+	 *            {@link #MANDATORY} or {@link #MANDATORY_IF_DECLARED}
+	 * 
+	 * @see #validateAll(PersistentState)
+	 * @see #registerClass(Class, DynStruct)
+	 * 
+	 * @throws PersistenceException
+	 *             If the mode is not supported by this manager
+	 */
+	public void setAutoValidation(int validationMode)
+			throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Gets the validation which will be applied in {@link #getState(Object)},
+	 * {@link #create(PersistentState)} methods.
+	 * 
+	 * @return The current mode for automatic validation: {@link #DISABLED},
+	 *         {@link #MANDATORY} or {@link #MANDATORY_IF_DECLARED}
+	 * 
+	 * @see #validateAll(PersistentState)
+	 * @see #registerClass(Class, DynStruct)
+	 */
+	public int getAutoValidation();
+
+	public Factories getFactories();
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/Persistent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/Persistent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/Persistent.java	(revision 1235)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+public interface Persistent {
+
+	/**
+	 * Saves the internal state of the object on the provided
+	 * PersistentState object.
+	 * 
+	 * @param state
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException;
+
+	/**
+	 * Set the state of the object from the state passed as parameter.
+	 *
+	 * @param state
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException;
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/Persistent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceLibrary.java	(revision 1235)
@@ -0,0 +1,81 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class XMLPersistenceLibrary extends AbstractLibrary {
+
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsAPI(XMLPersistenceLibrary.class);
+		require(ToolsLibrary.class);
+	}
+	
+	protected void doInitialize() throws LibraryException {
+		ToolsLocator.registerPersistenceManager(ZipXMLPersistenceManager.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		// do nothing
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentConstants.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentConstants.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentConstants.java	(revision 1235)
@@ -0,0 +1,404 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+package org.gvsig.tools.persistence.xml;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public interface XMLPersistentConstants {
+
+	/**
+	 * XML Header fomat.<br>
+	 * Parameters:
+	 *  <ol>
+	 *  	<li>encoding</li>
+	 *  </ol>
+	 */
+	public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"{0}\"?>";
+
+	// Indentations
+	/**
+	 * Indentation string
+	 */
+	public static final String INDENDT_1 = "  ";
+	/**
+	 * Indentation string
+	 */
+	public static final String INDENDT_2 = "    ";
+	/**
+	 * Indentation string
+	 */
+	public static final String INDENDT_3 = "      ";
+	/**
+	 * Indentation string
+	 */
+	public static final String INDENDT_4 = "        ";
+
+
+
+	// XML ROOT ITEM
+	/**
+	 * XML Root item tag name
+	 */
+	public static final String ROOT_TAG = "XMLPersitence";
+
+	/**
+	 * XML Root item format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>domain notation (Ej. 'tools:')</li>
+	 * <li>additional definitions</li>
+	 * </ol>
+	 */
+	public static final String ROOT_VALUE = "<{0}" + ROOT_TAG
+			+ " xmlns:xlink=\"http://www.w3.org/1999/xlink\" {1}>";
+
+	public static final String BASE_DOMIAN_URL = "http://www.gvsig.org/libTools";
+	public static final String BASE_DOMIAN_NAME = "tools";
+
+	/**
+	 * Schema File name format. <br>
+	 * Parameters:
+	 * <ol>
+	 * <li>schema name</li>
+	 * </ol>
+	 *
+	 */
+	public static final String SCHEMA_FILE_NAME_VALUE = "{0}.xsd";
+
+	/**
+	 * Schema definition format<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>domain URL</li>
+	 * <li>domain name</li>
+	 * </ol>
+	 */
+	public static final String SCHEMA_DEFINITON_VALUE = "{0} {1}.xsd \n";
+
+	/**
+	 * SCHEMA attribute for ROOT tag.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>Schema definition list</li>
+	 * </ol>
+	 */
+	public static final String DEFAULT_SCHEMA_ATTRIBUTE_VALUE = INDENDT_3
+			+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+			+ "xsi:SchemaLocation=\"{0}\"";
+
+
+	/**
+	 * domain Name definition format. Parameters:
+	 * <ol>
+	 * <li>domain name</li>
+	 * <li>domain URL</li>
+	 * </ol>
+	 */
+	public static final String DOMAIN_NAME_ATTRIBUTE_VALUE = INDENDT_3
+			+ "xmlns:{0}=\"{1}\"";
+
+	/**
+	 * XML Root item end.<br>
+	 * <ol>
+	 * <li>domain definition (Ej.: "tools:")</li>
+	 * </ol>
+	 */
+	public static final String ROOT_END_VALUE = "</{0}" + ROOT_TAG + ">";
+
+
+	// Version definition
+	/**
+	 * Persistence library version tag name
+	 */
+	public static final String VERSION_TAG = "persistence_xml_version";
+	/**
+	 * Persistence library version item format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>id root state</li>
+	 * </ol>
+	 */
+	public static final String VERSION_VALUE = "<" + VERSION_TAG + ">{0}</"
+			+ VERSION_TAG + ">";
+
+
+	// Root state item definition
+	/**
+	 * Root state tag name
+	 */
+	public static final String ROOTSTATE_TAG = "rootState";
+
+	/**
+	 * Root state id attribute name
+	 */
+	public static final String ROOSTATE_ID_ATTR = "id_state";
+
+	/**
+	 * States tag name
+	 */
+	public static final String STATES_TAG = "states";
+
+	/**
+	 * Root state item format.<br>
+	 * Parameters:
+	 *  <ol>
+	 *  	<li>id root state</li>
+	 *  </ol>
+	 */
+	public static final String ROOTSTATE_VALUE = INDENDT_1 + "<"
+			+ ROOTSTATE_TAG + " " + ROOSTATE_ID_ATTR
+			+ "=\"{0}\" xlink:type=\"simple\""
+			+ " xlink:href=\"" + STATES_TAG
+			+ "#id(''{0}'')\" />";
+
+
+
+
+	// State item definition
+
+	/**
+	 * States item start
+	 */
+	public static final String STATES_START = "<" + STATES_TAG + ">";
+	/**
+	 * States item end
+	 */
+	public static final String STATES_END = "</" + STATES_TAG + ">";
+
+	/**
+	 * State id attribute name
+	 */
+	public static final String STATE_ID_ATTR = "id";
+
+	/**
+	 * State item start format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>domain prefix (ex: 'aDomain:')</li>
+	 * <li>theClassName</li>
+	 * <li>id state</li>
+	 * </ol>
+	 */
+	public static final String STATE_START = INDENDT_1 + "<{0}{1} "
+			+ STATE_ID_ATTR + "=\"{2}\">";
+
+	/**
+	 * State item end format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>domain prefix (ex: 'aDomain:')</li>
+	 * <li>theClassName</li>
+	 * <li>id state</li>
+	 * </ol>
+	 */
+	public static final String STATE_END = INDENDT_1 + "</{0}{1}>";
+
+
+
+	// Value item definition
+	/**
+	 * Value item tag name for generic (when name of value is not a valid xml
+	 * tag name)
+	 */
+	public static final String VALUE_TAG = "value";
+	/**
+	 * type attribute name for value item
+	 */
+	public static final String VALUE_TYPE_ATTR = "type";
+	/**
+	 * name item tag name of Value item for generic (when name of value is
+	 * not a valid xml tag name)
+	 */
+	public static final String NAMEVALUE_TAG = "name";
+	/**
+	 * data item tag name of Value item for generic (when name of value is
+	 * not a valid xml tag name)
+	 */
+	public static final String DATAVALUE_TAG = "data";
+	/**
+	 * Value format.<br>
+	 * Parameters:
+	 *  <ol>
+	 *  	<li>name</li>
+	 *  	<li>typeName</li>
+	 *      <li>string representation of data</li>
+	 *  </ol>
+	 */
+	public static final String VALUE_ITEM = INDENDT_2
+			+ "<{0} "
+			+ VALUE_TYPE_ATTR + "=\"{1}\">{2}</{0}>";
+	/**
+	 * Value format for generic (when name of value is
+	 * not a valid xml tag name).<br>
+	 * Parameters:
+	 *  <ol>
+	 *  	<li>name</li>
+	 *  	<li>typeName</li>
+	 *      <li>string representation of data</li>
+	 *  </ol>
+	 */
+	public static final String VALUE_ITEM_GENERIC = INDENDT_2 + "<" + VALUE_TAG
+			+ " " + VALUE_TYPE_ATTR + "=\"{1}\">\n" + INDENDT_3 + "<"
+			+ NAMEVALUE_TAG + ">{0}</"
+			+ NAMEVALUE_TAG + ">\n" + INDENDT_3 + "<" + DATAVALUE_TAG
+			+ ">{2}</" + DATAVALUE_TAG + ">\n" + INDENDT_2 + "</" + VALUE_TAG
+			+ ">";
+
+
+
+
+	// Final Value data formating
+	/**
+	 * reference item tag name of data of Value item for references values.
+	 */
+	public static final String REFERENCE_TAG = "reference";
+	/**
+	 * type attribute name for value item
+	 */
+	public static final String REFERENCE_ID_ATTR = "id_state";
+	/**
+	 * ReferenceValue format.<br>
+	 * Parameters:
+	 *  <ol>
+	 *  	<li>id reference</li>
+	 *  </ol>
+	 */
+	public static final String REFERENCE_VALUE = "\n" + INDENDT_4 + "<"
+			+ REFERENCE_TAG + " " + REFERENCE_ID_ATTR
+			+ "=\"{0}\" xlink:type=\"simple\""
+			+ " xlink:href=\"" + STATES_TAG
+			+ "#id(''{0}'')\" />";
+	/**
+	 * list item tag name of data of Value item for list values.
+	 */
+	public static final String LISTITEM_TAG = "item";
+	/**
+	 * List value item format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>typeName</li>
+	 * <li>string representation of data</li>
+	 * </ol>
+	 */
+	public static final String LISTITEM_VALUE = INDENDT_3 + "<"
+			+ LISTITEM_TAG
+			+ " " + VALUE_TYPE_ATTR + "=\"{0}\">{1}</" + LISTITEM_TAG + ">";
+	/**
+	 * set item tag name of data of Value item for list values.
+	 */
+	public static final String SETITEM_TAG = "item";
+	/**
+	 * Set value item format.<br>
+	 * Parameters:
+	 * <ol>
+	 * <li>typeName</li>
+	 * <li>string representation of data</li>
+	 * </ol>
+	 */
+	public static final String SETITEM_VALUE = INDENDT_3 + "<"
+			+ SETITEM_TAG
+			+ " " + VALUE_TYPE_ATTR + "=\"{0}\">{1}</" + SETITEM_TAG + ">";
+	/**
+	 * Map item tag name of data of Value item for list values.
+	 */
+	public static final String MAPITEM_TAG = "mapitem";
+	/**
+	 * Key Map item tag name of data of Value item for list values.
+	 */
+	public static final String MAPKEY_TAG = "key";
+	/**
+	 * Value Map item tag name of data of Value item for list values.
+	 */
+	public static final String MAPVALUE_TAG = "value";
+	/**
+	 * Map item format.<br>
+	 * Parameters:
+	 * <ol>
+	 * *
+	 * <li>key typeName</li>
+	 * <li>string representation of key</li>
+	 * <li>value typeName</li>
+	 * <li>string representation of value</li>
+	 * </ol>
+	 */
+	public static final String MAPITEM_VALUE = "\n" + INDENDT_3 + "<"
+			+ MAPITEM_TAG
+			+ ">\n" + INDENDT_4 + "<" + MAPKEY_TAG + " type=\"{0}\">{1}</"
+			+ MAPKEY_TAG + ">\n" + INDENDT_4 + "<" + MAPVALUE_TAG
+			+ " type=\"{2}\">{3}</"
+			+ MAPVALUE_TAG + ">\n" + INDENDT_3 + "</" + MAPITEM_TAG
+			+ ">\n";
+
+
+	public static final String TYPE_NULL = "null";
+	public static final String TYPE_STRING = "string";
+	public static final String TYPE_MAP = "map";
+	public static final String TYPE_SET = "set";
+	public static final String TYPE_LIST = "list";
+	public static final String TYPE_REFERENCE = "reference";
+	public static final String TYPE_BOOLEAN = "boolean";
+	public static final String TYPE_INTEGER = "integer";
+	public static final String TYPE_LONG = "long";
+	public static final String TYPE_FLOAT = "float";
+	public static final String TYPE_DOUBLE = "double";
+	public static final String TYPE_DATE = "date";
+	public static final String TYPE_FILE = "file";
+	public static final String TYPE_URL = "url";
+	public static final String TYPE_URI = "uri";
+	public static final List TYPES_NUMBER = Collections.unmodifiableList(Arrays
+			.asList(new String[] { TYPE_INTEGER, TYPE_LONG, TYPE_FLOAT,
+					TYPE_DOUBLE }));
+
+	// Validation patters of xml elements
+	/**
+	 * Pattern matches with valid xml item names (tag name)
+	 */
+	public static final Pattern VALID_TAG_PATTERN = Pattern
+			.compile("[\\w][\\d\\w_]*");
+	/**
+	 * Pattern matches with valid xml item text values (text content between tag)
+	 */
+	public static final Pattern VALID_VALUE_PATTERN = Pattern.compile("[^<&]*");
+
+
+	// CDATA constants
+	/**
+	 * CDATA element start
+	 */
+	public static final String CDATA_START = "<![CDATA[";
+	/**
+	 * CDATA element end
+	 */
+	public static final String CDATA_END = "]]>";
+
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentConstants.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceParserException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceParserException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceParserException.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceParserException extends PersistenceRuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6351418857699967957L;
+	private final static String MESSAGE_FORMAT = "Error parsing state. Last tag '%(tagname)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceParserException";
+	
+	protected  PersistenceParserException(XmlPullParser parser, String format, String key, long code) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		if( parser == null ) {
+			this.setValue("tagname", "(unknow)");
+			this.setValue("line", "(unknow)");
+			this.setValue("column", "(unknow)");
+		} else {
+			if( parser.getName() == null ) {
+				this.setValue("tagname", "(unknow)");				
+			} else {
+				this.setValue("tagname", parser.getName());
+			}
+			this.setValue("line", new Integer(parser.getLineNumber()));
+			this.setValue("column", new Integer( parser.getColumnNumber()));
+		}
+	}
+	
+	public PersistenceParserException(XmlPullParser parser, Throwable cause) {
+		this(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.initCause(cause);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceParserException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingAttributeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingAttributeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingAttributeException.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceMissingAttributeException extends
+		PersistenceParserException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -250292376190219948L;
+	private final static String MESSAGE_FORMAT = "Missing attribute '%(attrname)' in tag '%(tagname)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceMissingAttributeException";
+
+	public PersistenceMissingAttributeException(XmlPullParser parser, String attrname)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("attrname", attrname);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingAttributeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceInvalidValueException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceInvalidValueException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceInvalidValueException.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceInvalidValueException extends
+		PersistenceParserException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -8696696614119583094L;
+	private final static String MESSAGE_FORMAT = "Invalid value %(type)  '%(value)' in tag '%(tagname)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceInvalidValueException";
+
+	public PersistenceInvalidValueException(XmlPullParser parser, String type, String value)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("type", type);
+		this.setValue("value", value);
+	}
+
+	public PersistenceInvalidValueException(XmlPullParser parser, String type, String value, Throwable cause)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.initCause(cause);
+		this.setValue("type", type);
+		this.setValue("value", value);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceInvalidValueException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnknowTypeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnknowTypeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnknowTypeException.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceUnknowTypeException extends
+		PersistenceParserException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5611626021519090001L;
+	/**
+	 * 
+	 */
+	private final static String MESSAGE_FORMAT =  "Unknow type '%(type)' in tag '%(tagname)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceUnknowTypeException";
+
+	public PersistenceUnknowTypeException(XmlPullParser parser, String type)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("type", type);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnknowTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingEntryInZIPException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingEntryInZIPException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingEntryInZIPException.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceMissingEntryInZIPException extends
+		PersistenceException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -250292376190219948L;
+	private final static String MESSAGE_FORMAT = "Missing entry '%(name) in zip file.";
+	private final static String MESSAGE_KEY = "_PersistenceMissingEntryInZIPException";
+
+	public PersistenceMissingEntryInZIPException(String name)  {
+		super( MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name", name);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingEntryInZIPException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingTagException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingTagException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingTagException.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceMissingTagException extends
+		PersistenceParserException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5095000630798148245L;
+	private final static String MESSAGE_FORMAT = "Missing tag '%(name)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceMissingTagException";
+
+	public PersistenceMissingTagException(XmlPullParser parser, String name)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name", name);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceMissingTagException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnssuportedDefinitionTypeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnssuportedDefinitionTypeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnssuportedDefinitionTypeException.java	(revision 1235)
@@ -0,0 +1,48 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+
+public class PersistenceUnssuportedDefinitionTypeException extends
+		PersistenceRuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 7720851981749985511L;
+	private final static String MESSAGE_FORMAT = "Can't generate xml schema, unssuported type %(type) in field '%(field)' of '%(definition)' for class '%(classname)'.";
+	private final static String MESSAGE_KEY = "_Cant_generate_xml_schema_unssuported_type_XtypeX_in_field_XfieldX_of_X(definitionX_for_class_XclassnameX";
+
+	public PersistenceUnssuportedDefinitionTypeException(String classname, DynStruct definition, DynField field)  {
+		super( MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("type", ToolsLocator.getDataTypesManager().getTypeName(field.getType()));
+		this.setValue("field", field.getName());
+		this.setValue("definition", definition.getName());
+		this.setValue("classname", classname);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceUnssuportedDefinitionTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceEndOfDocumentException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceEndOfDocumentException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceEndOfDocumentException.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.xml.exception;
+
+import org.xmlpull.v1.XmlPullParser;
+
+public class PersistenceEndOfDocumentException extends
+		PersistenceParserException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4719650837477195387L;
+	private final static String MESSAGE_FORMAT = "Unspected end of document. Last tag '%(tagname)', line %(line) column %(column).";
+	private final static String MESSAGE_KEY = "_PersistenceEndOfDocumentException";
+
+	public PersistenceEndOfDocumentException(XmlPullParser parser)  {
+		super(parser, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/exception/PersistenceEndOfDocumentException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateWriter.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateWriter.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateWriter.java	(revision 1235)
@@ -0,0 +1,498 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.tools.persistence.xml;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistentContext;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.spi.PersistentContextServices.ObjectReference;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class XMLPersistentStateWriter implements XMLPersistentConstants {
+
+	private static Method getCharSetMethod = null;
+	private static Method getCharSetNameMethod = null;
+
+	private XMLPersistenceManager manager;
+	private PrintWriter print;
+	private boolean useCsMap = false;
+	private boolean useDomains = false;
+
+	private final static Pattern DOT_PATTERN = Pattern.compile("[.]");
+
+    /**
+     * The Unix separator character.
+     */
+    private static final char UNIX_SEPARATOR = '/';
+
+    /**
+     * Is it a Unix-like system?
+     */
+    private final static boolean UNIX_SYSTEM =
+        File.separatorChar == UNIX_SEPARATOR;
+
+    /**
+     * The Windows separator character.
+     */
+    private static final char WINDOWS_SEPARATOR = '\\';
+
+	public XMLPersistentStateWriter(XMLPersistenceManager persistenceManager) {
+		this.manager = persistenceManager;
+	}
+
+	public void write(PersistentStateServices state, OutputStream out)
+			throws PersistenceException {
+		write(state, out, null);
+	}
+
+	public void write(PersistentStateServices state, OutputStream out,
+			Map domains)
+			throws PersistenceException {
+		PersistentStateServices  root = state;
+		String rootId = root.getId().toString();
+		PersistentContext context = state.getContext();
+		OutputStreamWriter outWrite = new OutputStreamWriter(out);
+		print = new PrintWriter(out);
+
+		// XML header (<?xml ....?>)
+		print.println(MessageFormat.format(XML_HEADER,
+				new String[] { getCharset(outWrite.getEncoding()) }));
+
+		// Prepare schema
+		String rootAttributes = "";
+		if (domains != null && domains.size() > 0) {
+			useDomains = true;
+			StringBuffer buffRootAttr = new StringBuffer();
+
+			buffRootAttr.append('\n');
+			buffRootAttr.append(MessageFormat.format(
+					DOMAIN_NAME_ATTRIBUTE_VALUE, new Object[] {
+							BASE_DOMIAN_NAME, BASE_DOMIAN_URL }));
+			Iterator iter = domains.entrySet().iterator();
+			Entry entry;
+			while (iter.hasNext()) {
+				entry = (Entry) iter.next();
+				buffRootAttr.append('\n');
+				buffRootAttr.append(MessageFormat.format(DOMAIN_NAME_ATTRIBUTE_VALUE,
+						new Object[] { entry.getKey(), entry.getValue() }));
+			}
+			iter = domains.entrySet().iterator();
+			StringBuffer buffSchemas = new StringBuffer();
+
+			buffSchemas.append('\n');
+			buffSchemas.append(MessageFormat.format(SCHEMA_DEFINITON_VALUE,
+					new Object[] { BASE_DOMIAN_NAME, BASE_DOMIAN_URL }));
+			while (iter.hasNext()) {
+				entry = (Entry) iter.next();
+				buffSchemas.append('\n');
+				buffSchemas.append(MessageFormat.format(SCHEMA_DEFINITON_VALUE,
+						new Object[] { entry.getValue(), entry.getKey() }));
+			}
+			buffRootAttr.append('\n');
+			buffRootAttr.append(MessageFormat.format(DEFAULT_SCHEMA_ATTRIBUTE_VALUE,
+					new Object[] { buffSchemas.toString() }));
+			rootAttributes = buffRootAttr.toString();
+		}
+
+		// Root tag:
+//		if (useDomains) {
+//			print.println(MessageFormat.format(ROOT_VALUE, new Object[] {
+//					BASE_DOMIAN_NAME + ":", rootAttributes }));
+//		} else {
+			print.println(MessageFormat.format(ROOT_VALUE,
+					new Object[] { "",
+					rootAttributes }));
+//		}
+
+		// Version
+		print.println(MessageFormat.format(VERSION_VALUE,
+				new Object[] { manager.version() }));
+
+		// add root state id
+		print.println(MessageFormat.format(ROOTSTATE_VALUE,
+				new String[] { rootId }));
+
+		PersistentStateServices curState;
+		Iterator itStates = context.iterator();
+
+		// States tag:
+		print.println(STATES_START);
+
+		// iter all states
+		while (itStates.hasNext()) {
+			curState = (PersistentStateServices) itStates.next();
+			writeState(curState);
+
+		}
+		// States end:
+		print.println(STATES_END);
+
+		// Root end:
+//		if (useDomains) {
+//			print.println(MessageFormat.format(ROOT_END_VALUE,
+//					new Object[] { BASE_DOMIAN_NAME + ":" }));
+//		} else {
+			print.println(MessageFormat.format(ROOT_END_VALUE,
+					new Object[] { "" }));
+//		}
+
+		print.flush();
+
+	}
+
+	private void writeState(PersistentStateServices curState)
+			throws PersistenceException {
+		Iterator itNames;
+		String name;
+		Object value;
+
+		itNames = curState.getNames();
+		String theClassName = curState.getTheClassName();
+		String tagName = getXMLValidName( theClassName);
+		DynStruct definition = curState.getDefinition();
+		if( definition != null ) {
+			tagName = getXMLValidName(  curState.getDefinition().getFullName() );			
+		}
+
+		String domainName = "";
+		if (useDomains) {
+			PersistenceFactory factory =  manager.getFactories().get(theClassName);
+			domainName = factory.getDomainName() + ":";
+		}
+
+		// add state start
+		print.println(MessageFormat.format(STATE_START, new Object[] {
+				domainName, tagName, curState.getId() }));
+
+		boolean useNameAsTag;
+		String format, type;
+		StringBuffer strb;
+		// iter all property names
+		while (itNames.hasNext()) {
+			name = (String) itNames.next();
+			
+			value = curState.getValue(name);
+			strb = new StringBuffer();
+			type = transformValue(value, strb);
+
+			useNameAsTag = VALID_TAG_PATTERN.matcher(name).matches();
+
+			if (useNameAsTag) {
+				format = VALUE_ITEM;
+			} else {
+				format = VALUE_ITEM_GENERIC;
+			}
+
+			print.println(MessageFormat.format(format, new String[] { name,
+					type, strb.toString() }));
+
+		}
+
+		// add state end
+		print.println(MessageFormat.format(STATE_END, new Object[] {
+				domainName, tagName, curState.getId() }));
+
+	}
+
+	public static String getXMLValidName(String theClassName) {
+		String name = theClassName;
+		// Remove all $ chars for inner class names
+		int pos = 0;
+		while ((pos = name.indexOf('$')) > 0) {
+			name =
+					name.substring(0, pos).concat("..").concat(
+							name.substring(pos + 1));
+		}
+		while ((pos = name.indexOf(':')) > 0) {
+			name =
+					name.substring(0, pos).concat("__").concat(
+							name.substring(pos + 1));
+		}
+		return name;
+	}
+
+	private String transformValue(Object value, StringBuffer strb)
+			throws PersistenceTypeNotSupportedException {
+		if (value instanceof String) {
+			return transformValue((String) value, strb);
+		} else if (value instanceof Number) {
+			return transformValue((Number) value, strb);
+		} else if (value instanceof ObjectReference) {
+			return transformValue((ObjectReference) value, strb);
+		} else if (value instanceof List) {
+			return transformValue((List) value, strb);
+		} else if (value instanceof Set) {
+			return transformValue((Set) value, strb);
+		} else if (value instanceof Map) {
+			return transformValue((Map) value, strb);
+		} else if (value instanceof Boolean) {
+			return transformValue((Boolean) value, strb);
+		} else if (value instanceof Date) {
+			return transformValue((Date) value, strb);
+		} else if (value instanceof File) {
+			return transformValue((File) value, strb);
+		} else if (value instanceof URL) {
+			return transformValue((URL) value, strb);
+		} else if (value instanceof URI) {
+			return transformValue((URI) value, strb);
+		} else if (value == null) {
+			return transformNullValue(strb);
+		} else {
+			throw new PersistenceTypeNotSupportedException(value.getClass());
+		}
+	}
+
+	private String transformValue(String value, StringBuffer strb) {
+		if (!VALID_VALUE_PATTERN.matcher(value).matches()) {
+			strb.append(CDATA_START);
+			strb.append(value);
+			strb.append(CDATA_END);
+		} else {
+			strb.append(value);
+		}
+		return TYPE_STRING;
+	}
+
+	private String transformValue(File value, StringBuffer strb) {
+		String data;
+		data = value.getPath();
+        if (!UNIX_SYSTEM) {
+            // Always use UNIX separator as it's allowed in both system
+            data = data.replace(WINDOWS_SEPARATOR, UNIX_SEPARATOR);
+        }
+		if (!VALID_VALUE_PATTERN.matcher(data).matches()) {
+			strb.append(CDATA_START);
+			strb.append(data);
+			strb.append(CDATA_END);
+		} else {
+			strb.append(data);
+		}
+		return TYPE_FILE;
+	}
+
+	private String transformValue(URL value, StringBuffer strb) {
+		String data;
+		data = value.toExternalForm();
+		if (!VALID_VALUE_PATTERN.matcher(data).matches()) {
+			strb.append(CDATA_START);
+			strb.append(data);
+			strb.append(CDATA_END);
+		} else {
+			strb.append(data);
+		}
+		return TYPE_URL;
+	}
+
+	private String transformValue(URI value, StringBuffer strb) {
+		String data;
+		data = value.toASCIIString();
+		if (!VALID_VALUE_PATTERN.matcher(data).matches()) {
+			strb.append(CDATA_START);
+			strb.append(data);
+			strb.append(CDATA_END);
+		} else {
+			strb.append(data);
+		}
+		return TYPE_URI;
+	}
+	
+	private String transformNullValue(StringBuffer strb) {
+		return TYPE_NULL;
+	}
+
+	private String transformValue(Number value, StringBuffer strb) {
+		strb.append(value);
+		String[] classname = split(value.getClass().getName(), DOT_PATTERN);
+		return classname[classname.length - 1].toLowerCase();
+	}
+
+//	private String[] split(String txt, String pattern) {
+//		return Pattern.compile(pattern).split(txt, 0);
+//	}
+
+	private String[] split(String txt, Pattern pattern) {
+		return pattern.split(txt, 0);
+	}
+
+	private String transformValue(Boolean value, StringBuffer strb) {
+		strb.append(value);
+		return TYPE_BOOLEAN;
+	}
+
+	private String transformValue(Date value, StringBuffer strb) {
+		strb.append(value.getTime());
+		return TYPE_DATE;
+	}
+
+	private String transformValue(ObjectReference value, StringBuffer strb) {
+		strb.append(MessageFormat.format(REFERENCE_VALUE, new Object[] { value
+				.getId() }));
+		strb.append('\n');
+		strb.append(INDENDT_2);
+		return TYPE_REFERENCE;
+	}
+
+	private String transformValue(List value, StringBuffer strb)
+			throws PersistenceTypeNotSupportedException {
+		Iterator iter = value.iterator();
+		String type;
+		StringBuffer itemStrb;
+		while (iter.hasNext()) {
+			strb.append('\n');
+			itemStrb = new StringBuffer();
+			type = transformValue(iter.next(), itemStrb);
+			if( TYPE_REFERENCE.equalsIgnoreCase(type)) {
+				strb.append(MessageFormat.format(LISTITEM_VALUE, new String[] {
+						type, itemStrb.toString()+INDENDT_1 }));
+			} else {
+				strb.append(MessageFormat.format(LISTITEM_VALUE, new String[] {
+						type, itemStrb.toString() }));
+			}
+		}
+		strb.append('\n');
+		strb.append(INDENDT_2);
+
+		return TYPE_LIST;
+	}
+
+	private String transformValue(Set value, StringBuffer strb)
+			throws PersistenceTypeNotSupportedException {
+		Iterator iter = value.iterator();
+		String type;
+		StringBuffer itemStrb;
+		while (iter.hasNext()) {
+			itemStrb = new StringBuffer();
+			type = transformValue(iter.next(), itemStrb);
+			strb.append(MessageFormat.format(SETITEM_VALUE, new String[] {
+					type, itemStrb.toString() }));
+		}
+
+		return TYPE_SET;
+	}
+
+	private String transformValue(Map value, StringBuffer strb)
+			throws PersistenceTypeNotSupportedException {
+		Iterator iter = value.entrySet().iterator();
+		Entry entry;
+		String keyType, valueType;
+		StringBuffer valueStrb, keyStrb;
+		while (iter.hasNext()) {
+			entry = (Entry) iter.next();
+			// transform key
+			keyStrb = new StringBuffer();
+			keyType = transformValue(entry.getKey(), keyStrb);
+			// transform value
+			valueStrb = new StringBuffer();
+			valueType = transformValue(entry.getValue(), valueStrb);
+
+			strb.append(MessageFormat.format(MAPITEM_VALUE, new String[] {
+					keyType, keyStrb.toString(), valueType,
+					valueStrb.toString() }));
+		}
+
+		return TYPE_MAP;
+	}
+
+	private String getCharsetByNio(String csName) {
+		Object charSet;
+		if (getCharSetNameMethod == null) {
+			Class charsetClass = null;
+			try {
+				charsetClass = Class.forName("java.nio.charset.Charset");
+			} catch (ClassNotFoundException e) {
+				useCsMap = true;
+				return null;
+			}
+			try {
+				getCharSetMethod = charsetClass.getMethod("forName",
+						new Class[] { String.class });
+			} catch (Exception e) {
+				useCsMap = true;
+				return null;
+			}
+			try {
+				getCharSetNameMethod = charsetClass.getMethod("displayName",
+						new Class[] {});
+			} catch (Exception e) {
+				useCsMap = true;
+				return null;
+			}
+
+		}
+		try {
+			charSet = getCharSetMethod.invoke(null, new Object[] { csName });
+		} catch (Exception e) {
+			useCsMap = true;
+			return null;
+		}
+
+		try {
+			return (String) getCharSetNameMethod.invoke(charSet,
+					new Object[] {});
+		} catch (Exception e) {
+			useCsMap = true;
+			return null;
+		}
+	}
+
+	private String getCharset(String csName) {
+		if (!useCsMap) {
+			String name = this.getCharsetByNio(csName);
+			if (name != null) {
+				return name;
+			}
+		}
+		return (String) ChasetMap.getMap().get(csName);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceManager.java	(revision 1235)
@@ -0,0 +1,135 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.gvsig.tools.persistence.impl.AbstractPersistenceManager;
+import org.gvsig.tools.persistence.impl.AbstractPersistentState;
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentIdentifier;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+import org.kxml2.io.KXmlParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class XMLPersistenceManager extends AbstractPersistenceManager {
+
+	private static final String VERSION = "2.0.0";
+
+	class XMLPersistentState extends AbstractPersistentState {
+
+		XMLPersistentState(PersistenceManagerServices manager, PersistentContextServices context, PersistentIdentifier id) {
+			super(manager, context, id);
+		}
+
+	}
+
+	public XMLPersistenceManager() {
+		super();
+	}
+	
+
+	public PersistentStateServices createPersistentState(	PersistentContextServices context, PersistentIdentifier id) {
+		return new XMLPersistentState(this, context, id);
+	}
+
+	public PersistentState loadState(InputStream in)
+			throws PersistenceException {
+		PersistentContextServices context = this.getNewContext();
+
+		XMLPersistentStateReader xmlReader = getReaderInstance();
+
+		KXmlParser parser = new KXmlParser();
+
+		try {
+			parser.setInput(in, null);
+		} catch (XmlPullParserException e) {
+			throw new PersistenceException(e);
+		}
+		xmlReader.read(context, parser);
+
+		return context.getRoot().getState();
+	}
+
+	public void saveState(PersistentState state, OutputStream out)
+			throws PersistenceException, PersistenceValidateExceptions {
+		XMLPersistentStateWriter xmlWriter = getWriterInstance();
+
+		xmlWriter.write((PersistentStateServices) state, out);
+
+	}
+
+	protected XMLPersistentStateReader getReaderInstance(){
+		return new XMLPersistentStateReader(this);
+	}
+
+	protected XMLPersistentStateWriter getWriterInstance() {
+		return new XMLPersistentStateWriter(this);
+	}
+
+	public String version() {
+		return VERSION;
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistenceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLSchemaConstants.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLSchemaConstants.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLSchemaConstants.java	(revision 1235)
@@ -0,0 +1,175 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import java.text.MessageFormat;
+
+/**
+ * @author jmvivo
+ *
+ */
+public interface ZipXMLSchemaConstants {
+
+	/**
+	 * <ol>
+	 * <li>domain name</li>
+	 * <li>domain URL</li>
+	 * </ol>
+	 */
+	public static final String XSD_IMPORT_SCHEMA_VALUE =
+		"<xs:import namespace=\"{1}\" schemaLocation=\"{0}\"/>\n\n";
+
+	/**
+	 * Current Schema file name.
+	 */
+	public static final String BASE_SCHEMA_FILE_NAME = MessageFormat.format(
+			XMLPersistentConstants.SCHEMA_FILE_NAME_VALUE,
+			new Object[] { "persistentState_base" });
+
+	/**
+	 * <ol>
+	 * <li>domain name</li>
+	 * <li>domain URL</li>
+	 * </ol>
+	 */
+	public static final String XSD_HEAD_VALUE =
+			"<?xml version=\"1.0\"?>\n"+
+			"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n"+
+			"  targetNamespace=\"{1}\"\n" +
+			"  xmlns:tools=\""+XMLPersistentConstants.BASE_DOMIAN_URL+"\"\n"+
+			"  xmlns:{0}=\"{1}\"\n"+
+			"  elementFormDefault=\"qualified\"\n"+
+			"  attributeFormDefault=\"qualified\">\n\n"+
+			MessageFormat.format(
+				XSD_IMPORT_SCHEMA_VALUE,
+				new Object[] {
+					BASE_SCHEMA_FILE_NAME,
+					XMLPersistentConstants.BASE_DOMIAN_URL }) + "\n\n";
+
+	public static final String XSD_END = "</xs:schema>";
+
+	/**
+	 * <ol>
+	 * <li>class name</li>
+	 * </ol>
+	 */
+	public static final String XSD_START_CLASS_VALUE =
+		"    <xs:element name=\"{0}\">\n" +
+        "      <xs:complexType>\n" +
+        "        <xs:all>\n";
+
+
+	public static final String XSD_END_CLASS =
+		"        </xs:all>\n" +
+		"        <xs:attributeGroup ref=\"tools:state_attributes\"/>\n"+
+        "      </xs:complexType>\n" +
+		"    </xs:element>\n";
+
+	/**
+	 * <ol>
+	 * <li>attribute name</li>
+	 * <li>attribute type (use
+	 *   {@link #XSD_ATTRUBUTE_TYPE_INTEGER},
+	 *   {@link #XSD_ATTRUBUTE_TYPE_LONG},
+	 *   {@link #XSD_ATTRUBUTE_TYPE_NULL},
+	 *   etc..
+	 *    ) </li>
+	 * </ol>
+	 */
+	public static final String XSD_ATTRUBUTE_VALUE =
+		"          <xs:element name=\"{0}\" type=\"{1}\"/>\n";
+
+	/**
+	 * <ol>
+	 * <li>attribute name</li>
+	 * <li>attribute type (use {@link #XSD_ATTRUBUTE_TYPE_INTEGER},
+	 * {@link #XSD_ATTRUBUTE_TYPE_LONG}, {@link #XSD_ATTRUBUTE_TYPE_STRING},
+	 * etc.. )</li>
+	 * </ol>
+	 */
+	public static final String XSD_ATTRUBUTE_MANDATORY_VALUE =
+		"          <xs:element name=\"{0}\" type=\"{1}\" minOccurs=\"1\"/>\n";
+
+
+	public static final String XSD_ATTRUBUTE_TYPE_NULL = "tools:state_attribute_Null";
+	public static final String XSD_ATTRUBUTE_TYPE_STRING = "tools:state_attribute_String";
+	public static final String XSD_ATTRUBUTE_TYPE_BOOLEAN = "tools:state_attribute_Boolean";
+	public static final String XSD_ATTRUBUTE_TYPE_INTEGER = "tools:state_attribute_Integer";
+	public static final String XSD_ATTRUBUTE_TYPE_LONG = "tools:state_attribute_Long";
+	public static final String XSD_ATTRUBUTE_TYPE_FLOAT = "tools:state_attribute_Float";
+	public static final String XSD_ATTRUBUTE_TYPE_DOUBLE = "tools:state_attribute_Double";
+	public static final String XSD_ATTRUBUTE_TYPE_LIST = "tools:state_attribute_List";
+	public static final String XSD_ATTRUBUTE_TYPE_ARRAY = XSD_ATTRUBUTE_TYPE_LIST;
+	public static final String XSD_ATTRUBUTE_TYPE_SET = "tools:state_attribute_Set";
+	public static final String XSD_ATTRUBUTE_TYPE_MAP = "tools:state_attribute_Map";
+	public static final String XSD_ATTRUBUTE_TYPE_OBJECT = "tools:state_attribute_ObjectReference";
+	public static final String XSD_ATTRUBUTE_TYPE_DATE = "tools:state_attribute_Date";
+
+
+	public static final String XSD_ATTRUBUTE_TYPE_STRING_NOTNULL = "tools:state_attribute_String_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_BOOLEAN_NOTNULL = "tools:state_attribute_Boolean_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_INTEGER_NOTNULL = "tools:state_attribute_Integer_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_LONG_NOTNULL = "tools:state_attribute_Long_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_FLOAT_NOTNULL = "tools:state_attribute_Float_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_DOUBLE_NOTNULL = "tools:state_attribute_Double_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_LIST_NOTNULL = "tools:state_attribute_List_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_ARRAY_NOTNULL = XSD_ATTRUBUTE_TYPE_LIST_NOTNULL;
+	public static final String XSD_ATTRUBUTE_TYPE_SET_NOTNULL = "tools:state_attribute_Set_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_MAP_NOTNULL = "tools:state_attribute_Map_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_OBJECT_NOTNULL = "tools:state_attribute_ObjectReference_notNull";
+	public static final String XSD_ATTRUBUTE_TYPE_DATE_NOTNULL = "tools:state_attribute_Date_notNull";
+
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLSchemaConstants.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLPersistenceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLPersistenceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLPersistenceManager.java	(revision 1235)
@@ -0,0 +1,399 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+import org.gvsig.tools.persistence.xml.exception.PersistenceMissingEntryInZIPException;
+import org.gvsig.tools.persistence.xml.exception.PersistenceUnssuportedDefinitionTypeException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class ZipXMLPersistenceManager extends XMLPersistenceManager {
+
+	private static final String PERSISTENT_ZIP_ENTRY_NAME =
+			"state.xml";
+	private static final String BASE_SCHEMA_ENTRY_NAME = "state_base.xsd";
+
+	public PersistentState loadState(InputStream in)
+			throws PersistenceException {
+
+		ZipInputStream zIn = new ZipInputStream(in);
+		
+		ZipEntry zEntry;
+		try {
+			while ((zEntry = zIn.getNextEntry()) != null) {
+
+				if (zEntry.getName().equals(PERSISTENT_ZIP_ENTRY_NAME)) {
+					return super.loadState(zIn);
+				}
+			}
+		} catch (IOException e) {
+			throw new PersistenceException(e);
+		}
+		throw new PersistenceMissingEntryInZIPException(PERSISTENT_ZIP_ENTRY_NAME);
+	}
+
+	public void saveState(PersistentState state, OutputStream out)
+			throws PersistenceException, PersistenceValidateExceptions {
+
+		ZipOutputStream zOut = new ZipOutputStream(out);
+		List exceptions = new ArrayList();
+
+
+		PersistentContextServices context = (PersistentContextServices) state.getContext();
+		try{
+			// insert data
+			if( this.getAutoValidation() != DISABLED ) {
+				try {
+					context.validate(this.getAutoValidation());
+				} catch(PersistenceValidateExceptions ex) {
+					exceptions.add(ex);
+				}
+			}
+			zOut.putNextEntry(new ZipEntry(PERSISTENT_ZIP_ENTRY_NAME));
+			XMLPersistentStateWriter xmlWriter = getWriterInstance();
+
+			xmlWriter.write((PersistentStateServices) state, zOut, this
+					.getDomains());
+
+			zOut.putNextEntry(new ZipEntry(BASE_SCHEMA_ENTRY_NAME));
+
+
+			// insert base schema
+			InputStream baseSchemaIs = ZipXMLPersistenceManager.class
+					.getResourceAsStream("persistentState_base.xsd");
+			byte[] buff = new byte[1024*5];
+			int readed;
+			while ((readed = baseSchemaIs.read(buff)) > 0) {
+				zOut.write(buff, 0, readed);
+			}
+			baseSchemaIs.close();
+
+			// insert registered schemas
+			Map domains = this.getDomains();
+			Entry entry;
+			Iterator iterDomainsEntry = domains.entrySet().iterator();
+			while (iterDomainsEntry.hasNext()) {
+				entry = (Entry) iterDomainsEntry.next();
+				zOut.putNextEntry(new ZipEntry(entry.getKey()+".xsd"));
+				try {
+				writeSchema(zOut, (String) entry.getKey(), (String) entry
+						.getValue());
+				} catch(CantGenerateXMLSchemaForDomainException ex) {
+					exceptions.add(ex);
+				}
+			}
+
+			zOut.finish();
+
+		} catch (Exception e) {
+			exceptions.add(e);
+		}
+		if( exceptions.size()>0 ) {
+			if( context.getCollectErrors() ) {
+				context.addError(new CantSaveStateException(exceptions));
+			} else {
+				throw new CantSaveStateException(exceptions);
+			}
+		}
+
+	}
+
+	private void writeSchema(OutputStream out, String domainName,
+			String domainURL) throws PersistenceException  {
+		PrintWriter printer = new PrintWriter(out);
+		printer.println(MessageFormat.format(
+				ZipXMLSchemaConstants.XSD_HEAD_VALUE,
+				new Object[] {
+						domainName, domainURL }));
+
+
+		List exceptions = new ArrayList();
+
+		List domainDefinitions = getDomainDefinitions(domainName);
+		Iterator iter = domainDefinitions.iterator();
+		while (iter.hasNext()) {
+			DynStruct definition = (DynStruct) iter.next();
+			try {
+				writeClassDefinitionSchema(printer, definition.getName(), definition);
+			} catch(CantGenerateXMLSchemaForDefinitionException ex) {
+				exceptions.add(ex);
+			}
+		}
+
+		printer.println(ZipXMLSchemaConstants.XSD_END);
+		printer.flush();
+		if( exceptions.size()>0 ) {
+			throw new CantGenerateXMLSchemaForDomainException(domainName, exceptions);
+		}
+
+	}
+
+	private void writeClassDefinitionSchema(PrintWriter printer,
+			String className, DynStruct definition) throws PersistenceException {
+
+		List exceptions = new ArrayList();
+		
+		printer.print(MessageFormat.format(
+				ZipXMLSchemaConstants.XSD_START_CLASS_VALUE,
+				new Object[] { className }));
+
+		DynField[] fields = definition.getDynFields();
+		DynField field;
+		String typeId = "";
+
+		boolean allowNull;
+
+		for (int i = 0; i < fields.length; i++) {
+			field = fields[i];
+			if (!field.isPersistent()) {
+				continue;
+			}
+			allowNull = field.isMandatory() && field.getDefaultValue() == null;
+			
+			if (field.getDataType().isObject()
+					|| field.getDataType().isDynObject()) {
+				if (allowNull) {
+					typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_OBJECT;
+				} else {
+					typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_OBJECT_NOTNULL;
+				}
+			} else {
+				switch (field.getType()) {
+				case DataTypes.STRING:
+				case DataTypes.FILE:
+				case DataTypes.FOLDER:
+				case DataTypes.URL:
+				case DataTypes.URI:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_STRING;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_STRING_NOTNULL;
+					}
+					break;
+				case DataTypes.BOOLEAN:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_BOOLEAN;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_BOOLEAN_NOTNULL;
+					}
+					break;
+				case DataTypes.INT:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_INTEGER;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_INTEGER_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.LONG:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_LONG;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_LONG_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.FLOAT:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_FLOAT;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_FLOAT_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.DOUBLE:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_FLOAT;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_FLOAT_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.SET:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_SET;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_SET_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.LIST:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_LIST;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_LIST_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.ARRAY:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_ARRAY;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_ARRAY_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.MAP:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_MAP;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_MAP_NOTNULL;
+					}
+					break;
+	
+				case DataTypes.DATE:
+					if (allowNull) {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_DATE;
+					} else {
+						typeId = ZipXMLSchemaConstants.XSD_ATTRUBUTE_TYPE_DATE_NOTNULL;
+					}
+					break;
+	
+				default:
+					exceptions.add(new PersistenceUnssuportedDefinitionTypeException(className, definition, field));
+				}
+			}
+			
+			if (field.isMandatory()) {
+				printer.print(MessageFormat.format(
+						ZipXMLSchemaConstants.XSD_ATTRUBUTE_MANDATORY_VALUE,
+						new String[] { field.getName(), typeId }));
+			} else {
+				printer.print(MessageFormat.format(
+						ZipXMLSchemaConstants.XSD_ATTRUBUTE_VALUE,
+						new String[] { field.getName(), typeId }));
+			}
+		}
+
+		printer.println(ZipXMLSchemaConstants.XSD_END_CLASS);
+		if( exceptions.size()>0 ) {
+			throw new CantGenerateXMLSchemaForDefinitionException(className, exceptions);
+		}
+	}
+
+	public class CantGenerateXMLSchemaForDefinitionException extends PersistenceException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 2828756207089264709L;
+		
+		CantGenerateXMLSchemaForDefinitionException(String className, List exceptions) {
+			super(
+					"Can't generate xml schema definition for the class %(classname).",
+					"_Cant_generate_xml_schema_definition_for_the_class_XclassnameX",
+					serialVersionUID
+			);
+			this.addAll(exceptions);
+			setValue("classname",className);
+		}
+	}
+	public class CantGenerateXMLSchemaForDomainException extends PersistenceException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 2828756207089264709L;
+		
+		CantGenerateXMLSchemaForDomainException(String domainName, List exceptions) {
+			super(
+					"Can't generate xml schema definition for domain '%(domain).",
+					"_Cant_generate_xml_schema_definition_for_domain_XdomainX",
+					serialVersionUID
+			);
+			this.addAll(exceptions);
+			setValue("domain",domainName);
+		}
+	}
+	public class CantSaveStateException extends PersistenceException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 7255882015705477288L;
+
+		CantSaveStateException(List exceptions) {
+			super(
+					"Can't save state.",
+					"_Cant_save_state",
+					serialVersionUID
+			);
+			this.addAll(exceptions);
+		}
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ZipXMLPersistenceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ChasetMap.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ChasetMap.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ChasetMap.java	(revision 1235)
@@ -0,0 +1,1037 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ChasetMap {
+	private static Map csMap = null;
+
+	public static Map getMap() {
+		if (csMap == null) {
+			csMap = new HashMap();
+			csMap.put("Big5", "Big5");
+			csMap.put("Big5", "Big5");
+			csMap.put("csBig5", "Big5");
+			csMap.put("Big5-HKSCS", "Big5-HKSCS");
+			csMap.put("Big5-HKSCS", "Big5-HKSCS");
+			csMap.put("big5-hkscs", "Big5-HKSCS");
+			csMap.put("big5hk", "Big5-HKSCS");
+			csMap.put("big5-hkscs:unicode3.0", "Big5-HKSCS");
+			csMap.put("big5hkscs", "Big5-HKSCS");
+			csMap.put("Big5_HKSCS", "Big5-HKSCS");
+			csMap.put("EUC-JP", "EUC-JP");
+			csMap.put("EUC-JP", "EUC-JP");
+			csMap.put("eucjis", "EUC-JP");
+			csMap.put("x-eucjp", "EUC-JP");
+			csMap.put("csEUCPkdFmtjapanese", "EUC-JP");
+			csMap.put("eucjp", "EUC-JP");
+			csMap
+					.put("Extended_UNIX_Code_Packed_Format_for_Japanese",
+							"EUC-JP");
+			csMap.put("x-euc-jp", "EUC-JP");
+			csMap.put("euc_jp", "EUC-JP");
+			csMap.put("EUC-KR", "EUC-KR");
+			csMap.put("EUC-KR", "EUC-KR");
+			csMap.put("ksc5601", "EUC-KR");
+			csMap.put("5601", "EUC-KR");
+			csMap.put("ksc5601_1987", "EUC-KR");
+			csMap.put("ksc_5601", "EUC-KR");
+			csMap.put("ksc5601-1987", "EUC-KR");
+			csMap.put("euc_kr", "EUC-KR");
+			csMap.put("ks_c_5601-1987", "EUC-KR");
+			csMap.put("euckr", "EUC-KR");
+			csMap.put("csEUCKR", "EUC-KR");
+			csMap.put("GB18030", "GB18030");
+			csMap.put("GB18030", "GB18030");
+			csMap.put("gb18030-2000", "GB18030");
+			csMap.put("GB2312", "GB2312");
+			csMap.put("GB2312", "GB2312");
+			csMap.put("gb2312-1980", "GB2312");
+			csMap.put("gb2312", "GB2312");
+			csMap.put("EUC_CN", "GB2312");
+			csMap.put("gb2312-80", "GB2312");
+			csMap.put("euc-cn", "GB2312");
+			csMap.put("euccn", "GB2312");
+			csMap.put("x-EUC-CN", "GB2312");
+			csMap.put("GBK", "GBK");
+			csMap.put("GBK", "GBK");
+			csMap.put("windows-936", "GBK");
+			csMap.put("CP936", "GBK");
+			csMap.put("IBM-Thai", "IBM-Thai");
+			csMap.put("IBM-Thai", "IBM-Thai");
+			csMap.put("ibm-838", "IBM-Thai");
+			csMap.put("ibm838", "IBM-Thai");
+			csMap.put("838", "IBM-Thai");
+			csMap.put("cp838", "IBM-Thai");
+			csMap.put("IBM00858", "IBM00858");
+			csMap.put("IBM00858", "IBM00858");
+			csMap.put("cp858", "IBM00858");
+			csMap.put("ccsid00858", "IBM00858");
+			csMap.put("cp00858", "IBM00858");
+			csMap.put("858", "IBM00858");
+			csMap.put("IBM01140", "IBM01140");
+			csMap.put("IBM01140", "IBM01140");
+			csMap.put("1140", "IBM01140");
+			csMap.put("ccsid01140", "IBM01140");
+			csMap.put("cp01140", "IBM01140");
+			csMap.put("cp1140", "IBM01140");
+			csMap.put("IBM01141", "IBM01141");
+			csMap.put("IBM01141", "IBM01141");
+			csMap.put("cp01141", "IBM01141");
+			csMap.put("cp1141", "IBM01141");
+			csMap.put("ccsid01141", "IBM01141");
+			csMap.put("1141", "IBM01141");
+			csMap.put("IBM01142", "IBM01142");
+			csMap.put("IBM01142", "IBM01142");
+			csMap.put("cp01142", "IBM01142");
+			csMap.put("cp1142", "IBM01142");
+			csMap.put("ccsid01142", "IBM01142");
+			csMap.put("1142", "IBM01142");
+			csMap.put("IBM01143", "IBM01143");
+			csMap.put("IBM01143", "IBM01143");
+			csMap.put("1143", "IBM01143");
+			csMap.put("cp01143", "IBM01143");
+			csMap.put("cp1143", "IBM01143");
+			csMap.put("ccsid01143", "IBM01143");
+			csMap.put("IBM01144", "IBM01144");
+			csMap.put("IBM01144", "IBM01144");
+			csMap.put("cp01144", "IBM01144");
+			csMap.put("cp1144", "IBM01144");
+			csMap.put("1144", "IBM01144");
+			csMap.put("ccsid01144", "IBM01144");
+			csMap.put("IBM01145", "IBM01145");
+			csMap.put("IBM01145", "IBM01145");
+			csMap.put("ccsid01145", "IBM01145");
+			csMap.put("cp01145", "IBM01145");
+			csMap.put("1145", "IBM01145");
+			csMap.put("cp1145", "IBM01145");
+			csMap.put("IBM01146", "IBM01146");
+			csMap.put("IBM01146", "IBM01146");
+			csMap.put("ccsid01146", "IBM01146");
+			csMap.put("cp1146", "IBM01146");
+			csMap.put("1146", "IBM01146");
+			csMap.put("cp01146", "IBM01146");
+			csMap.put("IBM01147", "IBM01147");
+			csMap.put("IBM01147", "IBM01147");
+			csMap.put("cp1147", "IBM01147");
+			csMap.put("1147", "IBM01147");
+			csMap.put("ccsid01147", "IBM01147");
+			csMap.put("cp01147", "IBM01147");
+			csMap.put("IBM01148", "IBM01148");
+			csMap.put("IBM01148", "IBM01148");
+			csMap.put("cp01148", "IBM01148");
+			csMap.put("cp1148", "IBM01148");
+			csMap.put("ccsid01148", "IBM01148");
+			csMap.put("1148", "IBM01148");
+			csMap.put("IBM01149", "IBM01149");
+			csMap.put("IBM01149", "IBM01149");
+			csMap.put("cp1149", "IBM01149");
+			csMap.put("ccsid01149", "IBM01149");
+			csMap.put("1149", "IBM01149");
+			csMap.put("cp01149", "IBM01149");
+			csMap.put("IBM037", "IBM037");
+			csMap.put("IBM037", "IBM037");
+			csMap.put("csIBM037", "IBM037");
+			csMap.put("cpibm37", "IBM037");
+			csMap.put("cp037", "IBM037");
+			csMap.put("cs-ebcdic-cp-us", "IBM037");
+			csMap.put("ibm-037", "IBM037");
+			csMap.put("ibm-37", "IBM037");
+			csMap.put("cs-ebcdic-cp-ca", "IBM037");
+			csMap.put("cs-ebcdic-cp-wt", "IBM037");
+			csMap.put("cs-ebcdic-cp-nl", "IBM037");
+			csMap.put("ibm037", "IBM037");
+			csMap.put("037", "IBM037");
+			csMap.put("IBM1026", "IBM1026");
+			csMap.put("IBM1026", "IBM1026");
+			csMap.put("1026", "IBM1026");
+			csMap.put("ibm1026", "IBM1026");
+			csMap.put("cp1026", "IBM1026");
+			csMap.put("ibm-1026", "IBM1026");
+			csMap.put("IBM1047", "IBM1047");
+			csMap.put("IBM1047", "IBM1047");
+			csMap.put("1047", "IBM1047");
+			csMap.put("ibm-1047", "IBM1047");
+			csMap.put("cp1047", "IBM1047");
+			csMap.put("IBM273", "IBM273");
+			csMap.put("IBM273", "IBM273");
+			csMap.put("ibm273", "IBM273");
+			csMap.put("273", "IBM273");
+			csMap.put("cp273", "IBM273");
+			csMap.put("ibm-273", "IBM273");
+			csMap.put("IBM277", "IBM277");
+			csMap.put("IBM277", "IBM277");
+			csMap.put("ibm277", "IBM277");
+			csMap.put("cp277", "IBM277");
+			csMap.put("ibm-277", "IBM277");
+			csMap.put("277", "IBM277");
+			csMap.put("IBM278", "IBM278");
+			csMap.put("IBM278", "IBM278");
+			csMap.put("csIBM278", "IBM278");
+			csMap.put("ibm278", "IBM278");
+			csMap.put("cp278", "IBM278");
+			csMap.put("ebcdic-cp-se", "IBM278");
+			csMap.put("278", "IBM278");
+			csMap.put("ibm-278", "IBM278");
+			csMap.put("ebcdic-sv", "IBM278");
+			csMap.put("IBM280", "IBM280");
+			csMap.put("IBM280", "IBM280");
+			csMap.put("ibm280", "IBM280");
+			csMap.put("cp280", "IBM280");
+			csMap.put("280", "IBM280");
+			csMap.put("ibm-280", "IBM280");
+			csMap.put("IBM284", "IBM284");
+			csMap.put("IBM284", "IBM284");
+			csMap.put("cpibm284", "IBM284");
+			csMap.put("csIBM284", "IBM284");
+			csMap.put("ibm-284", "IBM284");
+			csMap.put("ibm284", "IBM284");
+			csMap.put("284", "IBM284");
+			csMap.put("cp284", "IBM284");
+			csMap.put("IBM285", "IBM285");
+			csMap.put("IBM285", "IBM285");
+			csMap.put("285", "IBM285");
+			csMap.put("ebcdic-cp-gb", "IBM285");
+			csMap.put("ibm-285", "IBM285");
+			csMap.put("csIBM285", "IBM285");
+			csMap.put("cp285", "IBM285");
+			csMap.put("ibm285", "IBM285");
+			csMap.put("cpibm285", "IBM285");
+			csMap.put("ebcdic-gb", "IBM285");
+			csMap.put("IBM297", "IBM297");
+			csMap.put("IBM297", "IBM297");
+			csMap.put("csIBM297", "IBM297");
+			csMap.put("ebcdic-cp-fr", "IBM297");
+			csMap.put("cp297", "IBM297");
+			csMap.put("ibm297", "IBM297");
+			csMap.put("ibm-297", "IBM297");
+			csMap.put("297", "IBM297");
+			csMap.put("cpibm297", "IBM297");
+			csMap.put("IBM420", "IBM420");
+			csMap.put("IBM420", "IBM420");
+			csMap.put("ibm420", "IBM420");
+			csMap.put("420", "IBM420");
+			csMap.put("ebcdic-cp-ar1", "IBM420");
+			csMap.put("csIBM420", "IBM420");
+			csMap.put("ibm-420", "IBM420");
+			csMap.put("cp420", "IBM420");
+			csMap.put("IBM424", "IBM424");
+			csMap.put("IBM424", "IBM424");
+			csMap.put("cp424", "IBM424");
+			csMap.put("424", "IBM424");
+			csMap.put("ebcdic-cp-he", "IBM424");
+			csMap.put("ibm424", "IBM424");
+			csMap.put("csIBM424", "IBM424");
+			csMap.put("ibm-424", "IBM424");
+			csMap.put("IBM437", "IBM437");
+			csMap.put("IBM437", "IBM437");
+			csMap.put("windows-437", "IBM437");
+			csMap.put("cspc8codepage437", "IBM437");
+			csMap.put("ibm437", "IBM437");
+			csMap.put("cp437", "IBM437");
+			csMap.put("437", "IBM437");
+			csMap.put("ibm-437", "IBM437");
+			csMap.put("IBM500", "IBM500");
+			csMap.put("IBM500", "IBM500");
+			csMap.put("500", "IBM500");
+			csMap.put("ebcdic-cp-ch", "IBM500");
+			csMap.put("ebcdic-cp-bh", "IBM500");
+			csMap.put("ibm-500", "IBM500");
+			csMap.put("csIBM500", "IBM500");
+			csMap.put("cp500", "IBM500");
+			csMap.put("ibm500", "IBM500");
+			csMap.put("IBM775", "IBM775");
+			csMap.put("IBM775", "IBM775");
+			csMap.put("ibm775", "IBM775");
+			csMap.put("cp775", "IBM775");
+			csMap.put("ibm-775", "IBM775");
+			csMap.put("775", "IBM775");
+			csMap.put("IBM850", "IBM850");
+			csMap.put("IBM850", "IBM850");
+			csMap.put("ibm-850", "IBM850");
+			csMap.put("850", "IBM850");
+			csMap.put("ibm850", "IBM850");
+			csMap.put("cspc850multilingual", "IBM850");
+			csMap.put("cp850", "IBM850");
+			csMap.put("IBM852", "IBM852");
+			csMap.put("IBM852", "IBM852");
+			csMap.put("852", "IBM852");
+			csMap.put("ibm-852", "IBM852");
+			csMap.put("csPCp852", "IBM852");
+			csMap.put("cp852", "IBM852");
+			csMap.put("ibm852", "IBM852");
+			csMap.put("IBM855", "IBM855");
+			csMap.put("IBM855", "IBM855");
+			csMap.put("855", "IBM855");
+			csMap.put("ibm855", "IBM855");
+			csMap.put("cp855", "IBM855");
+			csMap.put("cspcp855", "IBM855");
+			csMap.put("ibm-855", "IBM855");
+			csMap.put("IBM857", "IBM857");
+			csMap.put("IBM857", "IBM857");
+			csMap.put("cp857", "IBM857");
+			csMap.put("ibm857", "IBM857");
+			csMap.put("csIBM857", "IBM857");
+			csMap.put("857", "IBM857");
+			csMap.put("ibm-857", "IBM857");
+			csMap.put("IBM860", "IBM860");
+			csMap.put("IBM860", "IBM860");
+			csMap.put("ibm860", "IBM860");
+			csMap.put("ibm-860", "IBM860");
+			csMap.put("csIBM860", "IBM860");
+			csMap.put("cp860", "IBM860");
+			csMap.put("860", "IBM860");
+			csMap.put("IBM861", "IBM861");
+			csMap.put("IBM861", "IBM861");
+			csMap.put("csIBM861", "IBM861");
+			csMap.put("ibm861", "IBM861");
+			csMap.put("861", "IBM861");
+			csMap.put("cp861", "IBM861");
+			csMap.put("ibm-861", "IBM861");
+			csMap.put("IBM862", "IBM862");
+			csMap.put("IBM862", "IBM862");
+			csMap.put("cp862", "IBM862");
+			csMap.put("ibm862", "IBM862");
+			csMap.put("862", "IBM862");
+			csMap.put("ibm-862", "IBM862");
+			csMap.put("csIBM862", "IBM862");
+			csMap.put("IBM863", "IBM863");
+			csMap.put("IBM863", "IBM863");
+			csMap.put("cp863", "IBM863");
+			csMap.put("csIBM863", "IBM863");
+			csMap.put("ibm863", "IBM863");
+			csMap.put("863", "IBM863");
+			csMap.put("ibm-863", "IBM863");
+			csMap.put("IBM864", "IBM864");
+			csMap.put("IBM864", "IBM864");
+			csMap.put("csIBM864", "IBM864");
+			csMap.put("ibm-864", "IBM864");
+			csMap.put("864", "IBM864");
+			csMap.put("ibm864", "IBM864");
+			csMap.put("cp864", "IBM864");
+			csMap.put("IBM865", "IBM865");
+			csMap.put("IBM865", "IBM865");
+			csMap.put("ibm-865", "IBM865");
+			csMap.put("csIBM865", "IBM865");
+			csMap.put("865", "IBM865");
+			csMap.put("ibm865", "IBM865");
+			csMap.put("cp865", "IBM865");
+			csMap.put("IBM866", "IBM866");
+			csMap.put("IBM866", "IBM866");
+			csMap.put("866", "IBM866");
+			csMap.put("ibm-866", "IBM866");
+			csMap.put("csIBM866", "IBM866");
+			csMap.put("ibm866", "IBM866");
+			csMap.put("cp866", "IBM866");
+			csMap.put("IBM868", "IBM868");
+			csMap.put("IBM868", "IBM868");
+			csMap.put("cp-ar", "IBM868");
+			csMap.put("868", "IBM868");
+			csMap.put("ibm868", "IBM868");
+			csMap.put("csIBM868", "IBM868");
+			csMap.put("ibm-868", "IBM868");
+			csMap.put("cp868", "IBM868");
+			csMap.put("IBM869", "IBM869");
+			csMap.put("IBM869", "IBM869");
+			csMap.put("ibm869", "IBM869");
+			csMap.put("ibm-869", "IBM869");
+			csMap.put("869", "IBM869");
+			csMap.put("cp869", "IBM869");
+			csMap.put("csIBM869", "IBM869");
+			csMap.put("cp-gr", "IBM869");
+			csMap.put("IBM870", "IBM870");
+			csMap.put("IBM870", "IBM870");
+			csMap.put("ebcdic-cp-yu", "IBM870");
+			csMap.put("ibm870", "IBM870");
+			csMap.put("ibm-870", "IBM870");
+			csMap.put("870", "IBM870");
+			csMap.put("csIBM870", "IBM870");
+			csMap.put("cp870", "IBM870");
+			csMap.put("ebcdic-cp-roece", "IBM870");
+			csMap.put("IBM871", "IBM871");
+			csMap.put("IBM871", "IBM871");
+			csMap.put("csIBM871", "IBM871");
+			csMap.put("ibm-871", "IBM871");
+			csMap.put("cp871", "IBM871");
+			csMap.put("ebcdic-cp-is", "IBM871");
+			csMap.put("871", "IBM871");
+			csMap.put("ibm871", "IBM871");
+			csMap.put("IBM918", "IBM918");
+			csMap.put("IBM918", "IBM918");
+			csMap.put("ibm-918", "IBM918");
+			csMap.put("918", "IBM918");
+			csMap.put("cp918", "IBM918");
+			csMap.put("ebcdic-cp-ar2", "IBM918");
+			csMap.put("ISO-2022-CN", "ISO-2022-CN");
+			csMap.put("ISO-2022-CN", "ISO-2022-CN");
+			csMap.put("csISO2022CN", "ISO-2022-CN");
+			csMap.put("ISO2022CN", "ISO-2022-CN");
+			csMap.put("ISO-2022-JP", "ISO-2022-JP");
+			csMap.put("ISO-2022-JP", "ISO-2022-JP");
+			csMap.put("jis", "ISO-2022-JP");
+			csMap.put("jis_encoding", "ISO-2022-JP");
+			csMap.put("csjisencoding", "ISO-2022-JP");
+			csMap.put("csISO2022JP", "ISO-2022-JP");
+			csMap.put("iso2022jp", "ISO-2022-JP");
+			csMap.put("ISO-2022-KR", "ISO-2022-KR");
+			csMap.put("ISO-2022-KR", "ISO-2022-KR");
+			csMap.put("ISO2022KR", "ISO-2022-KR");
+			csMap.put("csISO2022KR", "ISO-2022-KR");
+			csMap.put("ISO-8859-1", "ISO-8859-1");
+			csMap.put("ISO-8859-1", "ISO-8859-1");
+			csMap.put("iso-ir-100", "ISO-8859-1");
+			csMap.put("8859_1", "ISO-8859-1");
+			csMap.put("ISO_8859-1", "ISO-8859-1");
+			csMap.put("ISO8859_1", "ISO-8859-1");
+			csMap.put("819", "ISO-8859-1");
+			csMap.put("csISOLatin1", "ISO-8859-1");
+			csMap.put("IBM-819", "ISO-8859-1");
+			csMap.put("ISO_8859-1:1987", "ISO-8859-1");
+			csMap.put("latin1", "ISO-8859-1");
+			csMap.put("cp819", "ISO-8859-1");
+			csMap.put("ISO8859-1", "ISO-8859-1");
+			csMap.put("IBM819", "ISO-8859-1");
+			csMap.put("ISO_8859_1", "ISO-8859-1");
+			csMap.put("l1", "ISO-8859-1");
+			csMap.put("ISO-8859-13", "ISO-8859-13");
+			csMap.put("ISO-8859-13", "ISO-8859-13");
+			csMap.put("ISO8859-13", "ISO-8859-13");
+			csMap.put("8859_13", "ISO-8859-13");
+			csMap.put("iso8859_13", "ISO-8859-13");
+			csMap.put("iso_8859-13", "ISO-8859-13");
+			csMap.put("ISO-8859-15", "ISO-8859-15");
+			csMap.put("ISO-8859-15", "ISO-8859-15");
+			csMap.put("8859_15", "ISO-8859-15");
+			csMap.put("csISOlatin9", "ISO-8859-15");
+			csMap.put("IBM923", "ISO-8859-15");
+			csMap.put("cp923", "ISO-8859-15");
+			csMap.put("923", "ISO-8859-15");
+			csMap.put("L9", "ISO-8859-15");
+			csMap.put("IBM-923", "ISO-8859-15");
+			csMap.put("ISO8859-15", "ISO-8859-15");
+			csMap.put("LATIN9", "ISO-8859-15");
+			csMap.put("ISO_8859-15", "ISO-8859-15");
+			csMap.put("LATIN0", "ISO-8859-15");
+			csMap.put("csISOlatin0", "ISO-8859-15");
+			csMap.put("ISO8859_15_FDIS", "ISO-8859-15");
+			csMap.put("ISO-8859-15", "ISO-8859-15");
+			csMap.put("ISO8859_15", "ISO-8859-15");
+			csMap.put("ISO-8859-2", "ISO-8859-2");
+			csMap.put("ISO-8859-2", "ISO-8859-2");
+			csMap.put("ibm912", "ISO-8859-2");
+			csMap.put("l2", "ISO-8859-2");
+			csMap.put("ibm-912", "ISO-8859-2");
+			csMap.put("cp912", "ISO-8859-2");
+			csMap.put("ISO_8859-2:1987", "ISO-8859-2");
+			csMap.put("ISO_8859-2", "ISO-8859-2");
+			csMap.put("latin2", "ISO-8859-2");
+			csMap.put("csISOLatin2", "ISO-8859-2");
+			csMap.put("iso8859_2", "ISO-8859-2");
+			csMap.put("912", "ISO-8859-2");
+			csMap.put("8859_2", "ISO-8859-2");
+			csMap.put("ISO8859-2", "ISO-8859-2");
+			csMap.put("iso-ir-101", "ISO-8859-2");
+			csMap.put("ISO-8859-3", "ISO-8859-3");
+			csMap.put("ISO-8859-3", "ISO-8859-3");
+			csMap.put("iso8859_3", "ISO-8859-3");
+			csMap.put("cp913", "ISO-8859-3");
+			csMap.put("csISOLatin3", "ISO-8859-3");
+			csMap.put("ibm-913", "ISO-8859-3");
+			csMap.put("ISO_8859-3", "ISO-8859-3");
+			csMap.put("913", "ISO-8859-3");
+			csMap.put("ISO8859-3", "ISO-8859-3");
+			csMap.put("8859_3", "ISO-8859-3");
+			csMap.put("ibm913", "ISO-8859-3");
+			csMap.put("iso-ir-109", "ISO-8859-3");
+			csMap.put("ISO_8859-3:1988", "ISO-8859-3");
+			csMap.put("latin3", "ISO-8859-3");
+			csMap.put("l3", "ISO-8859-3");
+			csMap.put("ISO-8859-4", "ISO-8859-4");
+			csMap.put("ISO-8859-4", "ISO-8859-4");
+			csMap.put("iso-ir-110", "ISO-8859-4");
+			csMap.put("l4", "ISO-8859-4");
+			csMap.put("8859_4", "ISO-8859-4");
+			csMap.put("ibm914", "ISO-8859-4");
+			csMap.put("latin4", "ISO-8859-4");
+			csMap.put("ibm-914", "ISO-8859-4");
+			csMap.put("csISOLatin4", "ISO-8859-4");
+			csMap.put("iso8859_4", "ISO-8859-4");
+			csMap.put("iso8859-4", "ISO-8859-4");
+			csMap.put("cp914", "ISO-8859-4");
+			csMap.put("914", "ISO-8859-4");
+			csMap.put("ISO_8859-4:1988", "ISO-8859-4");
+			csMap.put("ISO_8859-4", "ISO-8859-4");
+			csMap.put("ISO-8859-5", "ISO-8859-5");
+			csMap.put("ISO-8859-5", "ISO-8859-5");
+			csMap.put("915", "ISO-8859-5");
+			csMap.put("ISO_8859-5:1988", "ISO-8859-5");
+			csMap.put("iso8859_5", "ISO-8859-5");
+			csMap.put("cp915", "ISO-8859-5");
+			csMap.put("ibm915", "ISO-8859-5");
+			csMap.put("ISO_8859-5", "ISO-8859-5");
+			csMap.put("ISO8859-5", "ISO-8859-5");
+			csMap.put("csISOLatinCyrillic", "ISO-8859-5");
+			csMap.put("cyrillic", "ISO-8859-5");
+			csMap.put("8859_5", "ISO-8859-5");
+			csMap.put("iso-ir-144", "ISO-8859-5");
+			csMap.put("ibm-915", "ISO-8859-5");
+			csMap.put("ISO-8859-6", "ISO-8859-6");
+			csMap.put("ISO-8859-6", "ISO-8859-6");
+			csMap.put("8859_6", "ISO-8859-6");
+			csMap.put("arabic", "ISO-8859-6");
+			csMap.put("ibm-1089", "ISO-8859-6");
+			csMap.put("iso8859_6", "ISO-8859-6");
+			csMap.put("ISO_8859-6", "ISO-8859-6");
+			csMap.put("iso-ir-127", "ISO-8859-6");
+			csMap.put("ibm1089", "ISO-8859-6");
+			csMap.put("ISO_8859-6:1987", "ISO-8859-6");
+			csMap.put("ECMA-114", "ISO-8859-6");
+			csMap.put("1089", "ISO-8859-6");
+			csMap.put("csISOLatinArabic", "ISO-8859-6");
+			csMap.put("ISO8859-6", "ISO-8859-6");
+			csMap.put("ASMO-708", "ISO-8859-6");
+			csMap.put("cp1089", "ISO-8859-6");
+			csMap.put("ISO-8859-7", "ISO-8859-7");
+			csMap.put("ISO-8859-7", "ISO-8859-7");
+			csMap.put("sun_eu_greek", "ISO-8859-7");
+			csMap.put("8859_7", "ISO-8859-7");
+			csMap.put("iso-ir-126", "ISO-8859-7");
+			csMap.put("ISO_8859-7:1987", "ISO-8859-7");
+			csMap.put("ibm-813", "ISO-8859-7");
+			csMap.put("iso8859_7", "ISO-8859-7");
+			csMap.put("ISO_8859-7", "ISO-8859-7");
+			csMap.put("csISOLatinGreek", "ISO-8859-7");
+			csMap.put("greek8", "ISO-8859-7");
+			csMap.put("ECMA-118", "ISO-8859-7");
+			csMap.put("ibm813", "ISO-8859-7");
+			csMap.put("ELOT_928", "ISO-8859-7");
+			csMap.put("iso8859-7", "ISO-8859-7");
+			csMap.put("cp813", "ISO-8859-7");
+			csMap.put("greek", "ISO-8859-7");
+			csMap.put("813", "ISO-8859-7");
+			csMap.put("ISO-8859-8", "ISO-8859-8");
+			csMap.put("ISO-8859-8", "ISO-8859-8");
+			csMap.put("iso-ir-138", "ISO-8859-8");
+			csMap.put("ibm-916", "ISO-8859-8");
+			csMap.put("iso8859_8", "ISO-8859-8");
+			csMap.put("cp916", "ISO-8859-8");
+			csMap.put("ISO8859-8", "ISO-8859-8");
+			csMap.put("ISO_8859-8:1988", "ISO-8859-8");
+			csMap.put("hebrew", "ISO-8859-8");
+			csMap.put("8859_8", "ISO-8859-8");
+			csMap.put("csISOLatinHebrew", "ISO-8859-8");
+			csMap.put("ibm916", "ISO-8859-8");
+			csMap.put("916", "ISO-8859-8");
+			csMap.put("ISO_8859-8", "ISO-8859-8");
+			csMap.put("ISO-8859-9", "ISO-8859-9");
+			csMap.put("ISO-8859-9", "ISO-8859-9");
+			csMap.put("cp920", "ISO-8859-9");
+			csMap.put("l5", "ISO-8859-9");
+			csMap.put("ISO_8859-9", "ISO-8859-9");
+			csMap.put("ibm-920", "ISO-8859-9");
+			csMap.put("csISOLatin5", "ISO-8859-9");
+			csMap.put("8859_9", "ISO-8859-9");
+			csMap.put("iso-ir-148", "ISO-8859-9");
+			csMap.put("latin5", "ISO-8859-9");
+			csMap.put("920", "ISO-8859-9");
+			csMap.put("ISO8859-9", "ISO-8859-9");
+			csMap.put("ibm920", "ISO-8859-9");
+			csMap.put("ISO_8859-9:1989", "ISO-8859-9");
+			csMap.put("iso8859_9", "ISO-8859-9");
+			csMap.put("JIS_X0201", "JIS_X0201");
+			csMap.put("JIS_X0201", "JIS_X0201");
+			csMap.put("JIS_X0201", "JIS_X0201");
+			csMap.put("X0201", "JIS_X0201");
+			csMap.put("JIS0201", "JIS_X0201");
+			csMap.put("csHalfWidthKatakana", "JIS_X0201");
+			csMap.put("JIS_X0212-1990", "JIS_X0212-1990");
+			csMap.put("JIS_X0212-1990", "JIS_X0212-1990");
+			csMap.put("jis_x0212-1990", "JIS_X0212-1990");
+			csMap.put("iso-ir-159", "JIS_X0212-1990");
+			csMap.put("x0212", "JIS_X0212-1990");
+			csMap.put("JIS0212", "JIS_X0212-1990");
+			csMap.put("csISO159JISX02121990", "JIS_X0212-1990");
+			csMap.put("KOI8-R", "KOI8-R");
+			csMap.put("KOI8-R", "KOI8-R");
+			csMap.put("koi8", "KOI8-R");
+			csMap.put("koi8_r", "KOI8-R");
+			csMap.put("cskoi8r", "KOI8-R");
+			csMap.put("Shift_JIS", "Shift_JIS");
+			csMap.put("Shift_JIS", "Shift_JIS");
+			csMap.put("shift-jis", "Shift_JIS");
+			csMap.put("shift_jis", "Shift_JIS");
+			csMap.put("x-sjis", "Shift_JIS");
+			csMap.put("ms_kanji", "Shift_JIS");
+			csMap.put("csShiftJIS", "Shift_JIS");
+			csMap.put("sjis", "Shift_JIS");
+			csMap.put("TIS-620", "TIS-620");
+			csMap.put("TIS-620", "TIS-620");
+			csMap.put("tis620.2533", "TIS-620");
+			csMap.put("tis620", "TIS-620");
+			csMap.put("US-ASCII", "US-ASCII");
+			csMap.put("US-ASCII", "US-ASCII");
+			csMap.put("ISO646-US", "US-ASCII");
+			csMap.put("IBM367", "US-ASCII");
+			csMap.put("ASCII", "US-ASCII");
+			csMap.put("cp367", "US-ASCII");
+			csMap.put("default", "US-ASCII");
+			csMap.put("ascii7", "US-ASCII");
+			csMap.put("ANSI_X3.4-1986", "US-ASCII");
+			csMap.put("iso-ir-6", "US-ASCII");
+			csMap.put("us", "US-ASCII");
+			csMap.put("646", "US-ASCII");
+			csMap.put("iso_646.irv:1983", "US-ASCII");
+			csMap.put("csASCII", "US-ASCII");
+			csMap.put("ANSI_X3.4-1968", "US-ASCII");
+			csMap.put("ISO_646.irv:1991", "US-ASCII");
+			csMap.put("UTF-16", "UTF-16");
+			csMap.put("UTF-16", "UTF-16");
+			csMap.put("utf16", "UTF-16");
+			csMap.put("UTF_16", "UTF-16");
+			csMap.put("UTF-16BE", "UTF-16BE");
+			csMap.put("UTF-16BE", "UTF-16BE");
+			csMap.put("X-UTF-16BE", "UTF-16BE");
+			csMap.put("UnicodeBigUnmarked", "UTF-16BE");
+			csMap.put("UTF_16BE", "UTF-16BE");
+			csMap.put("ISO-10646-UCS-2", "UTF-16BE");
+			csMap.put("UTF-16LE", "UTF-16LE");
+			csMap.put("UTF-16LE", "UTF-16LE");
+			csMap.put("UnicodeLittleUnmarked", "UTF-16LE");
+			csMap.put("X-UTF-16LE", "UTF-16LE");
+			csMap.put("UTF_16LE", "UTF-16LE");
+			csMap.put("UTF-8", "UTF-8");
+			csMap.put("UTF-8", "UTF-8");
+			csMap.put("UTF8", "UTF-8");
+			csMap.put("unicode-1-1-utf-8", "UTF-8");
+			csMap.put("windows-1250", "windows-1250");
+			csMap.put("windows-1250", "windows-1250");
+			csMap.put("cp1250", "windows-1250");
+			csMap.put("cp5346", "windows-1250");
+			csMap.put("windows-1251", "windows-1251");
+			csMap.put("windows-1251", "windows-1251");
+			csMap.put("ansi-1251", "windows-1251");
+			csMap.put("cp1251", "windows-1251");
+			csMap.put("cp5347", "windows-1251");
+			csMap.put("windows-1252", "windows-1252");
+			csMap.put("windows-1252", "windows-1252");
+			csMap.put("cp1252", "windows-1252");
+			csMap.put("cp5348", "windows-1252");
+			csMap.put("windows-1253", "windows-1253");
+			csMap.put("windows-1253", "windows-1253");
+			csMap.put("cp1253", "windows-1253");
+			csMap.put("cp5349", "windows-1253");
+			csMap.put("windows-1254", "windows-1254");
+			csMap.put("windows-1254", "windows-1254");
+			csMap.put("cp5350", "windows-1254");
+			csMap.put("cp1254", "windows-1254");
+			csMap.put("windows-1255", "windows-1255");
+			csMap.put("windows-1255", "windows-1255");
+			csMap.put("cp1255", "windows-1255");
+			csMap.put("windows-1256", "windows-1256");
+			csMap.put("windows-1256", "windows-1256");
+			csMap.put("cp1256", "windows-1256");
+			csMap.put("windows-1257", "windows-1257");
+			csMap.put("windows-1257", "windows-1257");
+			csMap.put("cp1257", "windows-1257");
+			csMap.put("cp5353", "windows-1257");
+			csMap.put("windows-1258", "windows-1258");
+			csMap.put("windows-1258", "windows-1258");
+			csMap.put("cp1258", "windows-1258");
+			csMap.put("windows-31j", "windows-31j");
+			csMap.put("windows-31j", "windows-31j");
+			csMap.put("csWindows31J", "windows-31j");
+			csMap.put("windows-932", "windows-31j");
+			csMap.put("MS932", "windows-31j");
+			csMap.put("x-Big5-Solaris", "x-Big5-Solaris");
+			csMap.put("x-Big5-Solaris", "x-Big5-Solaris");
+			csMap.put("Big5_Solaris", "x-Big5-Solaris");
+			csMap.put("x-euc-jp-linux", "x-euc-jp-linux");
+			csMap.put("x-euc-jp-linux", "x-euc-jp-linux");
+			csMap.put("euc_jp_linux", "x-euc-jp-linux");
+			csMap.put("euc-jp-linux", "x-euc-jp-linux");
+			csMap.put("x-EUC-TW", "x-EUC-TW");
+			csMap.put("x-EUC-TW", "x-EUC-TW");
+			csMap.put("cns11643", "x-EUC-TW");
+			csMap.put("euc_tw", "x-EUC-TW");
+			csMap.put("EUC-TW", "x-EUC-TW");
+			csMap.put("euctw", "x-EUC-TW");
+			csMap.put("x-eucJP-Open", "x-eucJP-Open");
+			csMap.put("x-eucJP-Open", "x-eucJP-Open");
+			csMap.put("EUC_JP_Solaris", "x-eucJP-Open");
+			csMap.put("eucJP-open", "x-eucJP-Open");
+			csMap.put("x-IBM1006", "x-IBM1006");
+			csMap.put("x-IBM1006", "x-IBM1006");
+			csMap.put("cp1006", "x-IBM1006");
+			csMap.put("ibm1006", "x-IBM1006");
+			csMap.put("1006", "x-IBM1006");
+			csMap.put("ibm-1006", "x-IBM1006");
+			csMap.put("x-IBM1025", "x-IBM1025");
+			csMap.put("x-IBM1025", "x-IBM1025");
+			csMap.put("ibm1025", "x-IBM1025");
+			csMap.put("1025", "x-IBM1025");
+			csMap.put("cp1025", "x-IBM1025");
+			csMap.put("ibm-1025", "x-IBM1025");
+			csMap.put("x-IBM1046", "x-IBM1046");
+			csMap.put("x-IBM1046", "x-IBM1046");
+			csMap.put("ibm1046", "x-IBM1046");
+			csMap.put("1046", "x-IBM1046");
+			csMap.put("cp1046", "x-IBM1046");
+			csMap.put("ibm-1046", "x-IBM1046");
+			csMap.put("x-IBM1097", "x-IBM1097");
+			csMap.put("x-IBM1097", "x-IBM1097");
+			csMap.put("ibm1097", "x-IBM1097");
+			csMap.put("1097", "x-IBM1097");
+			csMap.put("cp1097", "x-IBM1097");
+			csMap.put("ibm-1097", "x-IBM1097");
+			csMap.put("x-IBM1098", "x-IBM1098");
+			csMap.put("x-IBM1098", "x-IBM1098");
+			csMap.put("cp1098", "x-IBM1098");
+			csMap.put("ibm-1098", "x-IBM1098");
+			csMap.put("ibm1098", "x-IBM1098");
+			csMap.put("1098", "x-IBM1098");
+			csMap.put("x-IBM1112", "x-IBM1112");
+			csMap.put("x-IBM1112", "x-IBM1112");
+			csMap.put("cp1112", "x-IBM1112");
+			csMap.put("1112", "x-IBM1112");
+			csMap.put("ibm1112", "x-IBM1112");
+			csMap.put("ibm-1112", "x-IBM1112");
+			csMap.put("x-IBM1122", "x-IBM1122");
+			csMap.put("x-IBM1122", "x-IBM1122");
+			csMap.put("ibm-1122", "x-IBM1122");
+			csMap.put("1122", "x-IBM1122");
+			csMap.put("cp1122", "x-IBM1122");
+			csMap.put("ibm1122", "x-IBM1122");
+			csMap.put("x-IBM1123", "x-IBM1123");
+			csMap.put("x-IBM1123", "x-IBM1123");
+			csMap.put("cp1123", "x-IBM1123");
+			csMap.put("ibm1123", "x-IBM1123");
+			csMap.put("ibm-1123", "x-IBM1123");
+			csMap.put("1123", "x-IBM1123");
+			csMap.put("x-IBM1124", "x-IBM1124");
+			csMap.put("x-IBM1124", "x-IBM1124");
+			csMap.put("cp1124", "x-IBM1124");
+			csMap.put("ibm1124", "x-IBM1124");
+			csMap.put("ibm-1124", "x-IBM1124");
+			csMap.put("1124", "x-IBM1124");
+			csMap.put("x-IBM1381", "x-IBM1381");
+			csMap.put("x-IBM1381", "x-IBM1381");
+			csMap.put("1381", "x-IBM1381");
+			csMap.put("cp1381", "x-IBM1381");
+			csMap.put("ibm1381", "x-IBM1381");
+			csMap.put("ibm-1381", "x-IBM1381");
+			csMap.put("x-IBM1383", "x-IBM1383");
+			csMap.put("x-IBM1383", "x-IBM1383");
+			csMap.put("ibm1383", "x-IBM1383");
+			csMap.put("ibm-1383", "x-IBM1383");
+			csMap.put("cp1383", "x-IBM1383");
+			csMap.put("1383", "x-IBM1383");
+			csMap.put("x-IBM33722", "x-IBM33722");
+			csMap.put("x-IBM33722", "x-IBM33722");
+			csMap.put("ibm-33722", "x-IBM33722");
+			csMap.put("cp33722", "x-IBM33722");
+			csMap.put("ibm-33722_vascii_vpua", "x-IBM33722");
+			csMap.put("ibm-5050", "x-IBM33722");
+			csMap.put("ibm33722", "x-IBM33722");
+			csMap.put("33722", "x-IBM33722");
+			csMap.put("x-IBM737", "x-IBM737");
+			csMap.put("x-IBM737", "x-IBM737");
+			csMap.put("ibm-737", "x-IBM737");
+			csMap.put("ibm737", "x-IBM737");
+			csMap.put("cp737", "x-IBM737");
+			csMap.put("737", "x-IBM737");
+			csMap.put("x-IBM834", "x-IBM834");
+			csMap.put("x-IBM834", "x-IBM834");
+			csMap.put("cp834", "x-IBM834");
+			csMap.put("ibm-834", "x-IBM834");
+			csMap.put("ibm834", "x-IBM834");
+			csMap.put("x-IBM856", "x-IBM856");
+			csMap.put("x-IBM856", "x-IBM856");
+			csMap.put("ibm-856", "x-IBM856");
+			csMap.put("856", "x-IBM856");
+			csMap.put("ibm856", "x-IBM856");
+			csMap.put("cp856", "x-IBM856");
+			csMap.put("x-IBM874", "x-IBM874");
+			csMap.put("x-IBM874", "x-IBM874");
+			csMap.put("cp874", "x-IBM874");
+			csMap.put("ibm874", "x-IBM874");
+			csMap.put("ibm-874", "x-IBM874");
+			csMap.put("874", "x-IBM874");
+			csMap.put("x-IBM875", "x-IBM875");
+			csMap.put("x-IBM875", "x-IBM875");
+			csMap.put("ibm875", "x-IBM875");
+			csMap.put("ibm-875", "x-IBM875");
+			csMap.put("875", "x-IBM875");
+			csMap.put("cp875", "x-IBM875");
+			csMap.put("x-IBM921", "x-IBM921");
+			csMap.put("x-IBM921", "x-IBM921");
+			csMap.put("921", "x-IBM921");
+			csMap.put("cp921", "x-IBM921");
+			csMap.put("ibm921", "x-IBM921");
+			csMap.put("ibm-921", "x-IBM921");
+			csMap.put("x-IBM922", "x-IBM922");
+			csMap.put("x-IBM922", "x-IBM922");
+			csMap.put("cp922", "x-IBM922");
+			csMap.put("ibm922", "x-IBM922");
+			csMap.put("ibm-922", "x-IBM922");
+			csMap.put("922", "x-IBM922");
+			csMap.put("x-IBM930", "x-IBM930");
+			csMap.put("x-IBM930", "x-IBM930");
+			csMap.put("cp930", "x-IBM930");
+			csMap.put("930", "x-IBM930");
+			csMap.put("ibm930", "x-IBM930");
+			csMap.put("ibm-930", "x-IBM930");
+			csMap.put("x-IBM933", "x-IBM933");
+			csMap.put("x-IBM933", "x-IBM933");
+			csMap.put("ibm933", "x-IBM933");
+			csMap.put("cp933", "x-IBM933");
+			csMap.put("933", "x-IBM933");
+			csMap.put("ibm-933", "x-IBM933");
+			csMap.put("x-IBM935", "x-IBM935");
+			csMap.put("x-IBM935", "x-IBM935");
+			csMap.put("935", "x-IBM935");
+			csMap.put("cp935", "x-IBM935");
+			csMap.put("ibm935", "x-IBM935");
+			csMap.put("ibm-935", "x-IBM935");
+			csMap.put("x-IBM937", "x-IBM937");
+			csMap.put("x-IBM937", "x-IBM937");
+			csMap.put("cp937", "x-IBM937");
+			csMap.put("ibm-937", "x-IBM937");
+			csMap.put("ibm937", "x-IBM937");
+			csMap.put("937", "x-IBM937");
+			csMap.put("x-IBM939", "x-IBM939");
+			csMap.put("x-IBM939", "x-IBM939");
+			csMap.put("ibm-939", "x-IBM939");
+			csMap.put("ibm939", "x-IBM939");
+			csMap.put("cp939", "x-IBM939");
+			csMap.put("939", "x-IBM939");
+			csMap.put("x-IBM942", "x-IBM942");
+			csMap.put("x-IBM942", "x-IBM942");
+			csMap.put("cp942", "x-IBM942");
+			csMap.put("ibm942", "x-IBM942");
+			csMap.put("ibm-942", "x-IBM942");
+			csMap.put("942", "x-IBM942");
+			csMap.put("x-IBM942C", "x-IBM942C");
+			csMap.put("x-IBM942C", "x-IBM942C");
+			csMap.put("ibm942C", "x-IBM942C");
+			csMap.put("cp942C", "x-IBM942C");
+			csMap.put("ibm-942C", "x-IBM942C");
+			csMap.put("942C", "x-IBM942C");
+			csMap.put("x-IBM943", "x-IBM943");
+			csMap.put("x-IBM943", "x-IBM943");
+			csMap.put("ibm943", "x-IBM943");
+			csMap.put("ibm-943", "x-IBM943");
+			csMap.put("cp943", "x-IBM943");
+			csMap.put("943", "x-IBM943");
+			csMap.put("x-IBM943C", "x-IBM943C");
+			csMap.put("x-IBM943C", "x-IBM943C");
+			csMap.put("ibm-943C", "x-IBM943C");
+			csMap.put("ibm943C", "x-IBM943C");
+			csMap.put("943C", "x-IBM943C");
+			csMap.put("cp943C", "x-IBM943C");
+			csMap.put("x-IBM948", "x-IBM948");
+			csMap.put("x-IBM948", "x-IBM948");
+			csMap.put("948", "x-IBM948");
+			csMap.put("ibm-948", "x-IBM948");
+			csMap.put("cp948", "x-IBM948");
+			csMap.put("ibm948", "x-IBM948");
+			csMap.put("x-IBM949", "x-IBM949");
+			csMap.put("x-IBM949", "x-IBM949");
+			csMap.put("ibm-949", "x-IBM949");
+			csMap.put("cp949", "x-IBM949");
+			csMap.put("949", "x-IBM949");
+			csMap.put("ibm949", "x-IBM949");
+			csMap.put("x-IBM949C", "x-IBM949C");
+			csMap.put("x-IBM949C", "x-IBM949C");
+			csMap.put("cp949C", "x-IBM949C");
+			csMap.put("949C", "x-IBM949C");
+			csMap.put("ibm949C", "x-IBM949C");
+			csMap.put("ibm-949C", "x-IBM949C");
+			csMap.put("x-IBM950", "x-IBM950");
+			csMap.put("x-IBM950", "x-IBM950");
+			csMap.put("950", "x-IBM950");
+			csMap.put("cp950", "x-IBM950");
+			csMap.put("ibm-950", "x-IBM950");
+			csMap.put("ibm950", "x-IBM950");
+			csMap.put("x-IBM964", "x-IBM964");
+			csMap.put("x-IBM964", "x-IBM964");
+			csMap.put("964", "x-IBM964");
+			csMap.put("cp964", "x-IBM964");
+			csMap.put("ibm-964", "x-IBM964");
+			csMap.put("ibm964", "x-IBM964");
+			csMap.put("x-IBM970", "x-IBM970");
+			csMap.put("x-IBM970", "x-IBM970");
+			csMap.put("ibm970", "x-IBM970");
+			csMap.put("970", "x-IBM970");
+			csMap.put("cp970", "x-IBM970");
+			csMap.put("ibm-eucKR", "x-IBM970");
+			csMap.put("ibm-970", "x-IBM970");
+			csMap.put("x-ISCII91", "x-ISCII91");
+			csMap.put("x-ISCII91", "x-ISCII91");
+			csMap.put("iscii", "x-ISCII91");
+			csMap.put("ST_SEV_358-88", "x-ISCII91");
+			csMap.put("iso-ir-153", "x-ISCII91");
+			csMap.put("csISO153GOST1976874", "x-ISCII91");
+			csMap.put("ISCII91", "x-ISCII91");
+			csMap.put("x-ISO-2022-CN-CNS", "x-ISO-2022-CN-CNS");
+			csMap.put("x-ISO-2022-CN-CNS", "x-ISO-2022-CN-CNS");
+			csMap.put("ISO2022CN_CNS", "x-ISO-2022-CN-CNS");
+			csMap.put("ISO-2022-CN-CNS", "x-ISO-2022-CN-CNS");
+			csMap.put("x-ISO-2022-CN-GB", "x-ISO-2022-CN-GB");
+			csMap.put("x-ISO-2022-CN-GB", "x-ISO-2022-CN-GB");
+			csMap.put("ISO-2022-CN-GB", "x-ISO-2022-CN-GB");
+			csMap.put("ISO2022CN_GB", "x-ISO-2022-CN-GB");
+			csMap.put("x-iso-8859-11", "x-iso-8859-11");
+			csMap.put("x-iso-8859-11", "x-iso-8859-11");
+			csMap.put("iso-8859-11", "x-iso-8859-11");
+			csMap.put("iso8859_11", "x-iso-8859-11");
+			csMap.put("x-JIS0208", "x-JIS0208");
+			csMap.put("x-JIS0208", "x-JIS0208");
+			csMap.put("JIS0208", "x-JIS0208");
+			csMap.put("csISO87JISX0208", "x-JIS0208");
+			csMap.put("x0208", "x-JIS0208");
+			csMap.put("JIS_C6226-1983", "x-JIS0208");
+			csMap.put("JIS_X0208-1983", "x-JIS0208");
+			csMap.put("iso-ir-87", "x-JIS0208");
+			csMap.put("x-JISAutoDetect", "x-JISAutoDetect");
+			csMap.put("x-JISAutoDetect", "x-JISAutoDetect");
+			csMap.put("JISAutoDetect", "x-JISAutoDetect");
+			csMap.put("x-Johab", "x-Johab");
+			csMap.put("x-Johab", "x-Johab");
+			csMap.put("johab", "x-Johab");
+			csMap.put("ms1361", "x-Johab");
+			csMap.put("ksc5601-1992", "x-Johab");
+			csMap.put("ksc5601_1992", "x-Johab");
+			csMap.put("x-MacArabic", "x-MacArabic");
+			csMap.put("x-MacArabic", "x-MacArabic");
+			csMap.put("MacArabic", "x-MacArabic");
+			csMap.put("x-MacCentralEurope", "x-MacCentralEurope");
+			csMap.put("x-MacCentralEurope", "x-MacCentralEurope");
+			csMap.put("MacCentralEurope", "x-MacCentralEurope");
+			csMap.put("x-MacCroatian", "x-MacCroatian");
+			csMap.put("x-MacCroatian", "x-MacCroatian");
+			csMap.put("MacCroatian", "x-MacCroatian");
+			csMap.put("x-MacCyrillic", "x-MacCyrillic");
+			csMap.put("x-MacCyrillic", "x-MacCyrillic");
+			csMap.put("MacCyrillic", "x-MacCyrillic");
+			csMap.put("x-MacDingbat", "x-MacDingbat");
+			csMap.put("x-MacDingbat", "x-MacDingbat");
+			csMap.put("MacDingbat", "x-MacDingbat");
+			csMap.put("x-MacGreek", "x-MacGreek");
+			csMap.put("x-MacGreek", "x-MacGreek");
+			csMap.put("MacGreek", "x-MacGreek");
+			csMap.put("x-MacHebrew", "x-MacHebrew");
+			csMap.put("x-MacHebrew", "x-MacHebrew");
+			csMap.put("MacHebrew", "x-MacHebrew");
+			csMap.put("x-MacIceland", "x-MacIceland");
+			csMap.put("x-MacIceland", "x-MacIceland");
+			csMap.put("MacIceland", "x-MacIceland");
+			csMap.put("x-MacRoman", "x-MacRoman");
+			csMap.put("x-MacRoman", "x-MacRoman");
+			csMap.put("MacRoman", "x-MacRoman");
+			csMap.put("x-MacRomania", "x-MacRomania");
+			csMap.put("x-MacRomania", "x-MacRomania");
+			csMap.put("MacRomania", "x-MacRomania");
+			csMap.put("x-MacSymbol", "x-MacSymbol");
+			csMap.put("x-MacSymbol", "x-MacSymbol");
+			csMap.put("MacSymbol", "x-MacSymbol");
+			csMap.put("x-MacThai", "x-MacThai");
+			csMap.put("x-MacThai", "x-MacThai");
+			csMap.put("MacThai", "x-MacThai");
+			csMap.put("x-MacTurkish", "x-MacTurkish");
+			csMap.put("x-MacTurkish", "x-MacTurkish");
+			csMap.put("MacTurkish", "x-MacTurkish");
+			csMap.put("x-MacUkraine", "x-MacUkraine");
+			csMap.put("x-MacUkraine", "x-MacUkraine");
+			csMap.put("MacUkraine", "x-MacUkraine");
+			csMap.put("x-MS950-HKSCS", "x-MS950-HKSCS");
+			csMap.put("x-MS950-HKSCS", "x-MS950-HKSCS");
+			csMap.put("MS950_HKSCS", "x-MS950-HKSCS");
+			csMap.put("x-mswin-936", "x-mswin-936");
+			csMap.put("x-mswin-936", "x-mswin-936");
+			csMap.put("ms936", "x-mswin-936");
+			csMap.put("ms_936", "x-mswin-936");
+			csMap.put("x-PCK", "x-PCK");
+			csMap.put("x-PCK", "x-PCK");
+			csMap.put("pck", "x-PCK");
+			csMap.put("x-windows-50220", "x-windows-50220");
+			csMap.put("x-windows-50220", "x-windows-50220");
+			csMap.put("cp50220", "x-windows-50220");
+			csMap.put("ms50220", "x-windows-50220");
+			csMap.put("x-windows-50221", "x-windows-50221");
+			csMap.put("x-windows-50221", "x-windows-50221");
+			csMap.put("ms50221", "x-windows-50221");
+			csMap.put("cp50221", "x-windows-50221");
+			csMap.put("x-windows-874", "x-windows-874");
+			csMap.put("x-windows-874", "x-windows-874");
+			csMap.put("windows-874", "x-windows-874");
+			csMap.put("ms874", "x-windows-874");
+			csMap.put("ms-874", "x-windows-874");
+			csMap.put("x-windows-949", "x-windows-949");
+			csMap.put("x-windows-949", "x-windows-949");
+			csMap.put("windows949", "x-windows-949");
+			csMap.put("ms_949", "x-windows-949");
+			csMap.put("ms949", "x-windows-949");
+			csMap.put("x-windows-950", "x-windows-950");
+			csMap.put("x-windows-950", "x-windows-950");
+			csMap.put("windows-950", "x-windows-950");
+			csMap.put("ms950", "x-windows-950");
+			csMap.put("x-windows-iso2022jp", "x-windows-iso2022jp");
+			csMap.put("x-windows-iso2022jp", "x-windows-iso2022jp");
+			csMap.put("windows-iso2022jp", "x-windows-iso2022jp");
+
+		}
+		return csMap;
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/ChasetMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateReader.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateReader.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateReader.java	(revision 1235)
@@ -0,0 +1,458 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.xml;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentIdentifier;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices.ObjectReference;
+import org.gvsig.tools.persistence.xml.exception.PersistenceEndOfDocumentException;
+import org.gvsig.tools.persistence.xml.exception.PersistenceInvalidValueException;
+import org.gvsig.tools.persistence.xml.exception.PersistenceMissingAttributeException;
+import org.gvsig.tools.persistence.xml.exception.PersistenceParserException;
+import org.gvsig.tools.persistence.xml.exception.PersistenceUnknowTypeException;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class XMLPersistentStateReader implements XMLPersistentConstants {
+	private XMLPersistenceManager manager;
+	private XmlPullParser parser;
+	private PersistentContextServices context;
+
+	public XMLPersistentStateReader(XMLPersistenceManager persistenceManager) {
+		this.manager = persistenceManager;
+	}
+
+	public void read(PersistentContextServices context, XmlPullParser parser)
+			throws PersistenceException {
+		this.parser = parser;
+		this.context = context;
+
+		try {
+			parser.nextTag();
+			parser.require(XmlPullParser.START_TAG, null, ROOT_TAG);
+			parser.nextTag();
+			this.parser.require(XmlPullParser.START_TAG, null, VERSION_TAG);
+			String persistenceVersion = this.parser.nextText();
+			if (!persistenceVersion.trim().equals(manager.version().trim())) {
+				// TODO handle version
+			}
+			parser.require(XmlPullParser.END_TAG, "", VERSION_TAG);
+
+			parser.nextTag();
+			parser.require(XmlPullParser.START_TAG, "", ROOTSTATE_TAG);
+
+			String rootStateIdStr = this.parser.getAttributeValue("",	ROOSTATE_ID_ATTR);
+			if (rootStateIdStr == null){
+				throw new PersistenceMissingAttributeException(this.parser, ROOSTATE_ID_ATTR);
+			}
+			parser.nextTag();
+			this.parser.require(XmlPullParser.END_TAG, "", ROOTSTATE_TAG);
+
+			parser.nextTag();
+			this.parser.require(XmlPullParser.START_TAG, "", STATES_TAG);
+			parser.nextTag();
+
+			PersistentStateServices state;
+			String curTagName, curIdstr, curClassName;
+			//PersistentIdentifier curId;
+			String namespace, stateTagName;
+
+			while (!(parser.getEventType() == XmlPullParser.END_TAG && parser
+					.getName().equals(STATES_TAG))) {
+				checkDocumentEnd();
+				parser.require(XmlPullParser.START_TAG, null, null);
+
+				stateTagName = parser.getName();
+				namespace = parser.getNamespace();
+
+				curIdstr = parser.getAttributeValue(null, STATE_ID_ATTR);
+				if (curIdstr == null){
+					throw new PersistenceMissingAttributeException(parser, STATE_ID_ATTR); 
+				}
+
+				
+				state = this.manager.createPersistentState(context, this.context.getIdentifier(curIdstr));
+				curClassName = getClassNameFromTag(stateTagName);
+				state.setFactory(this.manager.getFactories().get(curClassName));
+				state.setTheClassName(curClassName);				
+				context.add(state,null);
+				
+				
+				parser.nextTag();
+
+				parser.require(XmlPullParser.START_TAG, null, null);
+				while (!(parser.getEventType() == XmlPullParser.END_TAG && parser
+						.getName().equals(stateTagName))) {
+					curTagName = parser.getName();
+					if (VALUE_ITEM_GENERIC.equals(parser.getName())) {
+						// Load value with name and value within tags
+						loadGenericTagValue(state);
+					} else {
+						loadTagValue(state);
+					}
+					parser.require(XmlPullParser.END_TAG, null, curTagName);
+					parser.nextTag();
+					checkDocumentEnd();
+				}
+				parser.require(XmlPullParser.END_TAG, namespace, stateTagName);
+				parser.nextTag();
+
+			}
+
+			context.setRootId( context.getIdentifier(rootStateIdStr));
+			parser.nextTag();
+			this.parser.require(XmlPullParser.END_TAG, "", ROOT_TAG);
+			parser.next();
+			this.parser.require(XmlPullParser.END_DOCUMENT, null, null);
+		} catch (PersistenceException e) {
+			throw e;
+		} catch (PersistenceRuntimeException e) {
+			throw e;
+		} catch (Exception e) {
+			throw new PersistenceParserException(this.parser,  e);
+		}
+	}
+
+	public static String getClassNameFromTag(String stateTagName) {
+		String className = stateTagName;
+		// Remove domain name from the tag
+		int index = className.indexOf(":");
+		if (index > -1) {
+			className = className.substring(index + 1);
+		}
+		// Replace .. with the $ char for inner class names
+		while ((index = className.indexOf("..")) > 0) {
+			className =
+					className.substring(0, index).concat("$").concat(
+							className.substring(index + 2));
+		}
+		while ((index = className.indexOf("__")) > 0) {
+			className =
+					className.substring(0, index).concat(":").concat(
+							className.substring(index + 2));
+		}
+
+		return className;
+	}
+
+	private void loadTagValue(PersistentStateServices state)
+			throws XmlPullParserException, IOException, PersistenceException {
+		String type = parser.getAttributeValue(null, VALUE_TYPE_ATTR);
+		if (type == null) {
+			throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+		}
+		String name = parser.getName();
+		state.setValue(name, getValue(type));
+		// position end tag of {name}
+
+	}
+
+	private void loadGenericTagValue(PersistentStateServices state)
+			throws XmlPullParserException, IOException, PersistenceException {
+		String type = parser.getAttributeValue(null, VALUE_TYPE_ATTR);
+		if (type == null) {
+			throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+
+		}
+		parser.nextTag();
+		parser.require(XmlPullParser.START_TAG, "", NAMEVALUE_TAG);
+		String name = parser.nextText();
+		parser.require(XmlPullParser.END_TAG, "", NAMEVALUE_TAG);
+		parser.nextTag();
+		parser.require(XmlPullParser.START_TAG, "", DATAVALUE_TAG);
+		state.setValue(name, getValue(type));
+		parser.require(XmlPullParser.END_TAG, "", DATAVALUE_TAG);
+		parser.nextTag();
+		// position end tag 'value'
+	}
+
+	private Object getValue(String type) throws XmlPullParserException,
+			IOException, PersistenceException {
+		if (type.equals(TYPE_NULL)) {
+			parser.nextTag();
+			return null;
+		} else if (type.equals(TYPE_STRING)) {
+			return parser.nextText();
+		} else if (type.equals(TYPE_BOOLEAN)) {
+			return getValueBoolean();
+		} else if (type.equals(TYPE_DATE)) {
+			return getValueDate();
+		} else if (type.equals(TYPE_FILE)) {
+			return getValueFile();
+		} else if (type.equals(TYPE_URL)) {
+			return getValueURL();
+		} else if (type.equals(TYPE_URI)) {
+			return getValueURI();
+		} else if (TYPES_NUMBER.contains(type)) {
+			return getValueNumber(type);
+		} else if (type.equals(TYPE_REFERENCE)) {
+			return getValueReference();
+		} else if (type.equals(TYPE_LIST)) {
+			return getValueList();
+		} else if (type.equals(TYPE_SET)) {
+			return getValueSet();
+		} else if (type.equals(TYPE_MAP)) {
+			return getValueMap();
+		} else {
+			throw new PersistenceUnknowTypeException(this.parser, type);
+		}
+
+	}
+
+
+	private Boolean getValueBoolean() throws XmlPullParserException,
+			IOException {
+		String value = parser.nextText();
+		// XXX: do any check for valid values ???
+		return new Boolean(value);
+	}
+
+	private File getValueFile() throws XmlPullParserException, IOException {
+		String value = parser.nextText();
+		return new File(value);
+	}
+
+	private URL getValueURL() throws XmlPullParserException, IOException {
+		String value = parser.nextText();
+		return new URL(value);
+	}
+
+	private URI getValueURI() throws XmlPullParserException, IOException,
+			PersistenceException {
+		String value = parser.nextText();
+		try {
+			return new URI(value);
+		} catch (URISyntaxException e) {
+			throw new PersistenceParserException(this.parser, e);
+		}
+	}
+
+	private Date getValueDate() throws XmlPullParserException,
+			IOException {
+		String value = parser.nextText();
+		Long time;
+		try {
+			time = new Long(value);
+		} catch (NumberFormatException e) {
+			throw new PersistenceInvalidValueException(this.parser, TYPE_DATE, value, e);
+		}
+		return new Date(time.longValue());
+	}
+
+	private Number getValueNumber(String type) throws XmlPullParserException,
+			IOException {
+		String value = parser.nextText().trim();
+		Number number = null;
+		try {
+			if (TYPE_INTEGER.equals(type)){
+                            if( value.startsWith("0x") ) {
+                                number = new Integer(Integer.parseInt(value.substring(2), 16));
+                            } else {
+				number = new Integer(value);
+                            }
+			} else if (TYPE_LONG.equals(type)) {
+                            if( value.startsWith("0x") ) {
+                                number = new Long(Long.parseLong(value.substring(2), 16));
+                            } else {
+				number = new Long(value);
+                            }
+			} else if (TYPE_FLOAT.equals(type)) {
+                            if( value.startsWith("0x") ) {
+                                number = new Float(Integer.parseInt(value.substring(2), 16));
+                            } else {
+				number = new Float(value);
+                            }
+			} else if (TYPE_DOUBLE.equals(type)) {
+                            if( value.startsWith("0x") ) {
+                                number = new Double(Integer.parseInt(value.substring(2), 16));
+                            } else {
+				number = new Double(value);
+                            }
+			}
+
+		} catch (NumberFormatException e) {
+			throw new PersistenceInvalidValueException(this.parser, type, value, e);
+		}
+
+		return number;
+	}
+	private ObjectReference getValueReference() throws XmlPullParserException,
+			IOException, PersistenceException {
+		parser.nextTag();
+		parser.require(XmlPullParser.START_TAG, "", REFERENCE_TAG);
+		String idstr = parser.getAttributeValue("", REFERENCE_ID_ATTR);
+		if (idstr == null) {
+			throw new PersistenceMissingAttributeException(this.parser, REFERENCE_ID_ATTR);
+		}
+		PersistentIdentifier id;
+		id = context.getIdentifier(idstr);
+		parser.nextTag();
+		parser.require(XmlPullParser.END_TAG, "", REFERENCE_TAG);
+		parser.nextTag();
+		return context.add(id);
+	}
+
+	private List getValueList() throws XmlPullParserException, IOException,
+			PersistenceException {
+		parser.nextTag();
+		List list = new ArrayList();
+		String type;
+		while (parser.getEventType() == XmlPullParser.START_TAG
+				&& LISTITEM_TAG.equals(parser.getName())) {
+
+			type = parser.getAttributeValue("", VALUE_TYPE_ATTR);
+			if (type == null) {
+				throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+			}
+
+			list.add(getValue(type));
+
+
+			parser.require(XmlPullParser.END_TAG, "", LISTITEM_TAG);
+			parser.nextTag();
+		}
+		return manager.getWrappedList(list, context);
+	}
+
+	private Set getValueSet() throws XmlPullParserException, IOException,
+			PersistenceException {
+		parser.nextTag();
+		Set set = new LinkedHashSet();
+		String type;
+		while (parser.getEventType() == XmlPullParser.START_TAG
+				&& SETITEM_TAG.equals(parser.getName())) {
+
+			type = parser.getAttributeValue("", VALUE_TYPE_ATTR);
+			if (type == null) {
+				throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+			}
+
+			set.add(getValue(type));
+
+			parser.require(XmlPullParser.END_TAG, "", SETITEM_TAG);
+			parser.nextTag();
+		}
+		return manager.getWrappedSet(set, context);
+
+	}
+
+	private void checkDocumentEnd() throws XmlPullParserException {
+		if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
+			throw new PersistenceEndOfDocumentException(this.parser);
+		}
+
+	}
+
+
+	private Map getValueMap() throws XmlPullParserException, IOException,
+			PersistenceException {
+		parser.nextTag();
+		Map map = new LinkedHashMap();
+		String keyType, valueType;
+		Object key, value;
+		while (parser.getEventType() == XmlPullParser.START_TAG
+				&& MAPITEM_TAG.equals(parser.getName())) {
+
+			parser.nextTag();
+			parser.require(XmlPullParser.START_TAG, "", MAPKEY_TAG);
+			keyType = parser.getAttributeValue("", VALUE_TYPE_ATTR);
+			if (keyType == null) {
+				throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+
+			}
+			key = getValue(keyType);
+
+			parser.require(XmlPullParser.END_TAG, "", MAPKEY_TAG);
+			parser.nextTag();
+			parser.require(XmlPullParser.START_TAG, "", MAPVALUE_TAG);
+
+			valueType = parser.getAttributeValue("", VALUE_TYPE_ATTR);
+			if (valueType == null) {
+				throw new PersistenceMissingAttributeException(this.parser, VALUE_TYPE_ATTR);
+			}
+
+			value = getValue(valueType);
+
+			parser.require(XmlPullParser.END_TAG, "", MAPVALUE_TAG);
+			parser.nextTag();
+
+			map.put(key, value);
+
+			parser.require(XmlPullParser.END_TAG, "", MAPITEM_TAG);
+			parser.nextTag();
+		}
+		return manager.getWrappedMap(map, context);
+	}
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/xml/XMLPersistentStateReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentState.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentState.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentState.java	(revision 1235)
@@ -0,0 +1,795 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.io.File;
+import java.io.Reader;
+import java.net.URI;
+import java.net.URL;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public interface PersistentState {
+	/**
+	 * Gets the name of the java class corresponding to this persistent state
+	 *
+	 * @return The class name of the java class represented by this state
+	 */
+	public String getTheClassName();
+
+	/**
+	 * Returns the struct definition associated to this state
+	 * 
+	 * @return the DynStruct definition of the state.
+	 */
+	public DynStruct getDefinition();
+	
+	
+	public PersistentContext getContext();
+	
+	/**
+	 * Gets an <code>int</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>int</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public int getInt(String name) throws PersistenceException;
+
+	/**
+	 * Gets an <code>long</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>long</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public long getLong(String name) throws PersistenceException;
+
+	/**
+	 * Gets a <code>Date</code> property.
+	 * 
+	 * @param name
+	 * @return The <code>Date</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public Date getDate(String name)
+			throws PersistenceException;
+
+	/**
+	 * Gets a <code>double</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>double</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public double getDouble(String name)
+			throws PersistenceException;
+
+	/**
+	 * Gets a <code>float</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>float</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public float getFloat(String name) throws PersistenceException;
+
+	/**
+	 * Gets a <code>boolean</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>boolean</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public boolean getBoolean(String name)
+			throws PersistenceException;
+
+	/**
+	 * Gets a <code>String</code> property.
+	 *
+	 * @param name
+	 *            The name of the property to get
+	 *
+	 * @return The <code>String</code> property associated to the provided name
+	 * @throws PersistenceException
+	 */
+	public String getString(String name)
+			throws PersistenceException;
+
+	/**
+	 * Gets a {@link List} property.
+	 * 
+	 * <strong>Don't use the returned List as it is, as it may not work as you
+	 * expect. Instead, choose you own implementation and do something
+	 * like:</strong> <code>
+	 * List myAttribute = new ArrayList(state.getList("prop"))
+	 * </code>
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * 
+	 * @return The {@link List} property value associated to the provided name
+	 * 
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public List getList(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of the class given. This is useful to
+	 * be able to cast the returned Object[] to the real class. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * <p>
+	 * Ex: <code> 
+	 * Color[] colors = (Color[])state.getArray("colors", Color.class);
+	 * </code>
+	 * </p>
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @param valueClass
+	 *            the class of the array elements
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public Object[] getArray(String name, Class valueClass)
+			throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of boolean basic type. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public boolean[] getBooleanArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of int basic type. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public int[] getIntArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of long basic type. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public long[] getLongArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of float basic type. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public float[] getFloatArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of double basic type. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * @return the array of elements
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public double[] getDoubleArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of Date type. 
+	 * 
+	 * To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public Date[] getDateArray(String name) throws PersistenceException;
+
+	/**
+	 * Returns an array whose elements are of String type. 
+	 * 
+	 * To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 *  
+	 * @param name
+	 * @return
+	 * @throws PersistenceException
+	 */
+	public String[] getStringArray(String name) throws PersistenceException;
+
+	/**
+	 * Gets a {@link Map} property. <strong>Don't use the returned Map as is, as
+	 * it may not be a real usable Map implementation.</strong>
+	 * 
+	 * <strong>Don't use the returned Map as it is, as it may not work as you
+	 * expect. Instead, choose you own implementation and do something
+	 * like:</strong> <code>
+	 * Map myAttribute = new HashMap(state.getSet("prop"))
+	 * </code>
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * 
+	 * @return The {@link Map} property value associated to the provided name
+	 * 
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public Map getMap(String name) throws PersistenceException;
+
+	/**
+	 * Gets a {@link Set} property.
+	 * 
+	 * <strong>Don't use the returned Set as it is, as it may not work as you
+	 * expect. Instead, choose you own implementation and do something
+	 * like:</strong> <code>
+	 * Set myAttribute = new HashSet(state.getSet("prop"))
+	 * </code>
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * 
+	 * @return The {@link Set} property value associated to the provided name
+	 * 
+	 * @throws PersistenceException
+	 *             if there is an error getting the property value
+	 */
+	public Set getSet(String name) throws PersistenceException;
+
+	public URL getURL(String name) throws PersistenceException;
+	
+	public URI getURI(String name) throws PersistenceException;
+	
+	public File getFile(String name) throws PersistenceException;
+
+	/**
+	 * Gets an <code>Object</code> property.
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * 
+	 * @return The <code>Object</code> property associated to the provided name
+	 * 
+	 * @throws PersistenceException
+	 */
+	public Object get(String name) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Gets an <code>Iterator</code> over properties of types {@link List},
+	 * {@link Set} or {@link Map}.
+	 * </p>
+	 * 
+	 * @param name
+	 *            The name of the property to get
+	 * 
+	 * @return The <code>Iterator</code> associated to the property value of
+	 *         provided name
+	 * @throws PersistenceException
+	 */
+	public Iterator getIterator(String name) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type String.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The String object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, String value) throws PersistenceException;
+
+	public void set(String name, File value) throws PersistenceException;
+	
+	public void set(String name, URL value) throws PersistenceException;
+
+	public void set(String name, URI value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type int.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The int value to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, int value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type long.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The long value to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, long value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type double.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The double value to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, double value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type float.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The float value to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, float value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type boolean.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The boolean value to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, boolean value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type Persistent.
+	 * </p>
+	 * 
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param obj
+	 *            The Persistent object to be stored in the state.
+	 * 
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Persistent obj)
+			throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link List}.
+	 * </p>
+	 * <p>
+	 * The items of the list must be persistence supported types instance.
+	 * </p>
+	 * <p>
+	 * <i>{@link #get(String)} return an read only {@link List} instance after
+	 * {@link #load(Reader)}</i>
+	 * </p>
+	 * 
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param value
+	 *            The {@link List} object to be stored in the state.
+	 * 
+	 * @throws PersistenceException
+	 */
+	public void set(String name, List value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array. To be able to store
+	 * and load a property as an array, the type of the property defined in the
+	 * {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, Object[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of int. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, int[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of long. To be able to
+	 * store and load a property as an array, the type of the property defined
+	 * in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, long[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of float. To be able
+	 * to store and load a property as an array, the type of the property
+	 * defined in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, float[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of double. To be able
+	 * to store and load a property as an array, the type of the property
+	 * defined in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, double[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of Date. 
+	 * 
+	 * To be able
+	 * to store and load a property as an array, the type of the property
+	 * defined in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 * @param value the Date array to set.
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Date[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of String. 
+	 * 
+	 * To be able
+	 * to store and load a property as an array, the type of the property
+	 * defined in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 * @param value
+	 * @throws PersistenceException
+	 */
+	public void set(String name, String[] value) throws PersistenceException;
+
+	/**
+	 * Sets a property of type {@link List} with an array of boolean. To be able
+	 * to store and load a property as an array, the type of the property
+	 * defined in the {@link DynStruct} must be List.
+	 * 
+	 * @param name
+	 *            The name of the property to set
+	 * @param value
+	 *            the value to set
+	 * @throws PersistenceException
+	 *             if there is an error setting the property value
+	 */
+	public void set(String name, boolean[] value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Set}.
+	 * </p>
+	 * <p>
+	 * The items of the set must be persistence supported type instances.
+	 * </p>
+	 * <p>
+	 * <i>{@link #get(String)} return an read only {@link Set} instance after
+	 * {@link #load(Reader)}</i>
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Set} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Set value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Map}.
+	 * </p>
+	 * <p>
+	 * The values and keys of the map must be persistence supported type
+	 * instances.
+	 * </p>
+	 * <i>{@link #get(String)} return an read only {@link Map} instance after
+	 * {@link #load(Reader)}</i> </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Map} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Map value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Boolean}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Boolean} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Boolean value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Date}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Date} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Date value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Integer}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Integer} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Integer value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Long}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Long} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Long value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Float}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Float} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Float value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link Double}.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Double} object to be stored in the state.
+	 *
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Double value) throws PersistenceException;
+
+	/**
+	 * <p>
+	 * Sets a property of type {@link List} (<i>like do
+	 * {@link #set(String, List)} </i>) filled with the values provided by a
+	 * {@link Iterator}
+	 * </p>
+	 * <p>
+	 * The items of the iteration must be persistence supported types instance.
+	 * </p>
+	 *
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The iterator to get values to store in the list property.
+	 *
+	 * @throws PersistenceException
+	 * @see {@link #set(String, List)}
+	 */
+	public void set(String name, Iterator it)
+			throws PersistenceException;
+
+
+	/**
+	 * <p>
+	 * Sets a property.
+	 * </p>
+	 * <p>
+	 * <code>value</value> must be a supported type or manager must have
+	 *  a {@link PersistenceFactory} that know how persist it.
+	 * </p>
+	 * 
+	 * @param name
+	 *            The name of the property to store <i>(must be a valid Java
+	 *            identifier)</i>
+	 * @param it
+	 *            The {@link Float} object to be stored in the state.
+	 * 
+	 * @throws PersistenceException
+	 */
+	public void set(String name, Object value) throws PersistenceException;
+
+	public void setNull(String name) throws PersistenceException;
+	
+	/**
+	 * <p>Gets an iterator over the names of the properties contained
+	 * in this PersistentState.</p>
+	 *
+	 * @return An iterator which provides the name of all the
+	 * properties contained in this state.
+	 */
+	public Iterator getNames();
+
+
+	/**
+	 * Informs that a property is set or not.
+	 *
+	 * @param name
+	 * @return
+	 */
+	public boolean hasValue(String name);
+	
+	/**
+	 * Make relatives all files, urls and uris that are in this state
+	 * from the folder specified.
+	 * 
+	 * @param rootFolder
+	 */
+	public void relativizeFiles(File rootFolder);
+
+	/**
+	 * Make absolutes all files, urls and uris that are in this state
+	 * from the folder specified.
+	 * 
+	 * @param rootFolder
+	 */
+	public void derelativizeFiles(File rootFolder);
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentState.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/FileTools.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/FileTools.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/FileTools.java	(revision 1235)
@@ -0,0 +1,139 @@
+package org.gvsig.tools.persistence.impl;
+
+import java.io.File;
+import org.apache.commons.io.FilenameUtils;
+
+public class FileTools {
+
+	static File relativizeFile(File rootFolder, File file) {
+		if (rootFolder == null) {
+			return file;
+		}
+		if (file == null) {
+			return null;
+		}
+		
+		boolean isDir = false;
+		// isDir = file.isDirectory();
+		isDir = rootFolder.isDirectory();
+		String basePath = rootFolder.getAbsolutePath();
+		
+		String targetPath = FilenameUtils.normalize(file.getPath());
+		
+		String pathSeparator = File.separator;
+		// We need the -1 argument to split to make sure we get a trailing
+		// "" token if the base ends in the path separator and is therefore
+		// a directory. We require directory paths to end in the path
+		// separator -- otherwise they are indistinguishable from files.
+		String[] base = basePath.split(Pattern_quote(pathSeparator), -1);
+		String[] target = targetPath.split(Pattern_quote(pathSeparator), 0);
+
+		// First get all the common elements. Store them as a string,
+		// and also count how many of them there are.
+		String common = "";
+		int commonIndex = 0;
+		for (int i = 0; i < target.length && i < base.length; i++) {
+			if (target[i].equals(base[i])) {
+				common += target[i] + pathSeparator;
+				commonIndex++;
+			} else
+				break;
+		}
+
+		if (commonIndex == 0) {
+			// Whoops -- not even a single common path element. This most
+			// likely indicates differing drive letters, like C: and D:.
+			// These paths cannot be relativized. Return the target path.
+			return file;
+			// This should never happen when all absolute paths
+			// begin with / as in *nix.
+		}
+
+		String relative = "";
+		if (base.length == commonIndex) {
+			// Comment this out if you prefer that a relative path not start
+			// with ./
+			relative = "." + pathSeparator;
+		} else {
+			int numDirsUp = base.length - commonIndex - (isDir ? 0 : 1); 
+			// only subtract 1 if it is a file.
+			// The number of directories we have to backtrack is the length of
+			// the base path MINUS the number of common path elements, minus
+			// one because the last element in the path isn't a directory.
+			for (int i = 1; i <= (numDirsUp); i++) {
+				relative += ".." + pathSeparator;
+			}
+		}
+		// if we are comparing directories then we
+		if (targetPath.length() > common.length()) {
+			// it's OK, it isn't a directory
+			relative += targetPath.substring(common.length());
+		}
+
+		return new File(relative);
+	}
+	
+	static File derelativizeFile(File rootFolder, File file ) {
+		if(rootFolder == null || file == null){
+			return file;
+		}
+		if (file.isAbsolute()) {
+			return file;
+		}
+		File f = new File(rootFolder, file.getPath()).getAbsoluteFile();
+		String targetPath = FilenameUtils.normalize(f.getPath());
+		return new File(targetPath);
+	}
+
+    static boolean isInDifferentDrive(File rootFolder, File file) {
+
+        if (rootFolder == null) {
+            return false;
+        }
+
+        if (file == null) {
+            return false;
+        }
+        String basePath = rootFolder.getAbsolutePath();
+        String targetPath = file.getPath();
+        String pathSeparator = File.separator;
+        // We need the -1 argument to split to make sure we get a trailing
+        // "" token if the base ends in the path separator and is therefore
+        // a directory. We require directory paths to end in the path
+        // separator -- otherwise they are indistinguishable from files.
+        String[] base = basePath.split(Pattern_quote(pathSeparator), -1);
+        String[] target = targetPath.split(Pattern_quote(pathSeparator), 0);
+        /*
+         * If first component is different then they are different
+         * drives. In Unix-type file systems, the first for both
+         * should be "" so this will not happen
+         */
+        return !target[0].equals(base[0]);
+    }
+
+    
+    private static String Pattern_quote(String str) {
+        int eInd = str.indexOf("\\E");
+        if (eInd < 0) {
+            // No need to handle backslashes.
+            return "\\Q" + str + "\\E";
+        }
+
+        StringBuffer sb = new StringBuffer(str.length() + 16);
+        sb.append("\\Q"); // start quote
+
+        int pos = 0;
+        do {
+        // A backslash is quoted by another backslash;
+            // 'E' is not needed to be quoted.
+            sb.append(str.substring(pos, eInd))
+                    .append("\\E" + "\\\\" + "E" + "\\Q");
+            pos = eInd + 2;
+        } while ((eInd = str.indexOf("\\E", pos)) >= 0);
+
+        sb.append(str.substring(pos, str.length()))
+                .append("\\E"); // end quote
+        return sb.toString();
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/FileTools.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedContainer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedContainer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedContainer.java	(revision 1235)
@@ -0,0 +1,140 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.Map.Entry;
+
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices.ObjectReference;
+
+
+public class DelegatedContainer {
+
+	private PersistentContextServices context;
+	private PersistenceManagerServices manager;
+
+	public DelegatedContainer(PersistenceManagerServices manager,
+			PersistentContextServices context) {
+		this.manager = manager;
+		this.context = context;
+	}
+
+	protected PersistenceManagerServices getManager() {
+		return this.manager;
+	}
+
+	protected PersistentContextServices getContext() {
+		return this.context;
+	}
+
+	private class WrappedEntry implements Entry {
+
+		private Entry entry;
+
+		public WrappedEntry(Entry entry) {
+			this.entry = entry;
+		}
+
+		public Object getKey() {
+			return getObject(entry.getKey());
+		}
+
+		public Object getValue() {
+			return getObject(entry.getValue());
+		}
+
+		public Object setValue(Object arg0) {
+			throw new UnsupportedOperationException();
+		}
+	}
+
+	/**
+	 * Get the object associated to the object reference passed as
+	 * parameter.
+	 * 
+	 * If the object passed as parameter is not a object reference,
+	 * the it is returned as is.
+	 * 
+	 * @param  object 
+	 * @return object references by the parameter or it self.
+	 */
+	protected Object getObject(Object wrapper) {
+		if (wrapper instanceof ObjectReference) {
+			ObjectReference ref = (ObjectReference) wrapper;
+			return ref.getObject();
+		} else if (wrapper instanceof Entry) {
+			return new WrappedEntry((Entry) wrapper);
+		}
+		return wrapper;
+	}
+
+	/**
+	 * Get a object reference associated to the object
+	 * passed as parameter. If the object don't have a
+	 * object-reference associated, then the object it self
+	 * is returned.
+	 * 
+	 * @param obj
+	 * @return
+	 */
+	protected Object getWrapper(Object obj) {
+		ObjectReference ref = context.get(obj);
+		if( ref == null ) {
+			// The object don't exists in context,
+			// return the object it self.
+			return obj;
+		}
+		return ref;
+	}
+
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedContainer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistenceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistenceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistenceManager.java	(revision 1235)
@@ -0,0 +1,511 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+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.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.dynobject.impl.DefaultDynClassName;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.AddDefinitionException;
+import org.gvsig.tools.persistence.exception.DuplicatePersistentDefinitionException;
+import org.gvsig.tools.persistence.exception.FieldNotDeclaredException;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceCreateException;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.gvsig.tools.persistence.exception.PersistenceWriteExeption;
+import org.gvsig.tools.persistence.impl.exception.CantFindDefinitionInStreamException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceDomainNotRegisterdException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceIllegalStateTheClassNameNotSetException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceInvalidValidateModeException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceValidateMissingDefinitionException;
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices.ObjectReference;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.XmlPullParserException;
+
+
+public abstract  class AbstractPersistenceManager implements
+		PersistenceManagerServices {
+
+	private static final Logger LOG = LoggerFactory.getLogger(AbstractPersistenceManager.class);
+	
+	private DefaultFactories factories;
+	private Domains domainsURL;
+	private int autoValidationMode = PersistenceManager.DISABLED;
+
+	
+
+	protected AbstractPersistenceManager() {
+		domainsURL = new Domains();
+		factories = new DefaultFactories();
+	}
+
+	public void addAlias(String name, Class aClass)
+			throws PersistenceClassNotRegistered {
+		PersistenceFactory factory = this.factories.get(aClass.getName());
+		this.factories.add(factory, aClass.getName());
+	}
+
+	public Factories getFactories() {
+		return this.factories;
+	}
+
+	public PersistentContextServices getNewContext() {
+		return new DefaultPersistentContext(this);
+	}
+	
+	public Object create(PersistentState state) throws PersistenceException {
+		String className = state.getTheClassName();
+		if (className == null) {
+			throw new PersistenceIllegalStateTheClassNameNotSetException() ;
+		}
+		PersistentContextServices context = getContext(state);
+		ObjectReference ref = context.get(state);
+		return ref.getObject();
+	}
+
+	public Object getObject(InputStream is) {
+		Object obj = null;
+		PersistentState state = null;
+		String theClassName = null;
+		try {
+			state = this.loadState(is);
+			theClassName = state.getTheClassName();
+			obj = this.create(state);
+		} catch (PersistenceException e) {
+			throw new PersistenceCreateException(theClassName,e);
+		}
+		return obj;
+	}
+	
+	public void putObject(OutputStream os, Object obj) {
+		PersistentState state;
+		try {
+			state = this.getState(obj);
+			this.saveState(state, os);
+		} catch (PersistenceException e) {
+			throw new PersistenceWriteExeption(e);
+		}
+	}
+	
+	public DynStruct getDefinition(Class persistentClass) {
+		return getDefinition(persistentClass.getName());
+	}
+
+	public DynStruct getDefinition(String className) {
+		PersistenceFactory factory = this.factories.get(className);
+		if( factory== null ) {
+			return null;
+		}
+		return factory.getDefinition(className);
+	}
+	
+	public DynStruct getDynObjectDefinition(String className) {
+		DefaultDynClassName dynClassName = new DefaultDynClassName(PERSISTENCE_DYNOBJECT_NAMESPACE, className);
+		PersistenceFactory factory = this.factories.get(dynClassName.getFullName());
+		if( factory== null ) {
+			return null;
+		}
+		return factory.getDefinition(dynClassName.getFullName());
+	}
+
+	private PersistentContextServices getContext(PersistentState state) {
+		return (PersistentContextServices) state.getContext();
+	}
+
+	public void validate(PersistentState state, int mode)
+			throws PersistenceValidateExceptions {
+
+		if (mode == PersistenceManager.DISABLED){
+			return;
+		}
+
+		List exceptions = new ArrayList();
+		DynStruct definition = state.getDefinition();
+		if( definition == null ) {
+			if( mode == PersistenceManager.MANDATORY ) {
+				exceptions.add(new PersistenceValidateMissingDefinitionException(state.getTheClassName()));
+				throw  new PersistenceValidateExceptions(state.getTheClassName(), exceptions);
+			} else {
+				return;
+			}
+		}
+
+		PersistentStateServices state2 = (PersistentStateServices) state;
+		Iterator it = state2.getNames();
+		while( it.hasNext() ) {
+			String name = (String) it.next();
+			DynField field = definition.getDynField(name);
+			if(  field == null ) {
+				exceptions.add( new FieldNotDeclaredException(name,state.getTheClassName()));
+			} 
+		}
+		DynObjectToPersistentStateAdapter dynAdapter = new DynObjectToPersistentStateAdapter(state, definition);			
+		try {
+			definition.validate(dynAdapter);
+		} catch (DynObjectValidateException e) {
+			exceptions.add(e);
+		}
+		if (exceptions.size() > 0) {
+			throw  new PersistenceValidateExceptions(state.getTheClassName(), exceptions);
+		}
+	}
+
+	public void validateAll(PersistentState state, int mode)
+			throws PersistenceValidateExceptions {
+
+		if (mode == PersistenceManager.DISABLED){
+			return;
+		}
+		PersistentContextServices context =  getContext(state);
+		context.validate(this.autoValidationMode);
+	}
+
+	private class DynObjectToPersistentStateAdapter implements DynObject {
+		private PersistentState state;
+		private DynStruct struct;
+
+//		DynObjectToPersistentStateAdapter() {
+//			this.state = null;
+//			this.struct = null;
+//		}
+		DynObjectToPersistentStateAdapter(PersistentState state, DynStruct struct) {
+			this.state = state;
+			this.struct = struct;
+		}
+
+//		public void setData(PersistentState state, DynStruct struct) {
+//			this.state = state;
+//			this.struct = struct;
+//		}
+
+		public void delegate(DynObject dynObject) {
+			// Nothing to do
+
+		}
+
+		public DynClass getDynClass() {
+			// Nothing to do
+			return null;
+		}
+
+		public Object getDynValue(String name) throws DynFieldNotFoundException {
+			try {
+				return state.get(name);
+			} catch (PersistenceException e) {
+				throw new DynFieldNotFoundException(name, struct.getName());
+			}
+		}
+
+		public boolean hasDynValue(String name) {
+			return state.hasValue(name);
+		}
+
+		public void implement(DynClass dynClass) {
+			// Nothing to do
+		}
+
+		public Object invokeDynMethod(String name, DynObject context)
+				throws DynMethodException {
+			// Nothing to do
+			return null;
+		}
+
+		public Object invokeDynMethod(int code, DynObject context)
+				throws DynMethodException {
+			// Nothing to do
+			return null;
+		}
+
+		public void setDynValue(String name, Object value)
+				throws DynFieldNotFoundException {
+			// Nothing to do
+		}
+		public void clear() {
+			// Nothing to do
+		}
+
+	}
+
+	public int getAutoValidation() {
+		return autoValidationMode;
+	}
+
+	public void setAutoValidation(int validationMode) throws PersistenceException {
+		switch (validationMode) {
+		case DISABLED:
+		case MANDATORY:
+		case MANDATORY_IF_DECLARED:
+			autoValidationMode = validationMode;
+			break;
+		default:
+			throw new PersistenceInvalidValidateModeException(validationMode);
+		}
+	}
+
+	public PersistentState getState(Object obj)
+			throws PersistenceException, PersistenceValidateExceptions, PersistenceTypeNotSupportedException {
+		return this.getState(obj, false);
+	}
+
+	public PersistentState getState(Object obj, boolean collectAllErrors)
+			throws PersistenceException {
+		PersistentStateServices state = null;
+		if( collectAllErrors ) {
+			PersistentContextServices context = this.getNewContext();
+			context.setCollectErrors(true);
+			try {
+				state = createState(obj, context);
+				context.setRootId(state.getId());
+				if (this.autoValidationMode != PersistenceManager.DISABLED){
+					context.validate(this.autoValidationMode);
+				}
+			} catch(PersistenceException ex) {
+				context.addError(ex);
+			}
+		} else {
+			PersistentContextServices context = this.getNewContext();
+			state = createState(obj, context);
+			context.setRootId(state.getId());
+			this.validateAll(state, this.autoValidationMode);
+		}
+		return state;
+	}
+	
+	public PersistentStateServices createState(Object object, PersistentContextServices context) throws PersistenceException {
+
+		PersistentStateServices state = createPersistentState(context);
+		state.setTheClassName(object.getClass().getName());
+		
+		context.add(state, object);
+		
+		PersistenceFactory factory = this.factories.get(object);
+		if (factory == null) {
+			throw new PersistenceTypeNotSupportedException(object
+					.getClass());
+		}
+		state.setFactory(factory);
+		state.setTheClassName(factory.getManagedClassName(object));
+		factory.saveToState(state, object);
+		return state;
+	}
+
+	public List getWrappedList(List list, PersistentContextServices context) {
+		return new DelegatedList(list, this, context);
+	}
+
+	public Map getWrappedMap(Map map, PersistentContextServices context) {
+		return new DelegatedMap(map, this, context);
+	}
+
+	public Set getWrappedSet(Set set, PersistentContextServices context) {
+		return new DelegatedSet(set, this, context);
+	}
+
+
+	public Map getDomains() {
+		return Collections.unmodifiableMap(domainsURL);
+	}
+
+	public List getDomainDefinitions(String domainName) {
+		if (!domainsURL.containsKey(domainName)) {
+			throw new PersistenceDomainNotRegisterdException(domainName);
+		}
+		List definitions = new ArrayList();
+		Iterator it = this.factories.iterator();
+		while( it.hasNext() ) {
+			PersistenceFactory factory = (PersistenceFactory) it.next();
+			if( factory.getDomainName().equals(domainName)) {
+				List factDefinitions = factory.getDefinitions();
+				if(factDefinitions != null){
+					definitions.addAll(factDefinitions);
+				}
+			}
+		}
+		return definitions;
+	}
+
+			
+	public DynStruct addDefinition(Class theClass, String name, String description,
+			String domainName, String domainUrl) {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+
+		DynClass definition = dynman.createDynClass(PERSISTENCE_NAMESPACE, name, description);
+		return addDefinition(theClass, definition, domainName, domainUrl);
+	}
+
+	public DynStruct addDefinition(Class theClass, String name, InputStream definitions, ClassLoader loader,
+			String domainName, String domainUrl) {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		Map x;
+		try {
+			x = dynman.importDynClassDefinitions(definitions, loader, PersistenceManager.PERSISTENCE_NAMESPACE);
+		} catch (XmlPullParserException e) {
+			throw new AddDefinitionException(e);
+		} catch (IOException e) {
+			throw new AddDefinitionException(e);
+		}
+		DynClass definition = (DynClass) x.get(name);
+		if( definition == null ) {
+			throw new CantFindDefinitionInStreamException(name, getKeys(x));
+		}
+		return addDefinition(theClass, definition, domainName, domainUrl);
+	}
+
+	private String getKeys(Map theMap) {
+		List l = new ArrayList(theMap.keySet());
+		return l.toString();
+	}
+	
+
+	public DynStruct addDefinition(Class theClass, String name, Map definitions,
+			String domainName, String domainUrl) {
+		DynClass definition = (DynClass) definitions.get(name);
+		return addDefinition(theClass, definition, domainName, domainUrl);
+		
+	}
+
+	protected  DynStruct addDefinition(Class theClass, DynClass definition,
+		String domainName, String domainUrl) {
+		if(theClass == DynObject.class){
+			return this.addDefinition(definition, domainName, domainUrl);
+		}
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		
+		if(theClass.equals(DynObject.class)){
+			definition.setNamespace(PERSISTENCE_DYNOBJECT_NAMESPACE);
+		} else {
+			definition.setNamespace(PERSISTENCE_NAMESPACE);
+		}
+		if( dynman.get(definition.getNamespace(),definition.getName())!=null ) {
+			throw new DuplicatePersistentDefinitionException(definition.getName());
+		}
+		dynman.add(definition);
+		
+		PersistenceFactory factory = new SimplePersistenceFactory(
+				theClass, 
+				definition,
+				domainName, 
+				domainUrl
+			);
+		this.factories.add(factory);
+		this.domainsURL.add(factory.getDomainName(), factory.getDomainURL());
+		LOG.trace("Add persistence definition {}.", new Object[] { definition.getFullName() });
+		return definition;
+	}
+	
+	public DynStruct addDefinition(DynStruct definition, String domainName,
+			String domainUrl) throws AddDefinitionException {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		
+		definition.setNamespace(PERSISTENCE_DYNOBJECT_NAMESPACE);
+		if( dynman.get(definition.getNamespace(),definition.getName())!=null ) {
+			throw new DuplicatePersistentDefinitionException(definition.getFullName());
+		}
+		dynman.add((DynClass) definition);
+		
+		PersistenceFactory factory = this.factories.get(definition.getFullName());
+		this.domainsURL.add(factory.getDomainName(), factory.getDomainURL());
+		LOG.trace("Add persistence definition {}.", new Object[] { definition.getFullName() });
+		return definition;
+	}
+	
+	public void registerFactory(PersistenceFactory factory) {
+		this.factories.add(factory);
+		this.domainsURL.add(factory.getDomainName(), factory.getDomainURL());
+		LOG.trace("Add persistence factory {}.", new Object[] { factory.getClass().getName() });
+	}
+
+	public void unregisterClass(Class theClass) {
+		PersistenceFactory factory = this.factories.get(theClass.getName());
+		if( factory == null ) {
+			return ;
+		}
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		DynStruct definition = factory.getDefinition(theClass.getName());
+
+		dynman.remove(definition);
+		this.factories.remove( factory);
+		this.domainsURL.remove(factory.getDomainName());
+	}
+
+	public void unregisterClass(String name) {
+		PersistenceFactory factory = this.factories.get(name);
+		if( factory == null ) {
+			return ;
+		}
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+
+		this.factories.remove( factory);
+		this.domainsURL.remove(factory.getDomainName());
+
+		DynStruct definition = factory.getDefinition(name);
+		dynman.remove(definition);
+	}
+
+	public void unregisterFactory(PersistenceFactory factory) {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+
+		this.factories.remove(factory);
+		this.domainsURL.remove(factory.getDomainName());
+
+		List definitions = factory.getDefinitions();
+		if (definitions != null){
+			Iterator it = definitions.iterator();
+			while( it.hasNext() ) {
+				DynStruct definition = (DynStruct) it.next();
+				dynman.remove(definition);
+			}
+		}
+	}
+	
+	public PersistentStateServices createPersistentState(	PersistentContextServices context) {
+		return this.createPersistentState(context, context.getNewIdentifier());
+	}
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistenceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultFactories.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultFactories.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultFactories.java	(revision 1235)
@@ -0,0 +1,134 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.PersistenceManager.Factories;
+import org.gvsig.tools.persistence.impl.exception.PersistenceInvalidDomainNameException;
+
+public class DefaultFactories extends ArrayList implements Factories {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -3790704153805598236L;
+
+	private static final Pattern VALID_DOMAIN_NAME_PATTERN = Pattern.compile("[\\w][\\d\\w_]*");
+
+	private Map classToFactoryCache;
+
+	public DefaultFactories() {
+		this.classToFactoryCache = new HashMap();
+		this.add(new DynObjectPersistenceFactory());
+	}
+
+	public boolean add(PersistenceFactory factory, String classNameAlias) {
+		if( !super.contains(factory) ) {
+			this.add(factory);
+		}
+		this.classToFactoryCache.put(classNameAlias, factory);
+		return true;
+	}
+	
+	public boolean add(PersistenceFactory factory) {
+		if( factory.getDomainName() == null ) {
+			throw new PersistenceInvalidDomainNameException();
+		}
+		
+		if (!VALID_DOMAIN_NAME_PATTERN.matcher(factory.getDomainName()).matches()) {
+			throw new PersistenceInvalidDomainNameException(factory.getDomainName());
+		}
+
+		List factoryManagedClasses = factory.getManagedClasses();
+		Iterator it = factoryManagedClasses.iterator();
+		while( it.hasNext() ) {
+			Class theClass = (Class) it.next();
+			classToFactoryCache.put(theClass.getName(), factory);
+		}
+		if(this.size()<1) {
+			super.add(factory);
+		} else {
+			super.add(this.size()-1, factory);
+		}
+		return true;
+	}
+
+	/**
+	 * Return the associated persistence factory to the java class name passed as parameter
+	 * @param className
+	 * @return
+	 */
+	public PersistenceFactory get(String className) {
+		PersistenceFactory factory = (PersistenceFactory) classToFactoryCache.get(className);
+		if (factory != null) {
+			return factory;
+		} 
+		Iterator factoriesIterator = super.iterator();
+		while( factoriesIterator.hasNext() ) {
+			factory = (PersistenceFactory) factoriesIterator.next();
+			if( factory.getDefinition(className)!=null ) {
+				classToFactoryCache.put(className, factory);
+				return factory;
+			}
+		}
+		return null;
+	}
+	
+	public PersistenceFactory get(Class theClass) {
+		String className = theClass.getName();
+		PersistenceFactory factory = (PersistenceFactory) classToFactoryCache.get(className);
+		if (factory != null) {
+			return factory;
+		} 
+		Iterator factoriesIterator = super.iterator();
+		while( factoriesIterator.hasNext() ) {
+			factory = (PersistenceFactory) factoriesIterator.next();
+			if( factory.manages(theClass)) {
+				classToFactoryCache.put(className, factory);
+				return factory;
+			}
+		}
+		return null;
+	}
+
+	public PersistenceFactory get(Object object) {
+		if( object instanceof String) {
+			return this.get((String)object);
+		}
+		return this.get(object.getClass());
+	}
+
+	public PersistenceFactory get(PersistentState state) {
+		return get(state.getTheClassName());
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultFactories.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistentState.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistentState.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistentState.java	(revision 1235)
@@ -0,0 +1,907 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+package org.gvsig.tools.persistence.impl;
+
+import java.io.File;
+import java.lang.reflect.Array;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Pattern;
+import org.apache.commons.io.FileUtils;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentContext;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceIllegalStateTheClassNameNotSetException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceInvalidPropertyNameException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceInvalidTypeForPropertyException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceUnsuportedMapKeyTypeException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceValueNotFoundException;
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices.ObjectReference;
+import org.gvsig.tools.persistence.spi.PersistentIdentifier;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractPersistentState implements
+		PersistentStateServices {
+
+	private static final Logger logger = LoggerFactory
+			.getLogger(PersistentState.class);
+
+	private static final Pattern VALID_NAME_PATTERN = Pattern
+			.compile("[\\w][\\d\\w_]*");
+
+	private static final List validStdTypeClasses = Collections
+			.unmodifiableList(Arrays.asList(new Class[] { // All need to be
+															// immutable
+					Integer.class, Long.class, Float.class, Double.class,
+							Boolean.class, String.class, Date.class,
+							File.class, URL.class, URI.class }));
+
+	private Map values = new LinkedHashMap();
+	private PersistentContextServices context;
+	private PersistentIdentifier id;
+	private PersistenceManagerServices manager;
+	private String theClassName = null;
+	private PersistenceFactory factory;
+
+	public AbstractPersistentState(PersistenceManagerServices manager,
+			PersistentContextServices context, PersistentIdentifier id) {
+		this.manager = manager;
+		this.context = context;
+		this.id = id;
+		values = new HashMap();
+	}
+
+	public void setFactory(PersistenceFactory factory) {
+		this.factory = factory;
+	}
+	
+	public DynStruct getDefinition() {
+		DynStruct definition = this.factory.getDefinition(this.theClassName);
+		return definition;
+	}
+
+	private DynStruct getDefinitionCheckNull() {
+		DynStruct definition = getDefinition();
+		if (definition == null) {
+			throw new NullPointerException(
+					"Can't locate definition for the class '"
+							+ this.theClassName + "' in the factory '"
+							+ this.factory.getClass().getName()
+							+ "', managed classes are '"
+							+ this.factory.getManagedClasses().toString()
+							+ "'.");
+		}
+		return definition;
+	}
+
+	public Object get(String name) throws PersistenceException {
+		Object ret = values.get(name);
+		if (ret == null) {
+			// We are asked for an attribute not defined in the dynstruct
+			if (!values.containsKey(name) && !definitionHasField(name)) {
+				throw new PersistenceValueNotFoundException(name);
+			}
+                        return getDefaultValue(name);
+		}
+		return get(ret);
+	}
+
+	public List getList(String name) throws PersistenceException {
+		return (List) get(name);
+	}
+
+	public Map getMap(String name) throws PersistenceException {
+		return (Map) get(name);
+	}
+
+	public Set getSet(String name) throws PersistenceException {
+		return (Set) get(name);
+	}
+
+	private Object get(Object obj) throws PersistenceException {
+		if (obj instanceof ObjectReference) {
+			ObjectReference ref = (ObjectReference) obj;
+			return ref.getObject();
+		}
+		if (obj instanceof List) {
+			List result = new ArrayList(((List) obj).size());
+			getValues(result, (((List) obj).iterator()));
+			return result;
+		}
+		return obj;
+	}
+
+	private void getValues(List result, Iterator iterator)
+			throws PersistenceException {
+		while (iterator.hasNext()) {
+			result.add(get(iterator.next()));
+		}
+	}
+
+	public boolean getBoolean(String name) throws PersistenceException {
+		return ((Boolean) get(name)).booleanValue();
+	}
+
+	public double getDouble(String name) throws PersistenceException {
+		return ((Double) get(name)).doubleValue();
+	}
+
+	public File getFile(String name) throws PersistenceException {
+		return (File) get(name);
+	}
+
+	public URL getURL(String name) throws PersistenceException {
+		return (URL) get(name);
+	}
+
+	public URI getURI(String name) throws PersistenceException {
+		return (URI) get(name);
+	}
+
+	public Date getDate(String name) throws PersistenceException {
+		return (Date) get(name);
+	}
+
+	public float getFloat(String name) throws PersistenceException {
+		return ((Float) get(name)).floatValue();
+	}
+
+	public int getInt(String name) throws PersistenceException {
+		return ((Integer) get(name)).intValue();
+	}
+
+	public Iterator getIterator(String name) throws PersistenceException {
+		return ((Collection) get(name)).iterator();
+	}
+
+	public long getLong(String name) throws PersistenceException {
+		return ((Long) get(name)).longValue();
+	}
+
+	public Object[] getArray(String name, Class valueClass)
+			throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		Object array = Array.newInstance(valueClass, valueList.size());
+		return valueList.toArray((Object[]) array);
+	}
+
+	public boolean[] getBooleanArray(String name) throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		boolean[] values = new boolean[valueList.size()];
+		for (int i = 0; i < values.length; i++) {
+			values[i] = ((Boolean) valueList.get(i)).booleanValue();
+		}
+		return values;
+	}
+
+	public int[] getIntArray(String name) throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		int[] values = new int[valueList.size()];
+		for (int i = 0; i < values.length; i++) {
+			values[i] = ((Number) valueList.get(i)).intValue();
+		}
+		return values;
+	}
+
+	public long[] getLongArray(String name) throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		long[] values = new long[valueList.size()];
+		for (int i = 0; i < values.length; i++) {
+			values[i] = ((Number) valueList.get(i)).longValue();
+		}
+		return values;
+	}
+
+	public float[] getFloatArray(String name) throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		float[] values = new float[valueList.size()];
+		for (int i = 0; i < values.length; i++) {
+			values[i] = ((Number) valueList.get(i)).floatValue();
+		}
+		return values;
+	}
+
+	public double[] getDoubleArray(String name) throws PersistenceException {
+		List valueList = getList(name);
+		if (valueList == null) {
+			return null;
+		}
+		double[] values = new double[valueList.size()];
+		for (int i = 0; i < values.length; i++) {
+			values[i] = ((Number) valueList.get(i)).doubleValue();
+		}
+		return values;
+	}
+
+	public Date[] getDateArray(String name) throws PersistenceException {
+		return (Date[]) this.getArray(name, Date.class);
+	}
+
+	public String[] getStringArray(String name) throws PersistenceException {
+		return (String[]) this.getArray(name, String.class);
+	}
+
+	public Iterator getNames() {
+		return values.keySet().iterator();
+	}
+
+	public String getString(String name) throws PersistenceException {
+		return ((String) get(name));
+	}
+
+	public void setNull(String name) throws PersistenceException {
+		setValue(name, null);
+	}
+
+	public void set(String name, String value) throws PersistenceException {
+		setValue(name, value);
+	}
+
+	public void set(String name, File value) throws PersistenceException {
+		setValue(name, value);
+	}
+
+	public void set(String name, URL value) throws PersistenceException {
+		setValue(name, value);
+	}
+
+	public void set(String name, URI value) throws PersistenceException {
+		setValue(name, value);
+	}
+
+	public void set(String name, int value) throws PersistenceException {
+		setValue(name, new Integer(value));
+	}
+
+	public void set(String name, long value) throws PersistenceException {
+		setValue(name, new Long(value));
+	}
+
+	public void set(String name, double value) throws PersistenceException {
+		setValue(name, new Double(value));
+
+	}
+
+	public void set(String name, float value) throws PersistenceException {
+		setValue(name, new Float(value));
+
+	}
+
+	public void set(String name, boolean value) throws PersistenceException {
+		setValue(name, new Boolean(value));
+	}
+
+	public void set(String name, Persistent obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Object obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Map obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, List obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Iterator obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Object[] values) throws PersistenceException {
+		set(name, values == null ? null : Arrays.asList(values));
+	}
+
+	public void set(String name, Date[] values) throws PersistenceException {
+		set(name, values == null ? null : Arrays.asList(values));
+	}
+
+	public void set(String name, String[] values) throws PersistenceException {
+		set(name, values == null ? null : Arrays.asList(values));
+	}
+
+	public void set(String name, boolean[] value) throws PersistenceException {
+		if (value == null) {
+			setValue(name, null);
+		} else {
+			List valueList = new ArrayList(value.length);
+			for (int i = 0; i < value.length; i++) {
+				valueList.add(value[i] ? Boolean.TRUE : Boolean.FALSE);
+			}
+			set(name, valueList);
+		}
+	}
+
+	public void set(String name, int[] value) throws PersistenceException {
+		if (value == null) {
+			setValue(name, null);
+		} else {
+			List valueList = new ArrayList(value.length);
+			for (int i = 0; i < value.length; i++) {
+				valueList.add(new Integer(value[i]));
+			}
+			set(name, valueList);
+		}
+	}
+
+	public void set(String name, long[] value) throws PersistenceException {
+		if (value == null) {
+			setValue(name, null);
+		} else {
+			List valueList = new ArrayList(value.length);
+			for (int i = 0; i < value.length; i++) {
+				valueList.add(new Long(value[i]));
+			}
+			set(name, valueList);
+		}
+	}
+
+	public void set(String name, float[] value) throws PersistenceException {
+		if (value == null) {
+			setValue(name, null);
+		} else {
+			List valueList = new ArrayList(value.length);
+			for (int i = 0; i < value.length; i++) {
+				valueList.add(new Float(value[i]));
+			}
+			set(name, valueList);
+		}
+	}
+
+	public void set(String name, double[] value) throws PersistenceException {
+		if (value == null) {
+			setValue(name, null);
+		} else {
+			List valueList = new ArrayList(value.length);
+			for (int i = 0; i < value.length; i++) {
+				valueList.add(new Double(value[i]));
+			}
+			set(name, valueList);
+		}
+	}
+
+	public void set(String name, Set obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Boolean obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Integer obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Long obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Float obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Double obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	public void set(String name, Date obj) throws PersistenceException {
+		setValue(name, getObjectToPersist(obj, name));
+	}
+
+	protected Object getObjectToPersist(Object theOriginal)
+			throws PersistenceException {
+		return getObjectToPersist(theOriginal, null);
+	}
+
+	/**
+	 * Checks class of <code>theOriginal</code> and transforms it if is
+	 * necessary.<br>
+	 * 
+	 * @param theOriginal
+	 * @return
+	 * @throws PersistenceException
+	 */
+	private Object getObjectToPersist(Object theOriginal, String propName)
+			throws PersistenceException {
+		DynStruct definition = null;
+		DynField field = null;
+		try {
+			if (theOriginal == null) {
+				return null;
+			} else if (validStdTypeClasses.contains(theOriginal.getClass())) {
+				// FIXME: No esta comprobando que el tipo sea el correcto
+				return theOriginal;
+			}
+			if (theOriginal instanceof File) {
+				// File no es una clase final, asi que convertimos
+				// a File para curarnos en salud.
+				// FIXME: No esta comprobando que el tipo sea el correcto
+				return new File(((File) theOriginal).toURI());
+			}
+			definition = this.getDefinitionCheckNull();
+			if (propName != null) {
+				field = definition.getDynField(propName);
+			}
+			if (theOriginal instanceof Persistent) {
+				if (field != null) {
+					Class classOfValue = field.getClassOfValue();
+					if (classOfValue == null) {
+						throw new NullPointerException(
+								"Class of value for field '"
+										+ definition.getFullName() + "' of '"
+										+ field.getName() + "' can't be null.");
+					}
+					if (!classOfValue.isAssignableFrom(theOriginal.getClass())) {
+						throw new PersistenceInvalidTypeForPropertyException(
+								propName, definition, field, theOriginal);
+					}
+				}
+				ObjectReference ref = context.get(theOriginal);
+				if (ref == null) {
+					PersistentStateServices state = manager.createState(
+							theOriginal, context);
+					ref = context.get(state);
+				}
+				return ref;
+
+			} else if ((manager.getFactories().get(theOriginal)) != null) {
+				if (field != null) {
+					Class classOfValue = field.getClassOfValue();
+					if (classOfValue == null) {
+						throw new NullPointerException(
+								"Class of value for field '"
+										+ definition.getFullName() + "' of '"
+										+ field.getName() + "' can't be null.");
+					}
+					if (!classOfValue.isAssignableFrom(theOriginal.getClass())) {
+						throw new PersistenceInvalidTypeForPropertyException(
+								propName, definition, field, theOriginal);
+					}
+				}
+				ObjectReference ref = context.get(theOriginal);
+				if (ref == null) {
+					PersistentStateServices state = manager.createState(
+							theOriginal, context);
+					ref = context.get(state);
+				}
+				return ref;
+
+			} else if (theOriginal instanceof Map) {
+				if (field != null && field.getType() != DataTypes.MAP) {
+					throw new PersistenceInvalidTypeForPropertyException(
+							propName, definition, field, theOriginal);
+				}
+				Map result = new LinkedHashMap(((Map) theOriginal).size());
+				storeValues(result, (Map) theOriginal);
+				return result;
+
+			} else if (theOriginal instanceof Set) {
+				if (field != null && field.getType() != DataTypes.SET) {
+					throw new PersistenceInvalidTypeForPropertyException(
+							propName, definition, field, theOriginal);
+				}
+				Set result = new LinkedHashSet(((Set) theOriginal).size());
+				storeValues(result, ((Set) theOriginal).iterator());
+				return result;
+
+			} else if (theOriginal instanceof List) {
+				if (field != null
+						&& !(field.getType() == DataTypes.LIST || field
+								.getType() == DataTypes.ARRAY)) {
+					throw new PersistenceInvalidTypeForPropertyException(
+							propName, definition, field, theOriginal);
+				}
+				List result = new ArrayList(((List) theOriginal).size());
+				storeValues(result, (((List) theOriginal).iterator()));
+				return result;
+
+			} else if (theOriginal instanceof Iterator) {
+				if (field != null
+						&& !(field.getType() == DataTypes.LIST || field
+								.getType() == DataTypes.ARRAY)) {
+					throw new PersistenceInvalidTypeForPropertyException(
+							propName, definition, field, theOriginal);
+				}
+				List result = new ArrayList();
+
+				storeValues(result, (Iterator) theOriginal);
+				return result;
+
+			} else {
+				if (this.manager.getAutoValidation() == PersistenceManager.MANDATORY) {
+					throw new PersistenceTypeNotSupportedException(
+							theOriginal.getClass(), propName);
+				} else {
+					logger.error("Persistence type '"
+							+ theOriginal.getClass().getName()
+							+ "' not supported.");
+					return null;
+				}
+			}
+		} catch (PersistenceException ex) {
+			PersistentContextServices context = (PersistentContextServices) this
+					.getContext();
+			if (!context.getCollectErrors()) {
+				throw ex;
+			}
+			context.addError(ex);
+			return null;
+		} catch (Exception ex) {
+			PersistentContextServices context = (PersistentContextServices) this
+					.getContext();
+			if (!context.getCollectErrors()) {
+				throw new PersistenceException(ex);
+			}
+			context.addError(ex);
+			return null;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.tools.persistence.impl.ImplementationPersistentState#getId()
+	 */
+	public PersistentIdentifier getId() {
+		return id;
+	}
+
+	public void setValue(String name, Object value) throws PersistenceException {
+		try {
+			if (this.theClassName == null) {
+				throw new PersistenceIllegalStateTheClassNameNotSetException();
+			}
+			if (!VALID_NAME_PATTERN.matcher(name).matches()) {
+				throw new PersistenceInvalidPropertyNameException(name);
+			}
+			this.values.put(name, value);
+
+		} catch (PersistenceException ex) {
+			PersistentContextServices context = (PersistentContextServices) this
+					.getContext();
+			if (!context.getCollectErrors()) {
+				throw ex;
+			}
+			context.addError(ex);
+		} catch (Exception ex) {
+			PersistentContextServices context = (PersistentContextServices) this
+					.getContext();
+			if (!context.getCollectErrors()) {
+				throw new PersistenceException(ex);
+			}
+			context.addError(ex);
+		}
+	}
+
+	public String getTheClassName() {
+		return theClassName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.tools.persistence.impl.ImplementationPersistentState#
+	 * setTheClassName(java.lang.String)
+	 */
+	public void setTheClassName(String className) {
+		theClassName = className;
+	}
+	
+	private void storeValues(Collection storage, Iterator iter)
+			throws PersistenceException {
+		while (iter.hasNext()) {
+			storage.add(getObjectToPersist(iter.next()));
+		}
+
+	}
+
+	private void storeValues(Map storage, Map originalStorage)
+			throws PersistenceException {
+		Iterator iter = originalStorage.entrySet().iterator();
+		Entry orgEntry;
+		Object key;
+		Object value;
+
+		while (iter.hasNext()) {
+			orgEntry = (Entry) iter.next();
+			key = orgEntry.getKey();
+
+			if (key == null) {
+				// Nothing to do
+			} else if (key instanceof String) {
+				// Nothing to do
+			} else if (key instanceof Number) {
+				// Nothing to do
+			} else if (key instanceof Boolean) {
+				// Nothing to do
+			} else if (key instanceof Persistent) {
+				key = getObjectToPersist(key);
+			} else {
+				throw new PersistenceUnsuportedMapKeyTypeException(orgEntry
+						.getKey().getClass());
+			}
+
+			value = getObjectToPersist(orgEntry.getValue());
+
+			storage.put(key, value);
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.tools.persistence.impl.ImplementationPersistentState#getContext
+	 * ()
+	 */
+	public PersistentContext getContext() {
+		return context;
+	}
+
+	// private int size() {
+	// return this.values.size();
+	// }
+	//
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.tools.persistence.impl.ImplementationPersistentState#hasValue
+	 * (java.lang.String)
+	 */
+	public boolean hasValue(String name) {
+		return this.values.containsKey(name);
+	}
+
+	public Object getValue(String name) {
+		return values.get(name);
+	}
+
+	//
+	// private ObjectReference createReference(Integer id) {
+	// return new DefaultObjectReference(id);
+	// }
+
+	/**
+	 * Returns if the definition related to this state has a defined field
+	 */
+	private boolean definitionHasField(String name) {
+		DynStruct definition = manager.getDefinition(getTheClassName());
+		return definition != null && definition.getDynField(name) != null;
+	}
+        
+        private Object getDefaultValue(String name) {
+		DynStruct definition = manager.getDefinition(getTheClassName());
+                if( definition == null ) {
+                    return null;
+                }
+                if( definition.getDynField(name)==null ) {
+                    return null;
+                }
+		return definition.getDynField(name).getDefaultValue();
+        }
+	
+	public void relativizeFiles(File rootFolder) {
+		PersistentContext context = this.getContext();
+
+		URI cwd = new File(System.getProperty("user.dir")).toURI();
+		Iterator statesIterator = context.iterator();
+		while (statesIterator.hasNext()) {
+			PersistentState aState = (PersistentState) statesIterator.next();
+			DynStruct definition = aState.getDefinition();
+			DynField[] fields = definition.getDynFields();
+			for( int i=0; i<fields.length; i++) {
+				DynField field = fields[i];
+				if (field.getType() == DataTypes.FILE
+						|| field.getType() == DataTypes.FOLDER) {
+					try {
+						File value = aState.getFile(field.getName());
+						value = FileTools.relativizeFile(rootFolder, value);
+						aState.set(field.getName(), value);
+					} catch (PersistenceException e) {
+						logger.warn(
+								"Can't relativice field '" + field.getName()
+										+ "' for class '"
+										+ definition.getName() + "'.", e);
+					}
+				} else if (field.getType() == DataTypes.URL) {
+					try {
+						URL value = aState.getURL(field.getName());
+						if ("FILE".equalsIgnoreCase(value.getProtocol())) {
+							File file = FileUtils.toFile(value);
+							if (FileTools.isInDifferentDrive(rootFolder,file)) {
+                                /*
+                                 * Different drives
+                                 * (should happen only in Windows)
+                                 */
+                                value = file.toURI().toURL();
+							} else {
+                                /*
+                                * Both in the Same drive (C: D: etc) or Unix-style
+                                */
+                                file = FileTools.relativizeFile(rootFolder,file);
+                                value = new URL("file","",file.toURI().toString().substring(cwd.toString().length()));
+							}
+							aState.set(field.getName(), value);
+						}
+					} catch (PersistenceException e) {
+						// do nothind
+					} catch (MalformedURLException e) {
+						// do nothind
+					}
+				} else if (field.getType() == DataTypes.URI) {
+					try {
+						URI value = aState.getURI(field.getName());
+						if (value.getScheme() == null || "FILE".equalsIgnoreCase(value.getScheme())) {
+							File file = new File(value.getPath());
+							if (FileTools.isInDifferentDrive(rootFolder,file)) {
+                                /*
+                                 * Different drives
+                                 * (should happen only in Windows)
+                                 */
+                                value = file.toURI();
+							} else {
+                                /*
+                                * Both in the Same drive (C: D: etc) or Unix-style
+                                */
+                                file = FileTools.relativizeFile(rootFolder,file);
+                                value = new URI(file.getPath());
+							}
+							aState.set(field.getName(), value);
+						}
+					} catch (PersistenceException e) {
+						// do nothind
+					} catch (URISyntaxException e) {
+						// do nothind
+					}
+				}
+			}
+		}
+	}
+	
+    public void derelativizeFiles(File rootFolder) {
+        PersistentContext context = this.getContext();
+        //URI cwd = new File(System.getProperty("user.dir")).toURI();
+
+        Iterator statesIterator = context.iterator();
+        String className = null;
+
+        while (statesIterator.hasNext()) {
+            PersistentState aState = (PersistentState) statesIterator.next();
+            try {
+                className = aState.getTheClassName();
+            } catch (Throwable e) {
+                className = "Unknown";
+            }
+            try {
+                DynStruct definition = aState.getDefinition();
+                DynField[] fields = definition.getDynFields();
+                for (int i = 0; i < fields.length; i++) {
+                    DynField field = fields[i];
+                    if (field.getType() == DataTypes.FILE
+                            || field.getType() == DataTypes.FOLDER) {
+                        try {
+                            File value = aState.getFile(field.getName());
+                            value = FileTools.derelativizeFile(rootFolder, value);
+                            aState.set(field.getName(), value);
+                        } catch (PersistenceException e) {
+                            logger.warn(
+                                    "Can't fix field '" + field.getName()
+                                    + "' for class '"
+                                    + definition.getName() + "'.", e);
+                        }
+                    } else if (field.getType() == DataTypes.URL) {
+                        try {
+                            URL value = aState.getURL(field.getName());
+                            if ("FILE".equalsIgnoreCase(value.getProtocol())) {
+                                if (!value.getFile().startsWith("/")) {
+                                    File file = FileUtils.toFile(value);
+                                    file = FileTools.derelativizeFile(rootFolder, file);
+                                    value = file.toURI().toURL();
+                                    aState.set(field.getName(), value);
+                                }
+                            }
+                        } catch (PersistenceException e) {
+                            // do nothing
+                        } catch (MalformedURLException e) {
+                            // do nothing
+                        }
+
+                    } else if (field.getType() == DataTypes.URI) {
+                        try {
+                            URI value = aState.getURI(field.getName());
+                            if (value.getScheme() == null || "FILE".equalsIgnoreCase(value.getScheme())) {
+                                if (!value.getPath().startsWith("/")) {
+                                    File file = FileUtils.toFile(value.toURL());
+                                    file = FileTools.derelativizeFile(rootFolder, file);
+                                    aState.set(field.getName(), file.toURI());
+                                }
+                            }
+                        } catch (PersistenceException e) {
+                            // do nothing
+                        } catch (MalformedURLException ex) {
+                            // do nothing
+                        }
+                    }
+                }
+            } catch (RuntimeException e) {
+                logger.info("Can't fix relative paths in " + className, e);
+            }
+        }
+    }
+
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistentState.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/SimplePersistenceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/SimplePersistenceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/SimplePersistenceFactory.java	(revision 1235)
@@ -0,0 +1,202 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceCreateException;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SimplePersistenceFactory implements PersistenceFactory {
+
+	private static final  Logger logger = LoggerFactory.getLogger(SimplePersistenceFactory.class);
+
+	private String domainName;
+	private String domainUrl;
+	private DynStruct definition;
+	private Class theClass;
+	
+	SimplePersistenceFactory(Class theClass, DynStruct definition,
+			String domainName, String domainUrl){
+		if( domainName == null ) {
+			domainName = PersistenceManager.DEFAULT_DOMAIN_NAME;
+		}
+		if( domainUrl == null ) {
+			domainUrl = PersistenceManager.DEFAULT_DOMAIN_URL;
+		}
+		this.definition = definition;
+		this.theClass = theClass;
+		this.domainUrl = domainUrl;
+		this.domainName = domainName;
+	}
+
+	public DynStruct getDefinition(String name) {
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			return this.definition;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			return this.definition;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return this.definition;
+		}
+		return null;
+	}
+
+	public List getDefinitions() {
+		return Collections.singletonList( this.definition);
+	}
+
+	public String getDomainName() {
+		return this.domainName;
+	}
+
+	public String getDomainURL() {
+		return this.domainUrl;
+	}
+
+	public Class getManagedClass(Object object) {
+		if( this.theClass.isInstance(object) ) {
+			return this.theClass;
+		}
+		return null;
+	}
+
+	public String getManagedClassName(Object object) {
+		Class clazz = this.getManagedClass(object);
+		if (clazz != null){
+			return clazz.getName();
+		}
+		return null;
+	}
+
+	public Class getManagedClass(PersistentState state) {
+		return this.getManagedClass(state.getTheClassName());
+	}
+	
+	public Class getManagedClass(String name) {
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			logger.warn("SimplePersistenceFactory.getManagedClass({}) is not a java class.",name);
+			return this.theClass;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			logger.warn("SimplePersistenceFactory.getManagedClass({}) is not a java class.",name);
+			return this.theClass;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return this.theClass;
+		}
+		return null;
+	}
+	
+	public List getManagedClasses() {
+		return Collections.singletonList(this.theClass);
+	}
+
+	public void loadFromState(PersistentState state, Object object)
+			throws PersistenceException {
+		Persistent pobj = (Persistent) object;
+		pobj.loadFromState(state);
+	}
+
+	public boolean manages(Object object) {
+		return theClass.isInstance(object);
+	}
+
+	public boolean manages(Class theClass) {
+		return this.theClass.isAssignableFrom(theClass);
+	}
+
+	public boolean manages(PersistentState state) {
+		if( state == null ) {
+			return false;
+		}
+		String name = state.getTheClassName();
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			return true;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			return true;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return true;
+		}
+		return false;
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Persistent persistent = (Persistent) obj;
+		try {
+			persistent.saveToState(state);
+		} catch(PersistenceException ex) {
+			PersistentContextServices  context = (PersistentContextServices) state.getContext();
+			if( !context.getCollectErrors() ) {
+				throw ex;
+			}
+			context.addError(ex);
+		} catch(Exception ex) {
+			PersistentContextServices  context = (PersistentContextServices) state.getContext();
+			if( !context.getCollectErrors() ) {
+				throw new PersistenceException(ex);
+			}
+			context.addError(ex);
+		}
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		Persistent obj;
+		try {
+			obj = (Persistent) this.theClass.newInstance();
+		} catch (InstantiationException e) {
+			throw new PersistenceCreateException(this.theClass, e);
+		} catch (IllegalAccessException e) {
+			throw new PersistenceCreateException(this.theClass, e);
+		}
+		return obj;
+	}
+
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+
+		buffer.append("SimplePersistenceFactory").append("[").append(
+				this.hashCode()).append("]").append("( ")
+				.append("definitions=").append(this.definition).append(", ")
+				.append("domainName='").append(domainName).append("', ")
+				.append("domainUrl='").append(domainUrl).append("', ").append(
+						"theClass=").append(this.theClass).append(" )");
+		return buffer.toString();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/SimplePersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultPersistentContext.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultPersistentContext.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultPersistentContext.java	(revision 1235)
@@ -0,0 +1,445 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceClassNotRegistered;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+import org.gvsig.tools.persistence.impl.exception.ObjectNotFoundException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceIDNotLoadedException;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+import org.gvsig.tools.persistence.spi.PersistentIdentifier;
+import org.gvsig.tools.persistence.spi.PersistentStateServices;
+
+public class DefaultPersistentContext implements PersistentContextServices {
+	private static int IdentifiersCounter = 1; 
+
+	private Map idToReference;
+	private Map objToReference;
+	private PersistentIdentifier rootId;
+	private PersistenceManager manager;
+	private boolean collectErrors;
+	private PersistenceException errors;
+	private boolean validated;
+
+	public DefaultPersistentContext(PersistenceManager manager) {
+		this.manager = manager;
+		this.collectErrors = false;
+		this.errors = null;
+		this.validated = false;
+
+		// Use LinkedHashMap for predictable order when save to a file
+		this.idToReference = new LinkedHashMap(); 
+		this.objToReference = new LinkedHashMap();
+	}
+
+	private class DefaultPersistentIdentifier implements PersistentIdentifier, Comparable {
+		private String value;
+		
+		DefaultPersistentIdentifier(String value) {
+			this.value = value;
+		}
+		
+//		String getValue() {
+//			return value;
+//		}
+
+		public boolean equals(Object obj) {
+			if (!(obj instanceof DefaultPersistentIdentifier)) {
+				return false;
+			}
+			return value == ((DefaultPersistentIdentifier) obj).value;
+		}
+
+		public boolean hasValue(Object value) {
+			return this.value.equals(value);
+		}
+		
+		public int hashCode() {
+			return value.hashCode();
+		}
+		
+		public String toString() {
+			return value;
+		}
+
+		public int compareTo(Object obj) {
+			if (!(obj instanceof DefaultPersistentIdentifier)) {
+				return -1;
+			}
+			return value.compareTo( ((DefaultPersistentIdentifier) obj).value) ;
+		}
+	}
+	
+	private class ContextValue implements ObjectReference, Comparable {
+		private Object obj;
+		private PersistentState state;
+		private PersistentIdentifier id;
+
+		ContextValue(PersistentIdentifier id, PersistentState state) {
+			this.id = id;
+			this.state = state;
+			this.obj = null;
+		}
+		
+//		public void update() throws PersistenceException {
+//			if( this.obj == null ) {
+//				updateObjectInReference(this);
+//			}
+//		}
+
+		public boolean hasObject() {
+			return this.obj != null;
+		}
+		
+//		public boolean hasState() {
+//			return this.state != null;
+//		}
+		
+		public Object getObject() {
+			if( this.obj == null ) {
+				try {
+					updateObjectInReference(this);
+				} catch (PersistenceException e) {
+					throw new PersistenceRuntimeException(e);
+				}
+			}
+			return this.obj;
+		}
+		
+		public PersistentState getState() {
+			return this.state;
+		}
+		
+		public PersistentIdentifier getId() {
+			return this.id;
+		}
+
+		protected void update(Object object) {
+			this.obj = object;
+		}
+		
+		public boolean equals(Object obj) {
+			if (!(obj instanceof ContextValue)) {
+				return false;
+			}
+			return id.equals(((ContextValue) obj).id);
+		}
+
+		public int hashCode() {
+			return id.hashCode();
+		}
+		
+		public String toString() {
+			String idStr = id == null ? "null" : id.toString();
+			return getClass().getName().concat(": id = ").concat(idStr);
+		}
+
+		public int compareTo(Object arg0) {
+			if (!(obj instanceof ContextValue)) {
+				return -1;
+			}
+			return ((DefaultPersistentIdentifier)id).compareTo(((ContextValue) obj).id);
+		}
+
+	}
+
+	public PersistentIdentifier getNewIdentifier() {
+		return new DefaultPersistentIdentifier(String.valueOf( IdentifiersCounter++));
+	}
+	
+	public PersistentIdentifier getIdentifier(String id) throws PersistenceException {
+		Iterator it = this.idToReference.values().iterator();
+		while( it.hasNext() ) {
+			ContextValue value = (ContextValue) it.next();
+			if( ((DefaultPersistentIdentifier)(value.getId())).hasValue(id) ) {
+				return value.getId();
+			}
+		}
+		return new DefaultPersistentIdentifier(id);
+	}
+	
+	public ObjectReference add(PersistentIdentifier id) throws PersistenceException  {
+		this.validated = false;
+		ContextValue value = (ContextValue) idToReference.get(id);
+		if (value == null ) {
+			value = new ContextValue(id, null);
+			idToReference.put(value.getId(), value);
+		}
+		return value;
+	}
+	
+	public ObjectReference add(PersistentState state, Object obj) throws PersistenceException  {
+		this.validated = false;
+		PersistentIdentifier id = ((PersistentStateServices)state).getId();
+		ContextValue value = (ContextValue) idToReference.get(id);
+		if (value == null ) {
+			value = new ContextValue( id, state);
+			idToReference.put(value.getId(), value);
+		}
+		if( value.getState() == null ) {
+			value.state = state;
+		}
+		if( obj != null ) {
+			value.update(obj);
+			objToReference.put(obj,value);
+		}
+		return value;
+	}
+	
+	public ObjectReference get(PersistentState state) throws PersistenceException {
+		PersistentIdentifier id = ((PersistentStateServices)state).getId();
+		ContextValue ref = (ContextValue) idToReference.get(id);
+		if (ref == null ) {
+			ref = new ContextValue(id, state);
+			idToReference.put(id, ref);
+		}
+		return ref;
+	}
+
+	public ObjectReference get(PersistentIdentifier id) {
+		ContextValue value = (ContextValue) idToReference.get(id);
+		return value;
+	}
+	
+	public ObjectReference get(Object obj) {
+		return (ContextValue) objToReference.get(obj);
+	}
+	
+	private void updateObjectInReference(ContextValue ref) throws PersistenceException {
+		/*
+		 * Note: this method is used by the inner class Reference.
+		 */
+		PersistentStateServices state = (PersistentStateServices) ref.getState();
+		PersistenceFactory factory = manager.getFactories().get(state);
+		
+		if (factory == null) {
+			/*
+			 * This happens if persistence refers to objects
+			 * of a missing plugin (example: persistence
+			 * has data about oracle connections but we dont have
+			 * the oracle plugin in the current execution)
+			 */
+		    String classname = "";
+		    if (state == null) {
+		        classname = "[State is null]";
+		    } else {
+		        classname = state.getTheClassName();
+		        if (classname == null) {
+		            classname = "[Null]";
+		        }
+		    }
+			throw new PersistenceClassNotRegistered(classname);
+		}
+		
+
+		// This can be done in two step to avoid cyclic references
+		state.setFactory(factory);
+		ref.update( factory.createFromState(state) );
+		factory.loadFromState(state, ref.getObject());
+		
+		objToReference.put(ref.getObject(), ref);
+	}
+	
+	public void update(ObjectReference ref) throws PersistenceException {
+		this.validated = false;
+		this.updateObjectInReference((ContextValue) ref);
+	}
+
+	private void updateAll() throws PersistenceException {
+		Iterator it = idToReference.entrySet().iterator();
+		while ( it.hasNext() ) {
+			ContextValue ref = (ContextValue) ((Entry) it.next()).getValue();
+			this.update(ref);
+		}
+	}
+
+	public void clear() {
+		this.validated = false;
+		Iterator it = idToReference.entrySet().iterator();
+		while ( it.hasNext() ) {
+			ContextValue ref = (ContextValue) ((Entry) it.next()).getValue();
+			ref.update(null);
+		}
+	}
+
+	public Iterator iterator() {
+		final class StatesIterator implements Iterator {
+			private Iterator referenceIterator;
+
+			StatesIterator(Map idToReference) {
+				this.referenceIterator = idToReference.entrySet().iterator();
+			}
+			
+//			StatesIterator(Map idToReference) {
+//				List values = new ArrayList(); 
+//				values.addAll(idToReference.values());
+//				Collections.sort(values);
+//				this.referenceIterator = values.iterator();
+//			}
+			
+			public boolean hasNext() {
+				return referenceIterator.hasNext();
+			}
+			public Object next() {
+				ContextValue ref = (ContextValue) ((Entry) referenceIterator.next()).getValue();
+//				ContextValue ref = (ContextValue) referenceIterator.next();
+				return ref.getState();
+			}
+			public void remove() {
+				throw new UnsupportedOperationException();
+			}
+		}
+		
+		return new StatesIterator(idToReference);
+	}
+
+	public PersistentState getState(Integer id)
+			throws PersistenceException {
+		ContextValue ref = (ContextValue) this.get(id);
+		if (ref == null) {
+			throw new PersistenceIDNotLoadedException(id);
+		}
+		return ref.getState();
+	}
+
+	public PersistentState getState(Object obj)
+			throws PersistenceException {
+		ContextValue ref = (ContextValue) this.get(obj);
+		if (ref == null) {
+			return null;
+		}
+		return ref.getState();
+	}
+
+	public Object getObject(Integer id) throws PersistenceException {
+		ContextValue ref = (ContextValue) this.get(id);
+		if (ref == null) {
+			throw new PersistenceIDNotLoadedException(id);
+		}
+		return ref.getObject();
+	}
+
+	public PersistentIdentifier getId(Object obj) throws PersistenceException {
+		ContextValue ref = (ContextValue) this.get(obj);
+		if( ref != null ) {
+			return ref.getId();
+		}
+		this.updateAll();
+		ref = (ContextValue) this.get(obj);
+		if (ref == null) {
+			throw new ObjectNotFoundException();
+		}
+		return ref.getId();		
+	}
+
+
+	public void setRootId(PersistentIdentifier id) {
+		this.rootId = id;
+	}
+
+	public ObjectReference getRoot() throws PersistenceException {
+		ObjectReference root = this.get(this.rootId); 
+		return  root;
+	}
+
+	public void setCollectErrors(boolean collectErrors) {
+		this.collectErrors = collectErrors;
+	}
+
+	public boolean getCollectErrors() {
+		return this.collectErrors;
+	}
+
+	public void addError(Throwable cause) {
+		if( this.errors == null ) {
+			this.errors = new PersistenceException();
+		}
+		this.errors.add(cause);
+	}
+
+	public PersistenceException getErrors() {
+		return this.errors;
+	}
+
+	public void validate(int mode) throws PersistenceValidateExceptions {
+		if( this.validated ) {
+			return;
+		}
+		List exceptions = new ArrayList();
+
+		Iterator it = this.iterator();
+		while( it.hasNext() ) {
+			PersistentState astate = (PersistentState) it.next();
+			try {
+				this.manager.validate(astate,mode);
+			} catch(Exception e) {
+				exceptions.add(e);
+			}
+		}
+
+		this.validated=true;
+		if (exceptions.size() > 0) {
+			throw  new PersistenceValidateExceptions(exceptions);
+		}		
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DefaultPersistentContext.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedCollection.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedCollection.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedCollection.java	(revision 1235)
@@ -0,0 +1,221 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DelegatedCollection extends DelegatedContainer implements
+		Collection {
+
+	private Collection delegated;
+
+	public DelegatedCollection(Collection delegated,
+			PersistenceManagerServices manager, PersistentContextServices context) {
+		super(manager, context);
+		this.delegated = delegated;
+	}
+
+	public boolean add(Object arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean addAll(Collection arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void clear() {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean contains(Object o) {
+		return delegated.contains(getWrapper(o));
+	}
+
+	public boolean containsAll(Collection arg0) {
+		Iterator iter = arg0.iterator();
+		while (iter.hasNext()) {
+			if (!this.contains(iter.next())) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public boolean isEmpty() {
+		return delegated.isEmpty();
+	}
+
+	public Iterator iterator() {
+		return this.getWrappedIterator(delegated.iterator());
+	}
+
+	public boolean remove(Object o) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean removeAll(Collection arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean retainAll(Collection arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+
+	public Object[] toArray() {
+		Object[] r = new Object[size()];
+		Iterator iter = iterator();
+		int i = 0;
+		while (iter.hasNext()) {
+			r[i] = iter.next();
+			i++;
+		}
+		return r;
+	}
+
+	public Object[] toArray(Object[] a) {
+    	int size = size();
+		if (a.length < size) {
+			a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass()
+					.getComponentType(), size);
+		}
+		Iterator iter = iterator();
+		int i = 0;
+		while (iter.hasNext()) {
+			a[i] = iter.next();
+			i++;
+		}
+
+		if (a.length > size) {
+			a[size] = null;
+		}
+		return a;
+	}
+
+	public int size() {
+		return delegated.size();
+	}
+
+	protected ListIterator getWrappedIterator(Iterator iterator) {
+		class DelegatedIterator implements ListIterator {
+
+			private Iterator delegated;
+			private ListIterator delegatedListIterator;
+
+			public DelegatedIterator(Iterator deletaged) {
+				this.delegated = deletaged;
+				if (deletaged instanceof ListIterator) {
+					this.delegatedListIterator = (ListIterator) deletaged;
+				}
+			}
+
+			public boolean hasNext() {
+				return delegated.hasNext();
+			}
+
+			public Object next() {
+				return getObject(delegated.next());
+			}
+
+			public void remove() {
+				throw new UnsupportedOperationException();
+			}
+
+			public void add(Object arg0) {
+				throw new UnsupportedOperationException();
+
+			}
+
+			public boolean hasPrevious() {
+				if (delegatedListIterator == null) {
+					throw new UnsupportedOperationException();
+				}
+				return delegatedListIterator.hasPrevious();
+			}
+
+			public int nextIndex() {
+				if (delegatedListIterator == null) {
+					throw new UnsupportedOperationException();
+				}
+				return delegatedListIterator.nextIndex();
+			}
+
+			public Object previous() {
+				if (delegatedListIterator == null) {
+					throw new UnsupportedOperationException();
+				}
+				return getObject(delegatedListIterator.previous());
+			}
+
+			public int previousIndex() {
+				if (delegatedListIterator == null) {
+					throw new UnsupportedOperationException();
+				}
+				return delegatedListIterator.previousIndex();
+			}
+
+			public void set(Object arg0) {
+				throw new UnsupportedOperationException();
+			}
+		}
+		return new DelegatedIterator(iterator);
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedCollection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedList.java	(revision 1235)
@@ -0,0 +1,149 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+
+/**
+ * @author jmvivo 2009
+ * @author jjdelcerro 2010
+ * 
+ */
+public class DelegatedList extends DelegatedCollection implements List {
+
+	private List delegated;
+
+	public DelegatedList(List delegated,
+			PersistenceManagerServices manager, PersistentContextServices context) {
+		super(delegated, manager, context);
+		this.delegated = delegated;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#add(int, java.lang.Object)
+	 */
+	public void add(int arg0, Object arg1) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#addAll(int, java.util.Collection)
+	 */
+	public boolean addAll(int arg0, Collection arg1) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#get(int)
+	 */
+	public Object get(int index) {
+		return this.getObject(delegated.get(index));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#indexOf(java.lang.Object)
+	 */
+	public int indexOf(Object o) {
+		return delegated.indexOf(this.getWrapper(o));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#lastIndexOf(java.lang.Object)
+	 */
+	public int lastIndexOf(Object o) {
+		return delegated.lastIndexOf(this.getWrapper(o));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#listIterator()
+	 */
+	public ListIterator listIterator() {
+		return  this.getWrappedIterator(delegated.listIterator());
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#listIterator(int)
+	 */
+	public ListIterator listIterator(int index) {
+		return this.getWrappedIterator(delegated.listIterator(index));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#remove(int)
+	 */
+	public Object remove(int index) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#set(int, java.lang.Object)
+	 */
+	public Object set(int arg0, Object arg1) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#subList(int, int)
+	 */
+	public List subList(int fromIndex, int toIndex) {
+		return new DelegatedList(this.delegated.subList(fromIndex, toIndex),
+				getManager(), getContext());
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedSet.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedSet.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedSet.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.Set;
+
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DelegatedSet extends DelegatedCollection implements Set {
+
+	//private Set delegated;
+
+	public DelegatedSet(Set delegated,
+			PersistenceManagerServices manager, PersistentContextServices context) {
+		super(delegated, manager, context);
+		//this.delegated = delegated;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/Domains.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/Domains.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/Domains.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl;
+
+import java.util.HashMap;
+
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.impl.exception.PersistenceDuplicateDomainNameException;
+import org.gvsig.tools.persistence.impl.exception.PersistenceInvalidDomainNameException;
+
+public class Domains extends HashMap {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2234063626012628366L;
+
+	public Domains() {
+		super();
+	}
+	
+	public void add(String name, String url) {
+		this.put(name, url);
+	}
+	
+	public String getUrl(String name) {
+		return this.getUrl(name);
+	}
+	
+	public Object put(String name, String url) {
+		if (name == null) {
+			throw new PersistenceInvalidDomainNameException();
+		}
+		String currentUrl = (String) super.get(name);
+		// Error if the provided domain URL is not the same as the 
+		// previously stored one for the same domain
+		if ( currentUrl != null && !currentUrl.equals(url)) {
+			throw new PersistenceDuplicateDomainNameException(name, currentUrl, url);
+		}
+		if( url == null ) {
+			url = PersistenceManager.DEFAULT_DOMAIN_URL;
+		}
+		return super.put(name, url);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/Domains.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedMap.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedMap.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedMap.java	(revision 1235)
@@ -0,0 +1,157 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public 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.tools.persistence.impl;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.persistence.spi.PersistenceManagerServices;
+import org.gvsig.tools.persistence.spi.PersistentContextServices;
+
+/**
+ * @author jmvivo 2009
+ * @author jjdelcerro 2010
+ *
+ */
+public class DelegatedMap extends DelegatedContainer implements Map {
+
+	private Map delegated;
+
+	/**
+	 * @param delegated
+	 * @param manager
+	 * @param context
+	 */
+	public DelegatedMap(Map delegated,
+			PersistenceManagerServices manager, PersistentContextServices context) {
+		super(manager, context);
+		this.delegated = delegated;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#containsKey(java.lang.Object)
+	 */
+	public boolean containsKey(Object key) {
+		return delegated.containsKey(this.getWrapper(key));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#containsValue(java.lang.Object)
+	 */
+	public boolean containsValue(Object value) {
+		return delegated.containsKey(this.getWrapper(value));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#entrySet()
+	 */
+	public Set entrySet() {
+		return new DelegatedSet(delegated.entrySet(), getManager(),
+				getContext());
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#get(java.lang.Object)
+	 */
+	public Object get(Object key) {
+		return this.getObject(delegated.get(this.getObject(key)));
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#keySet()
+	 */
+	public Set keySet() {
+		return new DelegatedSet(delegated.keySet(), getManager(), getContext());
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+	 */
+	public Object put(Object arg0, Object arg1) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#putAll(java.util.Map)
+	 */
+	public void putAll(Map arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Map#values()
+	 */
+	public Collection values() {
+		return new DelegatedCollection(delegated.values(), getManager(),
+				getContext());
+	}
+
+	public void clear() {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean isEmpty() {
+		return delegated.isEmpty();
+	}
+
+	public Object remove(Object key) {
+		throw new UnsupportedOperationException();
+	}
+
+	public int size() {
+		return delegated.size();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DelegatedMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DynObjectPersistenceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DynObjectPersistenceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DynObjectPersistenceFactory.java	(revision 1235)
@@ -0,0 +1,190 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClassName;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.impl.DefaultDynClassName;
+import org.gvsig.tools.persistence.PersistenceFactory;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DynObjectPersistenceFactory implements PersistenceFactory {
+	static Logger LOG = LoggerFactory.getLogger(DynObjectPersistenceFactory.class);
+    
+    Map definitions = new HashMap();
+
+    private void addDefinition(DynStruct definition){
+        definitions.put(definition.getFullName(), definition);
+    }
+    
+    public Object createFromState(PersistentState state) throws PersistenceException {
+        return ToolsLocator.getDynObjectManager().createDynObject(state.getDefinition());
+    }
+
+    public void loadFromState(PersistentState state, Object object) throws PersistenceException {
+    	DynStruct definition = ((DynObject)object).getDynClass();
+    	addDefinition(definition);
+    	DynField[] fields = definition.getDynFields();
+    	for(int i=0; i<fields.length; i++){
+    		DynField field = fields[i];
+    		if (field.getDataType().isContainer()){
+    			if (field.getDataType().getType() == DataTypes.MAP){
+    				Map persistedMap = (Map) state.get(field.getName());
+    				Map auxMap = new HashMap();
+    				if (persistedMap != null) {
+    					auxMap.putAll(persistedMap);
+    				}
+    				((DynObject)object).setDynValue(field.getName(), auxMap);
+    				continue;
+    			} else if (field.getDataType().getType() == DataTypes.LIST){
+    				List persistedList = (List) state.get(field.getName());
+    				List auxList = new ArrayList();
+    				if (persistedList != null) {
+    					auxList.addAll(persistedList);
+    				}
+    				((DynObject)object).setDynValue(field.getName(), auxList);
+    				continue;
+    			} else if (field.getDataType().getType() == DataTypes.SET){
+    				Set persistedSet = (Set) state.get(field.getName());
+    				Set auxSet = new HashSet();
+    				if (persistedSet != null) {
+    					auxSet.addAll(persistedSet);
+    				}
+    				((DynObject)object).setDynValue(field.getName(), auxSet);
+    				continue;
+    			}
+    		}
+    		((DynObject)object).setDynValue(field.getName(), state.get(field.getName()));
+    	}
+    }
+
+    public void saveToState(PersistentState state, Object obj) throws PersistenceException {
+        DynStruct definition = ((DynObject)obj).getDynClass();
+        addDefinition(definition);
+        DynField[] fields = definition.getDynFields();
+        for(int i=0; i<fields.length; i++){
+            state.set(fields[i].getName(), ((DynObject)obj).getDynValue(fields[i].getName()));
+        }
+    }
+
+    public boolean manages(Object object) {
+        if (object instanceof DynObject){
+            return true;
+        }
+        return false;
+    }
+
+    public boolean manages(Class theClass) {
+        if (DynObject.class.isAssignableFrom(theClass)){
+            return true;
+        }
+        return false;
+    }
+
+    public boolean manages(PersistentState state) {
+    	String className = state.getTheClassName();
+    	DynClassName dynClassName = new DefaultDynClassName(className);
+    	if ( dynClassName.getNamespace().equals(PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE)){
+            return true;
+        }
+        return false;
+    }
+
+    public List getDefinitions() {
+        List defs = new ArrayList();
+        defs.addAll(definitions.values());
+        return defs;
+    }
+
+    public DynStruct getDefinition(String className) {
+    	DynStruct struct;
+		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
+		struct = dynMan.get(PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE,className);
+		if(struct == null){
+			struct = dynMan.get(className);
+		}
+		return struct;
+    }
+
+    public String getDomainName() {
+        return PersistenceManager.DEFAULT_DOMAIN_NAME;
+    }
+
+    public String getDomainURL() {
+        return PersistenceManager.DEFAULT_DOMAIN_URL;
+    }
+
+    public List getManagedClasses() {
+        return Collections.singletonList(DynObject.class);
+    }
+
+    public Class getManagedClass(Object object) {
+        if( DynObject.class.isInstance(object) ) {
+            return DynObject.class;
+        }
+        return null;
+    }
+
+    public String getManagedClassName(Object object) {
+        if( DynObject.class.isInstance(object) ) {
+            return ((DynObject)object).getDynClass().getFullName();
+        }
+        return null;
+    }
+
+    public Class getManagedClass(PersistentState state) {
+    	String className = state.getTheClassName();
+    	DynClassName dynClassName = new DefaultDynClassName(className);
+    	if ( !dynClassName.getNamespace().equals(PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE)){
+    		return null;
+    	}
+    	return DynObject.class;
+    }
+
+    public Class getManagedClass(String name) {
+    	DynClassName dynClassName = new DefaultDynClassName(name);
+    	if ( dynClassName.getNamespace().equals(PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE)){
+            return DynObject.class;
+        }
+        return null;
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/DynObjectPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidPropertyNameException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidPropertyNameException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidPropertyNameException.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+
+public class PersistenceInvalidPropertyNameException extends PersistenceRuntimeException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1611892488657900L;
+	private final static String MESSAGE_FORMAT = "Invalid property name '%(name)'.";
+	private final static String MESSAGE_KEY = "_PersistenceInvalidPropertyNameException";
+	private String name;
+
+	public PersistenceInvalidPropertyNameException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = name;
+	}
+	
+	public PersistenceInvalidPropertyNameException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = "(null)";
+	}
+	
+	protected Map values() {
+		return Collections.singletonMap("name", this.name);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidPropertyNameException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValidateMissingDefinitionException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValidateMissingDefinitionException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValidateMissingDefinitionException.java	(revision 1235)
@@ -0,0 +1,54 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceValidateMissingDefinitionException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 8706224174909319498L;
+	private final static String MESSAGE_FORMAT = "Missing definition for class '%(className)'.";
+	private final static String MESSAGE_KEY = "_PersistenceValidateMissingDefinitionException";
+	private String className;
+
+	public PersistenceValidateMissingDefinitionException(String className) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.className = className;
+	}
+
+	public PersistenceValidateMissingDefinitionException(Class theClass) {
+		this(theClass.getName());
+	}
+
+    protected Map values() {
+        return Collections
+                .singletonMap("className", className);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValidateMissingDefinitionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/CantFindDefinitionInStreamException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/CantFindDefinitionInStreamException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/CantFindDefinitionInStreamException.java	(revision 1235)
@@ -0,0 +1,52 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.persistence.exception.AddDefinitionException;
+
+public class CantFindDefinitionInStreamException extends AddDefinitionException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1214010138683901294L;
+
+	public CantFindDefinitionInStreamException(String name) {
+		super(
+			"Can't find definition %(name)s in stream.", 
+			"_cant_find_definition_XnameX_in_stream", 
+			serialVersionUID
+		);
+		setValue("name",name);
+	}
+
+	public CantFindDefinitionInStreamException(String name, String found) {
+		super(
+				"Can't find definition %(name)s in stream, found %(found)s.", 
+				"_cant_find_definition_XnameX_in_stream_found_XfoundX", 
+				serialVersionUID
+			);
+		setValue("name",name);
+		setValue("found",found);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/CantFindDefinitionInStreamException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/ObjectNotFoundException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/ObjectNotFoundException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/ObjectNotFoundException.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class ObjectNotFoundException extends PersistenceException{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7422760610474229877L;
+	private final static String MESSAGE_FORMAT = "Can't locate object in persistent context.";
+	private final static String MESSAGE_KEY = "_PersistenceObjectNotFoundException";
+
+	public ObjectNotFoundException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/ObjectNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIllegalStateTheClassNameNotSetException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIllegalStateTheClassNameNotSetException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIllegalStateTheClassNameNotSetException.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceIllegalStateTheClassNameNotSetException extends PersistenceException {
+	private static final long serialVersionUID = -8571345818015198417L;
+	private final static String MESSAGE_FORMAT = "The state haven't a class associated to it.";
+	private final static String MESSAGE_KEY = "_PersistenceIllegalStateTheClassNameNotSetException";
+
+	public PersistenceIllegalStateTheClassNameNotSetException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIllegalStateTheClassNameNotSetException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidDomainNameException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidDomainNameException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidDomainNameException.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+
+public class PersistenceInvalidDomainNameException extends PersistenceRuntimeException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3744038950422523595L;
+	private final static String MESSAGE_FORMAT = "Invalid domain name '%(name)'.";
+	private final static String MESSAGE_KEY = "_PersistenceInvalidDomainNameException";
+	private String name;
+
+	public PersistenceInvalidDomainNameException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = name;
+	}
+	
+	public PersistenceInvalidDomainNameException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = "(null)";
+	}
+	
+	protected Map values() {
+		return Collections.singletonMap("name", this.name);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidDomainNameException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDomainNotRegisterdException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDomainNotRegisterdException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDomainNotRegisterdException.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+
+public class PersistenceDomainNotRegisterdException extends PersistenceRuntimeException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2135913805542798476L;
+	private final static String MESSAGE_FORMAT = "Domain name '%(name)' not registered.";
+	private final static String MESSAGE_KEY = "PersistenceDomainNotRegisterdException";
+	private String name;
+
+	public PersistenceDomainNotRegisterdException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = name;
+	}
+	
+	public PersistenceDomainNotRegisterdException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.name = "(null)";
+	}
+	
+	protected Map values() {
+		return Collections.singletonMap("name", this.name);
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDomainNotRegisterdException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceUnsuportedMapKeyTypeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceUnsuportedMapKeyTypeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceUnsuportedMapKeyTypeException.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+public class PersistenceUnsuportedMapKeyTypeException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -319405442042912022L;
+	private final static String MESSAGE_FORMAT = "The type '%(classname)' is not supported as key for Map.";
+	private final static String MESSAGE_KEY = "_PersistenceUnsuportedMapKeyTypeException";
+	private String classname;
+	private Map values = null;
+
+
+	public PersistenceUnsuportedMapKeyTypeException(Class theType) {
+		this(theType.getName());
+	}
+
+	public PersistenceUnsuportedMapKeyTypeException(String theType) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.classname = theType;
+	}
+
+
+    protected Map values() {
+    	if (values == null) {
+			values = new HashMap();
+			values.put("classname", classname);
+			values = Collections.unmodifiableMap(values);
+		}
+		return values;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceUnsuportedMapKeyTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDuplicateDomainNameException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDuplicateDomainNameException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDuplicateDomainNameException.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+
+public class PersistenceDuplicateDomainNameException extends PersistenceRuntimeException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 5091214092364791497L;
+	private final static String MESSAGE_FORMAT = "Duplicate domain name '%(name)', previous url '%(oldurl)', new url '%(newurl)'.";
+	private final static String MESSAGE_KEY = "_PersistenceDuplicateDomainNameException";
+	
+	public PersistenceDuplicateDomainNameException(String name, String oldurl, String newurl) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name", name);
+		this.setValue("oldurl", oldurl);
+		this.setValue("newurl", newurl);
+	}
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceDuplicateDomainNameException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidTypeForPropertyException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidTypeForPropertyException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidTypeForPropertyException.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PersistenceInvalidTypeForPropertyException extends PersistenceException {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -557067450892214489L;
+	private final static String MESSAGE_FORMAT = "Invalid type '%(mode)' for property '%(name)'.";
+	private final static String MESSAGE_KEY = "_Invalid_type_XmodeX_for_property_XnameX";
+	private static final  Logger logger = LoggerFactory.getLogger(PersistenceInvalidTypeForPropertyException.class);
+
+
+	public PersistenceInvalidTypeForPropertyException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+	}
+
+	public PersistenceInvalidTypeForPropertyException(String name, DynStruct definition, DynField field, Object value) {
+		super(
+				"The type expected for %(definition).%(name) is %(fieldType) and is %(valueType).", 
+				"_The_type_expected_for_XdefinitionX.XnameX_is_XfieldTypeX_and_is_XvalueTypeX", 
+				serialVersionUID
+		);
+		setValue("name", name);
+		setValue("definition", definition.getName());
+		setValue("fieldType", field.getDataType().getName());
+		setValue("valueType", value.getClass().getName());
+		
+		logger.warn("The type expected for {}.{} is {} and is {}.", 
+			new String[] {
+				definition.getName(),
+				field.getName(),
+				field.getDataType().getName(),
+				value.getClass().getName()
+			}
+		);
+	}
+	
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidTypeForPropertyException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidValidateModeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidValidateModeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidValidateModeException.java	(revision 1235)
@@ -0,0 +1,41 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceInvalidValidateModeException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -9045679785762388324L;
+	private final static String MESSAGE_FORMAT = "Invalid validation mode '%(mode)'.";
+	private final static String MESSAGE_KEY = "_Invalid_validation_mode_XmodeX";
+
+	public PersistenceInvalidValidateModeException(int mode) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("mode", new Integer(mode));
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceInvalidValidateModeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIDNotLoadedException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIDNotLoadedException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIDNotLoadedException.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceIDNotLoadedException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1173336779528392650L;
+	private final static String MESSAGE_FORMAT = "The '%(id)' isn't declared and try to get it.";
+	private final static String MESSAGE_KEY = "_PersistenceIDNotLoadedException";
+	private Integer id;
+
+	public PersistenceIDNotLoadedException(Integer id) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.id = id;
+	}
+
+
+    protected Map values() {
+        return Collections
+                .singletonMap("id", id.toString());
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceIDNotLoadedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValueNotFoundException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValueNotFoundException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValueNotFoundException.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceValueNotFoundException extends PersistenceException {
+	private static final long serialVersionUID = -8365980563346330001L;
+	private final static String MESSAGE_FORMAT = "Value '%(name)' not found in persistent state.";
+	private final static String MESSAGE_KEY = "_PersistenceValueNotFoundException";
+	private String propertyName;
+
+	public PersistenceValueNotFoundException(String propertyName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.propertyName = propertyName;
+	}
+
+	public PersistenceValueNotFoundException(String propertyName, Throwable cause) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.propertyName = propertyName;
+	}
+
+    protected Map values() {
+        return Collections
+                .singletonMap("name", propertyName);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceValueNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceReferenceIDConflitException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceReferenceIDConflitException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceReferenceIDConflitException.java	(revision 1235)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence.impl.exception;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class PersistenceReferenceIDConflitException extends PersistenceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -66522803444999281L;
+	private final static String MESSAGE_FORMAT = "The '%(id)' is allready declared and try to set with another one.";
+	private final static String MESSAGE_KEY = "_PersistenceReferenceIDConflitException";
+	private String id;
+
+	public PersistenceReferenceIDConflitException(String id) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.id = id;
+	}
+
+
+    protected Map values() {
+        return Collections
+                .singletonMap("id", id);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/exception/PersistenceReferenceIDConflitException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractSinglePersistenceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractSinglePersistenceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractSinglePersistenceFactory.java	(revision 1235)
@@ -0,0 +1,167 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public abstract class AbstractSinglePersistenceFactory implements PersistenceFactory {
+
+	private String domainName;
+	private String domainUrl;
+	private DynStruct definition;
+	private Class theClass;
+	
+	protected AbstractSinglePersistenceFactory(Class theClass, String name, String description,
+			String domainName, String domainUrl){
+		if( domainName == null ) {
+			domainName = PersistenceManager.DEFAULT_DOMAIN_NAME;
+		}
+		if( domainUrl == null ) {
+			domainUrl = PersistenceManager.DEFAULT_DOMAIN_URL;
+		}
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		DynClass definition = dynman.createDynClass(PersistenceManager.PERSISTENCE_NAMESPACE, name, description);
+		dynman.add(definition);
+		this.definition = definition;
+		this.theClass = theClass;
+		this.domainUrl = domainUrl;
+		this.domainName = domainName;
+	}
+
+	protected DynStruct getDefinition() {
+		return this.definition;
+	}
+	
+	public DynStruct getDefinition(String name) {
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			return this.definition;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			return this.definition;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return this.definition;
+		}
+		return null;
+	}
+
+	public List getDefinitions() {
+		return Collections.singletonList( this.definition);
+	}
+
+	public String getDomainName() {
+		return this.domainName;
+	}
+
+	public String getDomainURL() {
+		return this.domainUrl;
+	}
+
+	public Class getManagedClass(Object object) {
+		if( this.theClass.isInstance(object) ) {
+			return this.theClass;
+		}
+		return null;
+	}
+
+	public String getManagedClassName(Object object) {
+		Class clazz = this.getManagedClass(object);
+		if (clazz != null){
+			return clazz.getName();
+		}
+		return null;
+	}
+
+	public Class getManagedClass(PersistentState state) {
+		return this.getManagedClass(state.getTheClassName());
+	}
+	
+	public Class getManagedClass(String name) {
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			return this.theClass;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			return this.theClass;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return this.theClass;
+		}
+		return null;
+	}
+	
+	public List getManagedClasses() {
+		return Collections.singletonList(this.theClass);
+	}
+
+	public void loadFromState(PersistentState state, Object object)
+			throws PersistenceException {
+		// By defaultdo nothing
+	}
+
+	public boolean manages(Object object) {
+		return theClass.isInstance(object);
+	}
+
+	public boolean manages(Class theClass) {
+		return this.theClass.isAssignableFrom(theClass);
+	}
+
+	public boolean manages(PersistentState state) {
+		if( state == null ) {
+			return false;
+		}
+		String name = state.getTheClassName();
+		if( this.definition.getName().equalsIgnoreCase(name)) {
+			return true;
+		}
+		if( this.definition.getFullName().equalsIgnoreCase(name)) {
+			return true;
+		}
+		if( this.theClass.getName().equals(name) ) {
+			return true;
+		}
+		return false;
+	}
+
+
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+
+		buffer.append("SinglePersistenceFactory").append("[").append(
+				this.hashCode()).append("]").append("( ")
+				.append("definitions=").append(this.definition).append(", ")
+				.append("domainName='").append(domainName).append("', ")
+				.append("domainUrl='").append(domainUrl).append("', ").append(
+						"theClass=").append(this.theClass).append(" )");
+		return buffer.toString();
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/AbstractSinglePersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentContext.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentContext.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentContext.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.persistence;
+
+import java.util.Iterator;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public interface PersistentContext {
+
+	/**
+	 * Return an iterator over the states stored in this
+	 * context.
+	 * 
+	 * @return iterator of PersistentState
+	 */
+	public Iterator iterator();
+
+
+	/**
+	 * Add a error to the list of errors of the context.
+	 * 
+	 * @param cause
+	 */
+	public void addError(Throwable cause);
+	
+	/**
+	 * Get all errors collected to the moment in this context.
+	 * 
+	 * @return a PersistentException with al errors.
+	 */
+	public PersistenceException getErrors();
+
+
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentContext.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentityManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentityManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentityManager.java	(revision 1235)
@@ -0,0 +1,69 @@
+package org.gvsig.tools.identitymanagement;
+
+import java.util.Collection;
+
+
+public interface SimpleIdentityManager {
+    //
+    // http://en.wikipedia.org/wiki/Identity_management
+    //
+    
+    /**
+     * Authenticate the identity in the system and stablish a session with this
+     * identity.
+     * If the identityid don't exists or the password specified is incorrect, throw
+     * a exception.
+     *
+     * If the domain is not required it can not be null.
+     *
+     * @param domain, the domain used to authenticate the user
+     * @param identityid, identity id to login in the system
+     * @param password
+     */
+    public void login(String domain, String identityid, String password) throws UnauthorizedException;
+
+    /**
+     * Closes the session stablised with the current identity.
+     */
+    public void logout();
+
+    /**
+     * Return the identity of the current session in the system or null if no has a
+     * session stablisehd.
+     *
+     * @return the current identity
+     */
+    public SimpleIdentity getCurrentIdentity();
+
+    public SimpleIdentity getAdministrator();
+    
+    /**
+     * Inform if the login process require a domain name.
+     *
+     * @return true if a domain name is required.
+     */
+    public boolean needDomain();
+    
+    /**
+     * Run the specified action as the specified identity.
+     * 
+     * @param domain
+     * @param identityid
+     * @param acction 
+     */
+    public void sudo(String domain, String identityid, Runnable acction);
+ 
+    /**
+     * Register the actionName as an action that require authorization.
+     * 
+     * @param actionName 
+     */
+    public void registerAction(String actionName);
+    
+    /**
+     * Return a list of the actions that are registered.
+     * 
+     * @return list of action names that requiere authorization.
+     */
+    public Collection getActions();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/UnauthorizedException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/UnauthorizedException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/UnauthorizedException.java	(revision 1235)
@@ -0,0 +1,83 @@
+package org.gvsig.tools.identitymanagement;
+
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.tools.ToolsLocator;
+
+public class UnauthorizedException extends RuntimeException {
+
+    private SimpleIdentity identity;
+    private String actionName;
+    private Object resource;
+    private String resourceName;
+
+    public UnauthorizedException(SimpleIdentity identity, String actionName, Object resource, String resourceName) {
+        this.actionName = actionName;
+        this.identity = identity;
+        this.resource = resource;
+        this.resourceName = resourceName;
+        if (this.identity == null) {
+            SimpleIdentityManager identityManager = ToolsLocator.getIdentityManager();
+            this.identity = identityManager.getCurrentIdentity();
+        }
+    }
+
+    public UnauthorizedException(String actionName, Object resource, String resourceName) {
+        this(null, actionName, resource, resourceName);
+    }
+
+    @Override
+    public String getMessage() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("User '");
+        builder.append(this.identity.getID());
+        builder.append("' is not authorized to '");
+        builder.append(this.actionName);
+        builder.append("'");
+        if (!StringUtils.isBlank(this.resourceName)) {
+            builder.append(" to resource '");
+            builder.append(this.resourceName);
+            builder.append("'");
+        }
+        if (this.resource != null) {
+            String s = null;
+            try {
+                s = resource.toString();
+            } catch (Throwable th) {
+                // Do nothing.
+            }
+            if (s != null) {
+                builder.append(" (");
+                builder.append(s);
+                builder.append(" )");
+            }
+        }
+        return builder.toString();
+    }
+
+    public SimpleIdentity getIdentity() {
+        return identity;
+    }
+
+    public String getActionName() {
+        return actionName;
+    }
+
+    public Object getResource() {
+        return resource;
+    }
+
+    public String getResourceAsString() {
+        String s = null;
+        try {
+            s = resource.toString();
+        } catch (Throwable th) {
+            // Do nothing.
+        }
+        return s;
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentity.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentity.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentity.java	(revision 1235)
@@ -0,0 +1,19 @@
+
+
+package org.gvsig.tools.identitymanagement.impl;
+
+import org.gvsig.tools.identitymanagement.spi.AbstractSimpleIdentity;
+
+
+public class DumbIdentity extends AbstractSimpleIdentity {
+    private String id;
+
+    public DumbIdentity(String id) {
+        this.id = id;
+    }
+    
+    public String getID() {
+        return id;
+    }
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentityManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentityManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/impl/DumbIdentityManager.java	(revision 1235)
@@ -0,0 +1,41 @@
+
+package org.gvsig.tools.identitymanagement.impl;
+
+import org.gvsig.tools.identitymanagement.SimpleIdentity;
+import org.gvsig.tools.identitymanagement.UnauthorizedException;
+import org.gvsig.tools.identitymanagement.spi.AbstractSimpleIdentityManager;
+
+
+public class DumbIdentityManager extends AbstractSimpleIdentityManager {
+
+    private SimpleIdentity current = null;
+    
+    public DumbIdentityManager() {
+        super();
+        this.current = new DumbIdentity("guest");
+    }
+    
+    public void login(String domain, String identityid, String password) throws UnauthorizedException {
+        this.current = new DumbIdentity(identityid);
+    }
+
+    public void logout() {
+        this.current = null;
+    }
+
+    public SimpleIdentity getCurrentIdentity() {
+        return this.current;
+    }
+
+    public void sudo(String domain, String identityid, Runnable acction) {
+        SimpleIdentity save = this.current;
+        this.current = new DumbIdentity(identityid);
+        try {
+            acction.run();
+        } finally {
+            this.current = save;
+        }
+    }
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentity.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentity.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/SimpleIdentity.java	(revision 1235)
@@ -0,0 +1,80 @@
+package org.gvsig.tools.identitymanagement;
+
+import java.util.List;
+
+public interface SimpleIdentity {
+
+    public static final String READ_AUTHORIZATION = "access--read";
+    public static final String WRITE_AUTHORIZATION = "access--write";
+    
+    /**
+     * Return the identifier of this user
+     *
+     * @return the id of the user
+     */
+    public String getID();
+
+    public String getName();
+    
+    public String getFullName();
+    
+    public List getAttributeNames();
+    
+    public String getAttribute(String name);
+
+    /**
+     * Checks is the identity is authorized to perform the action.
+     * If the identity is authorized to execute the accion return true, 
+     * otherwise false.
+     *
+     * "actionName", can be a single name or a list of coma separated names.
+     *
+     * If actionName is a list of actions, fails when not authorized to one of 
+     * the actions.
+     * 
+     * @param actionName 
+     * @return true if the identity is authorized
+     */
+    public boolean isAuthorized(String actionName);
+
+    /**
+     * Checks is the identity is authorized to perform the action on the 
+     * indicated resource. 
+     * If the identity is authorized to execute the accion return true, 
+     * otherwise false.
+     *
+     * "actionName", can be a single name or a list of coma sepaated
+     * names.
+     *
+     * @param actionName
+     * @param resource
+     * @param resourceName
+     * @return true if the identity is authorized
+     */
+    public boolean isAuthorized(String actionName, Object resource, String resourceName);
+
+    /**
+     * Checks if the identity has read access on the indicated resource.
+     * This method is a utility method for:
+     * 
+     * {@link #isAuthorized(READ_AUTHORIZATION, resource, resourceName) 
+     * 
+     * @param resource
+     * @param resourceName
+     * @return  true if the identity has read access
+     */
+    public boolean canRead(Object resource, String resourceName);
+    
+    /**
+     * Checks if the identity has read access on the indicated resource.
+     * This method is a utility method for:
+     * 
+     * {@link #isAuthorized(WRITE_AUTHORIZATION, resource, resourceName) 
+     * 
+     * @param resource
+     * @param resourceName
+     * @return  true if the identity has write access
+     */
+    public boolean canWrite(Object resource, String resourceName);
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentity.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentity.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentity.java	(revision 1235)
@@ -0,0 +1,45 @@
+
+
+package org.gvsig.tools.identitymanagement.spi;
+
+import java.util.List;
+import org.gvsig.tools.identitymanagement.SimpleIdentity;
+
+
+public abstract class AbstractSimpleIdentity implements SimpleIdentity {
+    
+    public String getName() {
+        return this.getID();
+    }
+    
+    public String getFullName() {
+        return this.getName();
+    }
+    
+    public List getAttributeNames() {
+        return null;
+    }
+    
+    public String getAttribute(String name) {
+        return null;
+    }
+
+    public boolean isAuthorized(String actionName) {
+        boolean b = true;
+        return b;
+    }
+    
+    public boolean isAuthorized(String actionName, Object resource, String resourceName) {
+        boolean b = true;
+        return b;
+    }
+
+    public boolean canRead(Object resource, String resourceName) {
+        return this.isAuthorized(READ_AUTHORIZATION, resource, resourceName);
+    }
+
+    public boolean canWrite(Object resource, String resourceName) {
+        return this.isAuthorized(WRITE_AUTHORIZATION, resource, resourceName);
+    }
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentityManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentityManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/identitymanagement/spi/AbstractSimpleIdentityManager.java	(revision 1235)
@@ -0,0 +1,34 @@
+
+package org.gvsig.tools.identitymanagement.spi;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
+import org.gvsig.tools.identitymanagement.SimpleIdentity;
+import org.gvsig.tools.identitymanagement.SimpleIdentityManager;
+
+public abstract class AbstractSimpleIdentityManager implements SimpleIdentityManager {
+
+    protected Set registeredActions = null;
+    
+    protected AbstractSimpleIdentityManager() {
+        this.registeredActions = new TreeSet();
+    }
+
+    public SimpleIdentity getAdministrator() {
+        return this.getCurrentIdentity();
+    }
+    
+    public boolean needDomain() {
+        return false;
+    }
+
+    public void registerAction(String actionName) {
+        this.registeredActions.add(actionName);
+    }
+
+    public Collection getActions() {
+        return Collections.unmodifiableCollection(this.registeredActions);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionSingleton.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionSingleton.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionSingleton.java	(revision 1235)
@@ -0,0 +1,28 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.extensionpoint;
+
+public interface ExtensionSingleton {
+	// this is a label do not have action.
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPointManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPointManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPointManager.java	(revision 1235)
@@ -0,0 +1,113 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.extensionpoint;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+
+public interface ExtensionPointManager {
+
+	/**
+	 * Crea un nuevo punto de extension y nos lo debuelve. El nuevo punto de
+	 * extension no se a�ade al registro.
+	 *
+	 * @param name
+	 *            , nombre del punto de extension a crear.
+	 * @param description
+	 *            , descripcion del punto de extension a crear.
+	 * @return el punto de extension creado.
+	 */
+	public ExtensionPoint create(String name, String description);
+
+	/**
+	 * A�ade el punto de extension indicado al registro de puntos de extension.
+	 * Si el punto de extension ya existiese, lo actualia sustituyendo el
+	 * anterior por el nuevo.
+	 *
+	 * @param extensionPoint
+	 *            , punto de extension a a�adir al registro.
+	 * @return true si todo va bien, false si no.
+	 */
+	public boolean add(ExtensionPoint extensionPoint);
+
+	/**
+	 * Obtiene el punto de extension asociado al nombre indicado.
+	 *
+	 * @param name
+	 *            , nombre del punto de extension que queremos obtener.
+	 * @return el punto de extension requerido.
+	 */
+	public ExtensionPoint get(String name);
+
+	/**
+	 * Comprueba si un punto de extension existe.
+	 *
+	 * @return true si el punto de extension "name" existe.
+	 */
+	public boolean has(String name);
+
+	/**
+	 * Obtiene el numero de puntos de extension existentes.
+	 *
+	 * @return
+	 */
+	public int getCount();
+
+	/**
+	 * Obtiene un iterador sobre los puntos de extension existentes.
+	 *
+	 * @return
+	 */
+	public Iterator interator();
+
+	/**
+	 * Obtiene la lista de nombres de los puntos de extension existentes.
+	 *
+	 * @return
+	 */
+	public List getNames();
+
+	/**
+	 * Metodo de utilidad para facilitar la creacion de puntos de extension.
+	 * Comprueba si el punto de extension "name" no existe y en ese caso lo crea
+	 * y a�ade.
+	 *
+	 * @param nam
+	 *            , nombre del punto de extension
+	 * @param description
+	 *            , descripcion del punto de extension
+	 * @return el punto de extension recien creado o el ya existente con ese
+	 *         nmbre
+	 */
+	public ExtensionPoint add(String name, String description);
+
+	public ExtensionPoint add(String name);
+
+
+	public Object createObject(Class klass, Object[] paramters)
+			throws SecurityException, NoSuchMethodException,
+			IllegalArgumentException, InstantiationException,
+			IllegalAccessException, InvocationTargetException;
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPointManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPointManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPointManager.java	(revision 1235)
@@ -0,0 +1,243 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.extensionpoint.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.extensionpoint.ExtensionBuilder;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+
+public class DefaultExtensionPointManager implements ExtensionPointManager {
+
+	private static DefaultExtensionPointManager manager = null;
+
+	private Map extensionsPoints;
+
+	public DefaultExtensionPointManager() {
+		this.extensionsPoints = new HashMap();
+	}
+
+	public static DefaultExtensionPointManager getManager() {
+		if (manager == null) {
+			manager = new DefaultExtensionPointManager();
+		}
+		return manager;
+	}
+
+	public Object create(Class cls) throws InstantiationException,
+			IllegalAccessException {
+		Object obj = null;
+
+		if (cls == null) {
+			return null;
+		}
+		obj = cls.newInstance();
+		return obj;
+	}
+
+	public Object create(Class cls, Map args) throws SecurityException,
+			NoSuchMethodException, IllegalArgumentException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException {
+		Object[] argsx = new Object[1];
+		argsx[0] = args;
+		return this.createObject(cls, argsx);
+	}
+
+	public Object create(Class cls, Object[] args) throws SecurityException,
+			NoSuchMethodException, IllegalArgumentException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException {
+
+		return this.createObject(cls, args);
+
+	}
+
+	/**
+	 * @param cls
+	 * @param types
+	 * @return
+	 * @throws NoSuchMethodException
+	 * @throws SecurityException
+	 */
+	private 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 defined.isAssignableFrom(current);
+		}
+	}
+
+	public ExtensionPoint create(String name, String description) {
+		return new DefaultExtensionPoint(this, name, description);
+	}
+
+	public boolean add(ExtensionPoint extensionPoint) {
+	    ExtensionPoint original = (ExtensionPoint) extensionsPoints
+                .get(extensionPoint.getName());
+	    if (original == null) {
+	        extensionsPoints.put(extensionPoint.getName(), extensionPoint);
+	    } else {
+	        for (Iterator iterator = extensionPoint.iterator(); iterator
+                    .hasNext();) {
+                Extension extension = (Extension) iterator.next();
+                if (extension.getBuilder() != null) {
+                    original.append(extension.getName(), extension
+                            .getDescription(), extension.getBuilder());
+                } else {
+                    original.append(extension.getName(), extension
+                            .getDescription(), extension.getExtension());
+                }
+            }
+        }
+		return true;
+	}
+
+	public synchronized ExtensionPoint add(String name, String description) {
+		ExtensionPoint ep = (ExtensionPoint) this.extensionsPoints.get(name);
+		if (ep == null) {
+			ep = new DefaultExtensionPoint(this, name, description);
+			this.extensionsPoints.put(ep.getName(), ep);
+		}
+		return ep;
+	}
+
+	public ExtensionPoint add(String name) {
+		return add(name, null);
+	}
+
+	public ExtensionPoint.Extension add(String name, String description,
+			String extName,
+			String extDescription, Class extension) {
+		ExtensionPoint ep = add(name, description);
+		return ep.append(extName, extDescription, extension);
+	}
+
+	public ExtensionPoint.Extension add(String name, String description,
+			String extName,
+			String extDescription, ExtensionBuilder builder) {
+		ExtensionPoint ep = add(name, description);
+		return ep.append(extName, extDescription, builder);
+	}
+
+	public ExtensionPoint get(String name) {
+		return (ExtensionPoint) this.extensionsPoints.get(name);
+	}
+
+	public int getCount() {
+		return this.extensionsPoints.size();
+	}
+
+	public boolean has(String name) {
+		return this.extensionsPoints.get(name) != null;
+	}
+
+	public Iterator interator() {
+		return this.extensionsPoints.values().iterator();
+	}
+
+	public List getNames() {
+		String[] names = (String[]) this.extensionsPoints.keySet().toArray();
+		Arrays.sort(names);
+		return Collections.unmodifiableList(Arrays.asList(names));
+	}
+
+	public Object createObject(Class klass, Object[] args)
+			throws SecurityException, NoSuchMethodException,
+			IllegalArgumentException, InstantiationException,
+			IllegalAccessException, InvocationTargetException {
+		Object obj = null;
+		Constructor create = null;
+		Class[] types = new Class[args.length];
+
+		if (klass == null) {
+			return null;
+		}
+		for (int n = 0; n < args.length; n++) {
+			Object arg = args[n];
+			if (arg != null) {
+				types[n] = arg.getClass();
+			} else {
+				types[n] = null;
+			}
+		}
+		create = this.findConstructor(klass, types);
+
+		obj = create.newInstance(args);
+		return obj;
+
+	}
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPoint.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPoint.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/impl/DefaultExtensionPoint.java	(revision 1235)
@@ -0,0 +1,336 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.extensionpoint.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+
+import org.gvsig.tools.extensionpoint.ExtensionBuilder;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.extensionpoint.ExtensionSingleton;
+
+public class DefaultExtensionPoint implements ExtensionPoint {
+
+	class Extension implements ExtensionPoint.Extension {
+		private Class extension;
+		private ExtensionBuilder builder;
+		private ExtensionSingleton singleton;
+		private String name;
+		private String description;
+		List alias;
+
+		Extension(String name, String description, Class extension) {
+			alias = new ArrayList();
+			this.name = name;
+			this.description = description;
+			this.builder = null;
+			this.extension = extension;
+			this.singleton = null;
+		}
+
+		Extension(String name, String description, ExtensionBuilder builder) {
+			alias = new ArrayList();
+			this.name = name;
+			this.description = description;
+			this.builder = builder;
+			this.extension = null;
+			this.singleton = null;
+		}
+
+		Extension(String name, String description, ExtensionSingleton singleton) {
+			alias = new ArrayList();
+			this.name = name;
+			this.description = description;
+			this.builder = null;
+			this.extension = null;
+			this.singleton = singleton;
+
+		}
+
+		public List getAlias() {
+			return Collections.unmodifiableList(this.alias);
+		}
+
+		public ExtensionBuilder getBuilder() {
+			return this.builder;
+		}
+
+		public String getDescription() {
+			return this.description;
+		}
+
+		public Class getExtension() {
+			return this.extension;
+		}
+
+		public String getName() {
+			return this.name;
+		}
+
+		public boolean isBuilder() {
+			return this.builder != null;
+		}
+
+		public boolean isSingleton() {
+			return this.singleton != null;
+		}
+
+		public Object create() throws InstantiationException,
+			IllegalAccessException {
+			if( isSingleton() ) {
+				return this.singleton;
+			}
+			if (isBuilder()) {
+				return getBuilder().create();
+			}
+			return manager.create(getExtension());
+		}
+
+
+		public Object create(Object[] args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException {
+			if( isSingleton() ) {
+				return this.singleton;
+			}
+			if (isBuilder()) {
+				return getBuilder().create(args);
+			}
+			return manager.create(getExtension(), args);
+		}
+
+		public Object create(Map args) throws SecurityException,
+				IllegalArgumentException, NoSuchMethodException,
+				InstantiationException, IllegalAccessException,
+				InvocationTargetException {
+			if( isSingleton() ) {
+				return this.singleton;
+			}
+			if (isBuilder()) {
+				return getBuilder().create(args);
+			}
+			return manager.create(getExtension(), args);
+		}
+
+	}
+
+	private String name;
+	private String description;
+
+	private Map alias; // Map of Extension
+	private LinkedHashMap extensions; // Map of Extension
+
+	private DefaultExtensionPointManager manager;
+
+	DefaultExtensionPoint(ExtensionPointManager manager, String name) {
+		this(manager, name, "");
+	}
+
+	DefaultExtensionPoint(ExtensionPointManager manager, String name,
+			String description) {
+		this.manager = (DefaultExtensionPointManager) manager;
+		this.name = name;
+		this.description = description;
+		this.alias = new HashMap();
+		this.extensions = new LinkedHashMap();
+	}
+
+	private ExtensionPoint.Extension append(Extension extension) {
+		this.extensions.put(extension.getName(), extension);
+		return extension;
+	}
+
+	public ExtensionPoint.Extension append(String name, String description,
+			ExtensionBuilder builder) {
+		return append(new Extension(name, description, builder));
+	}
+
+	public ExtensionPoint.Extension append(String name, String description,
+			Class extension) {
+		return append(new Extension(name, description, extension));
+	}
+
+	public ExtensionPoint.Extension append(String name, String description,
+			ExtensionSingleton extension) {
+		return append(new Extension(name, description, extension));
+	}
+
+	public String getDescription() {
+		return this.description;
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	private Extension insert(Extension extension) {
+		LinkedHashMap x = new LinkedHashMap();
+		x.put(extension.getName(), extension);
+		x.putAll(this.extensions);
+		this.extensions = x;
+		return extension;
+	}
+
+	public ExtensionPoint.Extension insert(String name, String description,
+			Class extension) {
+		return insert(new Extension(name, description, extension));
+	}
+
+	public ExtensionPoint.Extension insert(String name, String description,
+			ExtensionSingleton extension) {
+		return insert(new Extension(name, description, extension));
+	}
+
+	public ExtensionPoint.Extension insert(String name, String description,
+			ExtensionBuilder builder) {
+		return insert(new Extension(name, description, builder));
+	}
+
+	private ExtensionPoint.Extension insert(String beforeName,
+			Extension extension) {
+		if (extensions.containsKey(beforeName)) {
+            LinkedHashMap x = new LinkedHashMap();
+
+            Iterator it = this.extensions.entrySet().iterator();
+            while (it.hasNext()) {
+                Map.Entry e = (Map.Entry) it.next();
+                if (e.getKey().equals(beforeName)) {
+                    x.put(extension.getName(), extension);
+                }
+                x.put(e.getKey(), e.getValue());
+            }
+            this.extensions = x;
+        } else {
+            // If the beforName extension is not already registered, add
+            // the new extension as the last one
+            extensions.put(extension.getName(), extension);
+        }
+		
+		return extension;
+	}
+
+	synchronized public ExtensionPoint.Extension insert(String beforeName,
+			String name,
+			String description, Class extension) {
+		return insert(beforeName, new Extension(name, description, extension));
+	}
+
+	synchronized public ExtensionPoint.Extension insert(String beforeName,
+			String name,
+			String description, ExtensionSingleton extension) {
+		return insert(beforeName, new Extension(name, description, extension));
+	}
+
+	synchronized public ExtensionPoint.Extension insert(String beforeName,
+			String name,
+			String description, ExtensionBuilder builder) {
+		return insert(beforeName, new Extension(name, description, builder));
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public boolean addAlias(String name, String alias) {
+		Extension extension = (Extension) this.extensions.get(name);
+		if (extension == null) {
+			return false;
+		}
+		this.alias.put(alias, extension);
+		extension.alias.add(alias);
+		return true;
+	}
+
+	public Object create(String name) throws InstantiationException,
+			IllegalAccessException {
+		Extension extension = (Extension) this.alias.get(name);
+		if (extension == null) {
+			extension = (Extension) this.extensions.get(name);
+			if (extension == null) {
+				return null; // FIXME: throw exception
+			}
+		}
+		return extension.create();
+	}
+
+	public Object create(String name, Object[] args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException {
+		Extension extension = (Extension) this.alias.get(name);
+		if (extension == null) {
+			extension = (Extension) this.extensions.get(name);
+			if (extension == null) {
+				return null; // FIXME: throw exception
+			}
+		}
+		return extension.create(args);
+	}
+
+	public Object create(String name, Map args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException {
+		Extension extension = (Extension) this.alias.get(name);
+		if (extension == null) {
+			extension = (Extension) this.extensions.get(name);
+			if (extension == null) {
+				return null; // FIXME: throw exception
+			}
+		}
+		return extension.create(args);
+	}
+
+	public ExtensionPoint.Extension get(String name) {
+		Extension extension = (Extension) this.alias.get(name);
+		if (extension == null) {
+			extension = (Extension) this.extensions.get(name);
+			if (extension == null) {
+				return null; // FIXME: throw exception
+			}
+		}
+		return extension;
+	}
+
+	public int getCount() {
+		return this.extensions.size();
+	}
+
+	public Iterator iterator() {
+		return this.extensions.values().iterator();
+	}
+
+	public List getNames() {
+		String[] names = (String[]) this.extensions.keySet().toArray(new String[this.extensions.size()]);
+		Arrays.sort(names);
+		return Collections.unmodifiableList(Arrays.asList(names));
+	}
+
+	public boolean has(String name) {
+		return this.extensions.containsKey(name);
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionBuilder.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionBuilder.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionBuilder.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.extensionpoint;
+
+import java.util.Map;
+
+/**
+ * Interface utilizado para indicar al registro de extensiones
+ * que no se trata de una clase lo que hey registrado, si no
+ * una instancia de un objeto a usar para crear la extension.
+ * 
+ * 
+ * @author jjdelcerro
+ *
+ */
+public interface ExtensionBuilder {
+	/**
+	 * Crea una instancia de la extension y la retorna.
+	 * <br>
+	 * @return
+	 */
+	public Object create();
+	
+	/**
+	 * Crea una instancia de la extension y la retorna.
+	 * <br>
+	 * En <i>args</i> recibira la lista de argumeentos a utilizar
+	 * para crear la extension.
+	 * <br>
+	 * @param args
+	 * @return
+	 */
+	public Object create(Object [] args);
+	
+	public Object create(Map args);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPoint.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPoint.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/extensionpoint/ExtensionPoint.java	(revision 1235)
@@ -0,0 +1,393 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.extensionpoint;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public interface ExtensionPoint {
+
+	/**
+	 * Clase que representa un registro dentro de un punto de extension.
+	 *
+	 * @author jjdelcerro
+	 *
+	 */
+	public interface Extension {
+
+		/**
+		 * Obtiene Nombre de la extension registrada.
+		 *
+		 * @return
+		 */
+		public String getName();
+
+		/**
+		 * Obtienen la descripcion de la extension registrada.
+		 *
+		 * @return
+		 */
+		public String getDescription();
+
+		/**
+		 * Obtiene la lista de alias que existen para este registro de
+		 * extension.
+		 *
+		 * @return
+		 */
+		public List getAlias();
+
+		/**
+		 * Inica si el registro de la extension contiene una clase o una
+		 * instancia que actua como factoria. En caso de que contenga una
+		 * instancia esta implementara el interface ExtensionBuilder.
+		 *
+		 * @return true si el registro uso un ExtensioBuilder en lugar de una
+		 *         clase.
+		 */
+		public boolean isBuilder();
+
+		public boolean isSingleton();
+		
+		/**
+		 * Obtiene la clase asociada a este registro de extension.
+		 *
+		 * @return la clase o null si isBuilder retorna true.
+		 */
+		public Class getExtension();
+
+		/**
+		 * Obtiene la instancia del ExtenstionBuilder asociada a este registro.
+		 *
+		 * @return una instancia de ExtensionBuilder o null si isBuilder retorna
+		 *         false.
+		 */
+		public ExtensionBuilder getBuilder();
+
+		public Object create() throws InstantiationException,
+			IllegalAccessException;
+
+		public Object create(Object[] args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException;
+
+		public Object create(Map args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException;
+
+	}
+
+	/**
+	 * Obtiene el nombre del punto de extension. El nombre de un punto de
+	 * extension se fija en la creacion de este y no puede ser modificado
+	 * posteriormente.
+	 *
+	 * @return
+	 */
+	public String getName();
+
+	/**
+	 * Obtiene la descripcion del punto de extension.
+	 *
+	 * @return
+	 */
+	public String getDescription();
+
+	/**
+	 * Permite actualizar la descripcion del punto de extension.
+	 *
+	 * @param description
+	 */
+	public void setDescription(String description);
+
+	/**
+	 * A�ade una extension nueva basada en una clase al registro de extensiones.
+	 * La nueva extension se a�adira al final de las ya existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , clase que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension append(String name, String description, Class extension);
+
+	/**
+	 * A�ade una extension nueva basada en una instancia que actuara a modo de
+	 * simgleton al registro de extensiones.
+	 * La nueva extension se a�adira al final de las ya existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , instancia que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension append(String name, String description, ExtensionSingleton extension);
+
+	/**
+	 * A�ade una extension nueva basada en ExtensioBuilder al registro de
+	 * extensiones. La nueva extension se a�adira al final de las ya existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param builder
+	 *            , instancia de ExtensionBuilder usada para crear la extension.
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension append(String name, String description,
+			ExtensionBuilder builder);
+
+	/**
+	 * A�ade una extension nueva basada en una clase al registro de extensiones.
+	 * La nueva extension se insertara al principio de las ya existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , clase que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String name, String description, Class extension);
+
+	/**
+	 * A�ade una extension nueva basada en una instancia que se comportara como
+	 * un singleton al registro de extensiones.
+	 * La nueva extension se insertara al principio de las ya existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , instancia que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String name, String description, ExtensionSingleton extension);
+
+	/**
+	 * A�ade una extension nueva basada en ExtensioBuilder al registro de
+	 * extensiones. La nueva extension se insertara al principio de las ya
+	 * existentes.
+	 *
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param builder
+	 *            , instancia de ExtensionBuilder usada para crear la extension.
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String name, String description,
+			ExtensionBuilder builder);
+
+	/**
+	 * A�ade una extension nueva basada en una clase al registro de extensiones.
+	 * La nueva extension se insertara antes de la extension registrada con el
+	 * nombre indicado en beforeName.
+	 *
+	 * @param beforeName
+	 *            , nombre de la extension delante de la que se insertara la
+	 *            nueva.
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , clase que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String beforeName, String name, String description,
+			Class extension);
+
+	/**
+	 * A�ade una extension nueva basada en una instancia que se comportara como
+	 * un singleton al registro de extensiones.
+	 * La nueva extension se insertara antes de la extension registrada con el
+	 * nombre indicado en beforeName.
+	 *
+	 * @param beforeName
+	 *            , nombre de la extension delante de la que se insertara la
+	 *            nueva.
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param extension
+	 *            , instancia que implementa esa extension
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String beforeName, String name, String description,
+			ExtensionSingleton extension);
+
+	/**
+	 * A�ade una extension nueva basada en ExtensioBuilder al registro de
+	 * extensiones. La nueva extension se insertara antes de la extension
+	 * registrada con el nombre indicado en beforeName.
+	 *
+	 * @param beforeName
+	 *            , nombre de la extension delante de la que se insertara la
+	 *            nueva.
+	 * @param name
+	 *            , nombre de la extension
+	 * @param description
+	 *            , descripcion de la extenscion.
+	 * @param builder
+	 *            , instancia de ExtensionBuilder usada para crear la extension.
+	 * @return una instancia de la extension creada.
+	 */
+	public Extension insert(String beforeName, String name, String description,
+			ExtensionBuilder builder);
+
+	/**
+	 * Crea un alias para un registro de extension.
+	 *
+	 * @param name
+	 *            , nombre de la extension sobre la que se va a a�adir un alias.
+	 * @param alias
+	 *            , alias a crear.
+	 * @return
+	 */
+	public boolean addAlias(String name, String alias);
+
+	/**
+	 * Devuelbe un iterador sobre las extensiones registradas en este punto de
+	 * extension.
+	 *
+	 * @return
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Devuelbe una lista con los nombres de las extensiones registradas en el
+	 * punto de extension.
+	 *
+	 * @return
+	 */
+	public List getNames();
+
+	/**
+	 * Devuelbe el numero de registros que existen en el punto de extension.
+	 *
+	 * @return
+	 */
+	public int getCount();
+
+	/**
+	 * Permite obtener un registro de extension dado su nombre o alias.
+	 *
+	 * @param name
+	 *            , nombre o alias de la extension
+	 * @return extension pedida o null si no existe una con el nombre o alias
+	 *         indicado.
+	 */
+	public Extension get(String name);
+
+	/**
+	 * Crea una instancia asociada al contenido del registro de extension de
+	 * nombre o alias indicado. Si el registro tiene asociada una clase creara
+	 * una nueva instancia de esta y la devolbera. Si tiene asociado un builder
+	 * lo usara para construir una instancia y la devolvera.
+	 *
+	 * @param name
+	 *            , de la entrada del registro de la que queremos obtener la
+	 *            instancia.
+	 * @return instancia creada o null si no existen una con el nombre o alias
+	 *         indicado.
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 */
+	public Object create(String name) throws InstantiationException,
+			IllegalAccessException;
+
+	/**
+	 * Crea una instancia asociada al contenido del registro de extension de
+	 * nombre o alias indicado. Si el registro tiene asociada una clase creara
+	 * una nueva instancia de esta y la devolbera. Si tiene asociado un builder
+	 * lo usara para construir una instancia y la devolvera.
+	 *
+	 *
+	 * @param name
+	 *            , de la entrada del registro de la que queremos obtener la
+	 *            instancia.
+	 * @param args
+	 *            , representa un array con los parametros a suministrar en la
+	 *            creacion de la nueva instancia.
+	 * @return instancia creada o null si no existen una con el nombre o alias
+	 *         indicado.
+	 * @throws SecurityException
+	 * @throws IllegalArgumentException
+	 * @throws NoSuchMethodException
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 * @throws InvocationTargetException
+	 */
+	public Object create(String name, Object[] args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException;
+
+	/**
+	 * Crea una instancia asociada al contenido del registro de extension de
+	 * nombre o alias indicado. Si el registro tiene asociada una clase creara
+	 * una nueva instancia de esta y la devolbera. Si tiene asociado un builder
+	 * lo usara para construir una instancia y la devolvera.
+	 *
+	 *
+	 * @param name
+	 *            , de la entrada del registro de la que queremos obtener la
+	 *            instancia.
+	 * @param args
+	 *            , representa un map que se pasara como primer parametro en la
+	 *            construccion de la instancia.
+	 * @return instancia creada o null si no existen una con el nombre o alias
+	 *         indicado.
+	 * @throws SecurityException
+	 * @throws IllegalArgumentException
+	 * @throws NoSuchMethodException
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 * @throws InvocationTargetException
+	 */
+	public Object create(String name, Map args) throws SecurityException,
+			IllegalArgumentException, NoSuchMethodException,
+			InstantiationException, IllegalAccessException,
+			InvocationTargetException;
+
+	public boolean has(String name);
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Notification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Notification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Notification.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+
+package org.gvsig.tools.observer;
+
+
+public interface Notification {
+
+    public String getType();
+
+    public Object getValue();
+
+    public Object getValue(int n);
+
+    public void setValue(Object value);
+
+    public void setValue(int n, Object value);
+
+    public boolean isCanceled();
+
+    public void cancel();
+    
+    public boolean isOfType(String type);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Subscribers.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Subscribers.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Subscribers.java	(revision 1235)
@@ -0,0 +1,16 @@
+package org.gvsig.tools.observer;
+
+public interface Subscribers {
+    
+    public void add(Object subscriber);
+    
+    public void remove(Object subscriber);
+    
+    public void removeAll();
+    
+    public Notification notifySubscribers(Object source, Notification notification);
+    public Notification notifySubscribers(Object source, String type, Object value);
+    public Notification notifySubscribers(Object source, String type, Object value1, Object value2);
+    public Notification notifySubscribers(Object source, String type, Object value1, Object value2, Object value3);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observer.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observer.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observer.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+import org.gvsig.tools.observer.impl.DefaultComplexNotification;
+
+/**
+ * A interface to be implemented by objects that want to be
+ * informed of changes in {@link Observable} objects.
+ * 
+ * @see ComplexObserver
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface Observer {
+
+    /**
+     * Called whenever a {@link Observable} object is changed and this
+     * {@link Observer} has registered on it to receive notifications.
+     * <p>
+     * Implementations of this method will be called for each simple
+     * notification or, if a complex notification is created, for each of the
+     * child notifications.
+     * </p>
+     * <p>
+     * In the latter case, don't assume any ordering in the notification between
+     * this {@link Observer} and other {@link Observer}s listening to the same
+     * {@link Observable}.
+     * </p>
+     * <p>
+     * In a complex notification scenario, if you want to receive only the
+     * complex notification and not each of the child notifications, just
+     * implement the {@link ComplexObserver} and prepare this method
+     * implementation to handle receiving {@link DefaultComplexNotification} instances
+     * as well as direct notification objects.
+     * </p>
+     * 
+     * @param observable
+     *            the observable object.
+     * @param notification
+     *            the notification data.
+     */
+	public void update(Observable observable, Object notification);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/AbstractSubscribers.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/AbstractSubscribers.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/AbstractSubscribers.java	(revision 1235)
@@ -0,0 +1,62 @@
+
+package org.gvsig.tools.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public abstract class AbstractSubscribers implements Subscribers {
+
+    private static final Logger logger = LoggerFactory.getLogger(AbstractSubscribers.class);
+
+    protected List subscribers = new ArrayList();
+
+    public synchronized void add(Object subscriber) {
+        if ( this.subscribers.contains(subscriber) ) {
+            return;
+        }
+        this.subscribers.add(subscriber);
+    }
+
+    public synchronized void remove(Object subscriber) {
+        this.subscribers.remove(subscriber);
+    }
+
+    public synchronized void removeAll() {
+        this.subscribers = new ArrayList();
+    }
+
+    public Notification notifySubscribers(Object source, String type, Object value) {
+        Notification notification = new BaseNotification(type, new Object[]{value});
+        this.notifySubscribers(source, notification);
+        return notification;
+    }
+
+    public Notification notifySubscribers(Object source, String type, Object value1, Object value2) {
+        Notification notification = new BaseNotification(type, new Object[]{value1, value2});
+        this.notifySubscribers(source, notification);
+        return notification;
+    }
+
+    public Notification notifySubscribers(Object source, String type, Object value1, Object value2, Object value3) {
+        Notification notification = new BaseNotification(type, new Object[]{value1, value2, value3});
+        this.notifySubscribers(source, notification);
+        return notification;
+    }
+
+    public synchronized Notification notifySubscribers(Object source, Notification notification) {
+        for ( int i = 0; i < this.subscribers.size(); i++ ) {
+            Object subscriber = this.subscribers.get(i);
+            try {
+                notifySubscriber(subscriber, source, notification);
+            } catch (Exception ex) {
+                logger.warn("Error notifying to the subscribers.", ex);
+            }
+        }
+        return notification;
+    }
+
+    protected abstract  void notifySubscriber(Object subscriber, Object source, Notification data);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObservable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObservable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObservable.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+import org.gvsig.tools.observer.impl.DefaultComplexNotification;
+
+public interface ComplexObservable {
+
+    /**
+	 * Disable the notification of events to registered Observers.
+	 */
+	void disableNotifications();
+
+	/**
+	 * Enable (default) the notification of events to registered Observers.
+	 */
+	void enableNotifications();
+
+	/**
+	 * Sets the Observable in complex notification mode. All notifications must
+	 * be stored, until the mode ends, and then notify all Observers with all
+	 * the notifications.
+	 */
+	void beginComplexNotification();
+
+	    /**
+     * Ends the complex notification mode. All notifications stored while in
+     * complex notification mode, will be notified to the registered Observers.
+     * <p>
+     * If a observer is a {@link ComplexObserver}, it will be notified with a
+     * single {@link DefaultComplexNotification} instead of each of the notifications.
+     * </p>
+     * <p>
+     * Some important notes to take into account when calling this method.
+     * <ul>
+     * <li>
+     * Observers must not rely in the order used to perform the notifications.
+     * The notifications order is maintained, but the notification to all the
+     * observers might be performed for each notification to all observers, or
+     * for each observer all notifications.</li>
+     * <li>
+     * The notification process works as an atomic action, so if while an
+     * {@link Observer} is processing a notification another {@link Observer} is
+     * registered to the source {@link Observable}, it won't get any of the
+     * notifications currently being notified, but future ones.</li>
+     * </ul>
+     * </p>
+     */
+	void endComplexNotification();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexWeakReferencingObservable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexWeakReferencingObservable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexWeakReferencingObservable.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.observer;
+
+/**
+ * Adds operations to the Observable to perform complex notifications (a group
+ * of notifications to be performed in group), and to be able to enable/disable
+ * notifications.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface ComplexWeakReferencingObservable extends ComplexObservable,
+		WeakReferencingObservable {
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexNotification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexNotification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexNotification.java	(revision 1235)
@@ -0,0 +1,42 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+import org.gvsig.tools.visitor.Visitable;
+
+/**
+ * Interface for notifications generated by a {@link ComplexObservable} when the
+ * {@link ComplexObservable#beginComplexNotification()} method is used.
+ * <p>
+ * Once the {@link ComplexObservable#endComplexNotification()} is called, if an
+ * observer is a {@link ComplexObserver}, it will be notified with a
+ * {@link ComplexNotification}, instead of each of the individual notifications.
+ * </p>
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface ComplexNotification extends Visitable {
+    // Nothing to add
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObserver.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObserver.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ComplexObserver.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+import org.gvsig.tools.observer.impl.DefaultComplexNotification;
+
+/**
+ * Interface to mark {@link Observer} objects as able to handle
+ * {@link DefaultComplexNotification} objects by itself.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface ComplexObserver extends Observer {
+    // Nothing to add
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/BaseNotification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/BaseNotification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/BaseNotification.java	(revision 1235)
@@ -0,0 +1,51 @@
+package org.gvsig.tools.observer;
+
+public class BaseNotification implements Notification {
+
+    private final String type;
+    protected Object[] values;
+    protected boolean canceled = false;
+
+    public BaseNotification(String type, int values) {
+        this.type = type;
+        this.values = new Object[values];
+    }
+
+    public BaseNotification(String type, Object[] values) {
+        this.type = type;
+        this.values = values;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public boolean isOfType(String type) {
+        return type.equalsIgnoreCase(this.type);
+    }
+    
+    public Object getValue() {
+        return this.values[0];
+    }
+
+    public Object getValue(int n) {
+        return this.values[n];
+    }
+
+    public void setValue(Object value) {
+        this.values[0] = value;
+    }
+
+    public void setValue(int n, Object value) {
+        this.values[n] = value;
+    }
+
+    public boolean isCanceled() {
+        return this.canceled;
+    }
+
+    public void cancel() {
+        this.canceled = true;
+    }
+}
+
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/BaseWeakReferencingObservable.java	(revision 1235)
@@ -0,0 +1,394 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.tools.observer.impl;
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.observer.ComplexObserver;
+import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Implementation for observers based on the use of Reference, instead of direct
+ * Observer references.
+ *
+ * This way an Observer may be Garbagge collected if its unique reference is the
+ * one registered into the Observable.
+ *
+ * @author <a href="mailto:josemanuel.vivo@iver.es">Jos� Manuel Viv�</a>
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class BaseWeakReferencingObservable implements
+		ComplexWeakReferencingObservable, Cloneable {
+    private static final Logger LOG = 
+        LoggerFactory.getLogger(BaseWeakReferencingObservable.class);
+
+    private boolean propageNotifications = true;
+    private DefaultComplexNotification complexNotification = null;
+
+    private boolean changed = false;
+    private List obs = new ArrayList();
+
+	private int inComplexCount = 0;
+
+    /**
+     * Adds an observer to the set of observers for this object, provided that
+     * it is not the same as some observer already in the set. The order in
+     * which notifications will be delivered to multiple observers is not
+     * specified. See the class comment.
+     *
+     * @param observer
+     *            an observer to be added.
+     * @throws NullPointerException
+     *             if the parameter o is null.
+     */
+    public void addObserver(Observer observer) {
+        addObserver(new WeakReference(observer));
+    }
+
+    public void addObserver(Reference ref) {
+        if (ref == null || ref.get() == null) {
+            throw new NullPointerException();
+        }
+        Observer observer = (Observer) ref.get();
+        synchronized (obs) {
+            if (!contains(observer)) {
+                obs.add(ref);
+            }
+        }
+    }
+
+    public void addObservers(BaseWeakReferencingObservable observable) {
+        observable.clearDeadReferences();
+        Iterator iter = observable.obs.iterator();
+        while (iter.hasNext()) {
+            addObserver((Reference) iter.next());
+        }
+
+    }
+
+    /**
+     * Deletes an observer from the set of observers of this object. Passing
+     * <CODE>null</CODE> to this method will have no effect.
+     *
+     * @param observer
+     *            the observer to be deleted.
+     */
+    public void deleteObserver(Observer observer) {
+        deleteObserverReferenced(observer);
+    }
+
+    public void deleteObserver(Reference ref) {
+        synchronized (obs) {
+            obs.remove(ref);
+        }
+        deleteObserverReferenced((Observer) ref.get());
+    }
+
+    /**
+     * If this object has changed, as indicated by the <code>hasChanged</code>
+     * method, then notify all of its observers and then call the
+     * <code>clearChanged</code> method to indicate that this object has no
+     * longer changed.
+     * <p>
+     * Each observer has its <code>update</code> method called with two
+     * arguments: this observable object and <code>null</code>. In other words,
+     * this method is equivalent to: <blockquote><tt>
+     * notifyObservers(null)</tt>
+     * </blockquote>
+     *
+     * @see java.util.Observable#clearChanged()
+     * @see java.util.Observable#hasChanged()
+     * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+     */
+    public void notifyObservers() {
+        notifyObservers(null);
+    }
+
+    /**
+     * If this object has changed, as indicated by the <code>hasChanged</code>
+     * method, then notify all of its observers and then call the
+     * <code>clearChanged</code> method to indicate that this object has no
+     * longer changed.
+     * <p>
+     * Each observer has its <code>update</code> method called with two
+     * arguments: this observable object and the <code>arg</code> argument.					public void visit(Object obj)
+							throws VisitCanceledException, BaseException {
+						// TODO Auto-generated method stub
+						
+					}
+     *
+     * @param arg
+     *            any object.
+     * @see java.util.Observable#clearChanged()
+     * @see java.util.Observable#hasChanged()
+     * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+     */
+    public void notifyObservers(Object arg) {
+        if (!inComplex()) {
+            setChanged();
+            notify(this, arg);
+        } else {
+            complexNotification.addNotification(arg);
+        }
+
+    }
+
+    /**
+     * Clears the observer list so that this object no longer has any observers.
+     */
+    public void deleteObservers() {
+        synchronized (obs) {
+            obs.clear();
+        }
+    }
+
+    /**
+     * Returns the number of observers of this object.
+     *
+     * @return the number of observers of this object.
+     */
+    public int countObservers() {
+        clearDeadReferences();
+        synchronized (obs) {
+            return obs.size();
+        }
+    }
+
+    public void enableNotifications() {
+        clearDeadReferences();
+        propageNotifications = true;
+    }
+
+    public void disableNotifications() {
+        propageNotifications = false;
+    }
+
+    public boolean isEnabledNotifications() {
+        return propageNotifications;
+    }
+
+    public boolean inComplex() {
+		return inComplexCount > 0;
+    }
+
+    public void beginComplexNotification() {
+		if (inComplexCount == 0) {
+			clearDeadReferences();
+			clearChanged();
+			complexNotification = new DefaultComplexNotification();
+		}
+		inComplexCount++;
+    }
+
+    public void endComplexNotification() {
+		if (inComplexCount > 0) {
+			if (inComplexCount == 1) {
+                setChanged();
+                notify(this, complexNotification);
+				complexNotification = null;
+			}
+			inComplexCount--;
+		}
+    }
+
+	public Object clone() throws CloneNotSupportedException {
+		BaseWeakReferencingObservable clone =
+				(BaseWeakReferencingObservable) super.clone();
+
+		// Clone observers list
+		if (countObservers() > 0) {
+			clone.setObservers(getObservers());
+		}
+		
+		return clone;
+	}
+
+	private void setObservers(List observers) {
+		this.obs = new ArrayList(observers);
+	}
+
+	private List getObservers() {
+		return obs;
+	}
+
+    protected void notify(final WeakReferencingObservable observable,
+        final Object notification) {
+        if (!isEnabledNotifications()) {
+            return;
+        }
+
+        /*
+         * a temporary array buffer, used as a snapshot of the state of current
+         * Observers.
+         */
+        Object[] arrLocal;
+
+        synchronized (obs) {
+            /*
+             * We don't want the Observer doing callbacks into arbitrary code
+             * while holding its own Monitor. The code where we extract each
+             * DefaultObservable from the Vector and store the state of the
+             * Observer needs synchronization, but notifying observers does not
+             * (should not). The worst result of any potential race-condition
+             * here is that: 1) a newly-added Observer will miss a notification
+             * in progress 2) a recently unregistered Observer will be wrongly
+             * notified when it doesn't care
+             */
+            if (!changed) {
+                return;
+            }
+            arrLocal = obs.toArray();
+            clearChanged();
+        }
+
+        // Go through all the registered observers and call update on them.
+        // If any of the Reference is null, remove it from the list.
+        for (int i = arrLocal.length - 1; i >= 0; i--) {
+            final Observer observer =
+                (Observer) ((Reference) arrLocal[i]).get();
+            if (observer == null) {
+                obs.remove(arrLocal[i]);
+            } else {
+                //If there is an error updating an observer, the exception 
+                //has to be catched and next observer has to be updated. 
+                //This exception is written in the log but would be fine to send 
+                //a message to the user
+                try{
+                    // If the notification is complex, complex observers
+                    // are able to handle it.
+                    if (notification instanceof DefaultComplexNotification
+                        && !(observer instanceof ComplexObserver)) {
+
+                        ((DefaultComplexNotification) notification).accept(new Visitor() {
+
+                            public void visit(Object simpleNotification) {
+                                setChanged();
+                                observer.update(observable, simpleNotification);
+                            }
+                        });
+                    } else {
+                        observer.update(observable, notification);
+                    }
+                }catch (Exception e){
+                    LOG.error("Error notifying the observer", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Tests if this object has changed.
+     *
+     * @return <code>true</code> if and only if the <code>setChanged</code>
+     *         method has been called more recently than the
+     *         <code>clearChanged</code> method on this object;
+     *         <code>false</code> otherwise.
+     * @see java.util.Observable#clearChanged()
+     * @see java.util.Observable#setChanged()
+     */
+    protected boolean hasChanged() {
+        return changed;
+    }
+
+    /**
+     * Marks this <tt>DefaultObservable</tt> object as having been changed; the
+     * <tt>hasChanged</tt> method will now return <tt>true</tt>.
+     */
+    protected void setChanged() {
+        changed = true;
+    }
+
+    /**
+     * Indicates that this object has no longer changed, or that it has already
+     * notified all of its observers of its most recent change, so that the
+     * <tt>hasChanged</tt> method will now return <tt>false</tt>. This method is
+     * called automatically by the <code>notifyObservers</code> methods.
+     *
+     * @see java.util.Observable#notifyObservers()
+     * @see java.util.Observable#notifyObservers(java.lang.Object)
+     */
+    protected void clearChanged() {
+        changed = false;
+    }
+
+    private void clearDeadReferences() {
+        synchronized (obs) {
+            Iterator iter = obs.iterator();
+            while (iter.hasNext()) {
+                Object obj = iter.next();
+                if (obj instanceof Reference && ((Reference) obj).get() == null) {
+                    iter.remove();
+                }
+            }
+        }
+    }
+
+    private boolean contains(Observer observer) {
+        synchronized (obs) {
+            Iterator iter = obs.iterator();
+            while (iter.hasNext()) {
+                Object obj = iter.next();
+                if (obj instanceof Reference) {
+                    Object value = ((Reference) obj).get();
+                    if (observer.equals(value)) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    private void deleteObserverReferenced(Observer observer) {
+        if (observer == null) {
+            return;
+        }
+        synchronized (obs) {
+            Iterator iter = obs.iterator();
+            while (iter.hasNext()) {
+                Object obj = iter.next();
+                if (obj instanceof Reference) {
+                    Object value = ((Reference) obj).get();
+                    if (value == null || observer.equals(value)) {
+                        iter.remove();
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DelegateWeakReferencingObservable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DelegateWeakReferencingObservable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DelegateWeakReferencingObservable.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.tools.observer.impl;
+
+import org.gvsig.tools.observer.WeakReferencingObservable;
+
+/**
+ * Observer implementation which uses another Observable as the parameter for
+ * the notification to the registered Observers.
+ * 
+ * Most useful to be used as a delegate by Observable clases that can't extend
+ * the BaseObservable.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DelegateWeakReferencingObservable extends BaseWeakReferencingObservable {
+
+    private WeakReferencingObservable delegated;
+
+    /**
+     * Creates a new DelegateObservable with the Observable to be used to notify
+     * the Observers.
+     */
+    public DelegateWeakReferencingObservable(WeakReferencingObservable observable) {
+        delegated = observable;
+    }
+
+    protected void notify(WeakReferencingObservable observable, Object object) {
+        super.notify(delegated, object);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DefaultComplexNotification.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DefaultComplexNotification.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/impl/DefaultComplexNotification.java	(revision 1235)
@@ -0,0 +1,65 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.tools.observer.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.observer.ComplexNotification;
+import org.gvsig.tools.visitor.Visitor;
+
+public class DefaultComplexNotification implements Cloneable,
+    ComplexNotification {
+	private static Logger log = 
+	    LoggerFactory.getLogger(DefaultComplexNotification.class);
+	private List list = new ArrayList();
+
+	public synchronized void addNotification(Object arg) {
+		list.add(arg);
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		return super.clone();
+	}
+
+	public synchronized void accept(Visitor visitor) throws BaseException {
+		for (int i = 0; i < this.list.size(); i++) {
+			try {
+				Object notification = this.list.get(i);
+				visitor.visit(notification);
+			} catch (Throwable t) {
+				log.warn("Error sending notification.", t);
+			}
+		}
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/Observable.java	(revision 1235)
@@ -0,0 +1,32 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+public interface Observable {
+	public void addObserver(Observer o);
+
+	public void deleteObserver(Observer o);
+
+	public void deleteObservers();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ObservableHelper.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ObservableHelper.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ObservableHelper.java	(revision 1235)
@@ -0,0 +1,81 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObservableHelper {
+
+    private static final Logger logger = LoggerFactory.getLogger(ObservableHelper.class);
+
+    private List observers = new ArrayList();
+
+    public synchronized void addObserver(Observer o) {
+        if ( this.observers.contains(o) ) {
+            return;
+        }
+        this.observers.add(o);
+    }
+
+    public synchronized void deleteObserver(Observer o) {
+        this.observers.remove(o);
+    }
+
+    public synchronized void deleteObservers() {
+        this.observers = new ArrayList();
+    }
+
+    public synchronized void notifyObservers(Observable observable, Object data) {
+        for ( int i = 0; i < this.observers.size(); i++ ) {
+            Observer o = (Observer) this.observers.get(i);
+            try {
+                o.update(observable, data);
+            } catch (Exception ex) {
+                logger.warn("Error notifying to the observers.", ex);
+            }
+        }
+
+    }
+
+    public Notification notifyObservers(Observable observable, String type, Object value) {
+        Notification notification = new BaseNotification(type, new Object[]{value});
+        this.notifyObservers(observable, notification);
+        return notification;
+    }
+
+    public Notification notifyObservers(Observable observable, String type, Object value1, Object value2) {
+        Notification notification = new BaseNotification(type, new Object[]{value1, value2});
+        this.notifyObservers(observable, notification);
+        return notification;
+    }
+
+    public Notification notifyObservers(Observable observable, String type, Object value1, Object value2, Object value3) {
+        Notification notification = new BaseNotification(type, new Object[]{value1, value2, value3});
+        this.notifyObservers(observable, notification);
+        return notification;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/ObservableHelper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/WeakReferencingObservable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/WeakReferencingObservable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/observer/WeakReferencingObservable.java	(revision 1235)
@@ -0,0 +1,33 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.tools.observer;
+
+
+public interface WeakReferencingObservable extends Observable {
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ExceptionTranslator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ExceptionTranslator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ExceptionTranslator.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+/**
+ *
+ * @author Equipo de desarrollo de gvSIG
+ *
+ */
+public interface ExceptionTranslator {
+
+	/**
+	 *  @param key The key of the message error.
+	 *  @return The translated error message
+	 *  corresponding to the key that it
+	 *  obtains as parameter.
+	 */
+	public String getText(String key);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseException.java	(revision 1235)
@@ -0,0 +1,384 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 
+ * Esta clase esta pensada para actuar como clase base para las excepciones que
+ * se lanzan dentro del proyecto de gvSIG.
+ * 
+ * A�ade la implementacion necesaria para disponer de mensajes de error
+ * internacionalizables, a traves del metodo getLocalizedMessage, asi como una
+ * serie de metodos que nos permiten obtener los mesanes de error de la cadena
+ * de excepciones enlazadas a traves de su "causa", asi como utilidades que
+ * permitan recorrer de forma comoda esta cadena de excepciones por medio de un
+ * Iterador.
+ * 
+ * @author Equipo de desarrollo de gvSIG.
+ * 
+ */
+public abstract class BaseException extends Exception implements IBaseException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6631799898764636572L;
+	final static String BLANKS = "                                                                                                     ";
+	static ExceptionTranslator translator = null;
+
+	protected String messageKey;
+
+	/**
+	 * TODO: remove the variable, use the Exception get/setMessage() instead.
+	 */
+	protected String formatString;
+
+	/**
+	 * Unique code of error.
+	 */
+	protected long code;
+	private Map values;
+
+	/**
+	 * Empty constructor, don't use it anymore.
+	 * 
+	 * @deprecated
+	 */
+	public BaseException() {
+	}
+
+	/**
+	 * Constructs a BaseException with a default message format, a key to find a
+	 * localized message format, and a unique code to identify the exception.
+	 * 
+	 * @param message
+	 *            the default messageFormat to describe the exception
+	 * @param key
+	 *            the key to use to search a localized messageFormnata
+	 * @param code
+	 *            the unique code to identify the exception
+	 */
+	public BaseException(String message, String key, long code) {
+		super(message);
+		this.values = null;
+		this.formatString = message;
+		this.messageKey = key;
+		this.code = code;
+	}
+
+	/**
+	 * Constructs a BaseException with a default message format, a key to find a
+	 * localized message format, and a unique code to identify the exception.
+	 * 
+	 * @param message
+	 *            the default messageFormat to describe the exception
+	 * @param cause
+	 *            the original cause of the exception
+	 * @param key
+	 *            the key to use to search a localized messageFormnata
+	 * @param code
+	 *            the unique code to identify the exception
+	 */
+	public BaseException(String message, Throwable cause, String key, long code) {
+		super(message, cause);
+		this.formatString = message;
+		this.messageKey = key;
+		this.code = code;
+	}
+
+	/**
+	 * Returns the format string received in the parameter with its keys
+	 * replaced with the corresponding values of the map.
+	 * 
+	 * @param formatString
+	 * @param values
+	 *            map
+	 * @return string formatted
+	 */
+	private String format(String formatString, Map values) {
+		if (values != null) {
+
+			// If there is no message format, create a text with the values.
+			if (formatString == null) {
+				return "values = ".concat(values.toString());
+			} else {
+				// Replace the keys as variables with the values in the Map
+				Iterator keys = values.keySet().iterator();
+				String message = formatString;
+				while (keys.hasNext()) {
+					String key = (String) keys.next();
+					Object value = values.get(key);
+					message = replaceVariable(message, key, value == null ? ""
+							: value.toString());
+				}
+				return message;
+			}
+		}
+		// Return the original format message in any other case
+		return formatString;
+	}
+
+	/**
+	 * Method to replace message variables, not using the new String.replaceAll
+	 * method for Java ME CDC Compatibility.
+	 */
+	private String replaceVariable(String text, String varName,
+			String replacementString) {
+		String searchString = "%(".concat(varName).concat(")");
+		StringBuffer sBuffer = new StringBuffer();
+		int pos = 0;
+		while ((pos = text.indexOf(searchString)) != -1) {
+			sBuffer.append(text.substring(0, pos) + replacementString);
+			text = text.substring(pos + searchString.length());
+		}
+		sBuffer.append(text);
+		return sBuffer.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Throwable#getMessage()
+	 */
+	public String getMessage() {
+		return format(this.formatString, values());
+	}
+
+	public String getMessage(int indent) {
+		return insertBlanksAtStart(format(formatString, values()), indent);
+	}
+
+	public String getLocalizedMessage() {
+		return getLocalizedMessage(translator, 0);
+	}
+
+	public String getLocalizedMessage(ExceptionTranslator translator, int indent) {
+
+		String fmt;
+		if (translator == null) {
+			translator = BaseException.translator;
+		}
+		if (translator == null) {
+			fmt = getFormatString();
+		} else {
+			fmt = getMessageKey();
+			if (fmt == null) {
+				fmt = getFormatString();
+			} else {
+				String fmt2 = translator.getText(fmt);
+				if (fmt2 == null || fmt.equals(fmt2)) {
+					return getMessage(indent);
+				} else {
+					fmt = fmt2;
+				}
+			}
+		}
+		return insertBlanksAtStart(format(fmt, values()), indent);
+	}
+
+	public String getMessageStack() {
+		return getMessageStack(0);
+	}
+
+	public String getMessageStack(int indent) {
+		Iterator iter = this.iterator();
+		StringBuffer msgBuffer = new StringBuffer();
+		int i = 1;
+//		msgBuffer.append(this.getMessage(indent));
+		while (iter.hasNext()) {
+			Throwable ex = ((Throwable) iter.next());
+
+			if (msgBuffer.length() > 0) {
+				msgBuffer.append("\n");
+			}
+
+			if (ex instanceof IBaseException) {
+				IBaseException bex = (IBaseException) ex;
+				 msgBuffer.append(bex.getMessage(indent * i));
+			} else {
+				msgBuffer.append(insertBlanksAtStart(ex.getMessage(), indent
+						* i));
+			}
+
+			i++;
+		}
+		return msgBuffer.toString();
+	}
+
+	public String getLocalizedMessageStack() {
+		return getLocalizedMessageStack(BaseException.translator, 0);
+	}
+
+	public String getLocalizedMessageStack(ExceptionTranslator translator,
+			int indent) {
+		Iterator iter = this.iterator();
+		StringBuffer msgBuffer = new StringBuffer();
+		// msgBuffer.append(this.getLocalizedMessage());
+		Exception ex;
+		while (iter.hasNext()) {
+			ex = ((Exception) iter.next());
+			if (msgBuffer.length() > 0) {
+				msgBuffer.append("\n");
+			}
+
+			if (ex instanceof IBaseException) {
+				IBaseException bex = (IBaseException) ex;
+				msgBuffer.append(bex.getLocalizedMessage(translator, indent));
+			} else {
+				msgBuffer.append(ex.getLocalizedMessage() + " (" + ex.getClass().getName() + ")");
+			}
+		}
+		return msgBuffer.toString();
+	}
+
+	/**
+	 * Inserts blanks at the start of a string.
+	 * 
+	 * @param str
+	 *            A string.
+	 * @param len
+	 *            Quantity of blanks to insert at the start of str.
+	 * @return A string compund by the quantity of blanks that len indicates and
+	 *         str.
+	 */
+	static String insertBlanksAtStart(String str, int len) {
+		int blanksLen = len > BLANKS.length() ? BLANKS.length() : (len < 0 ? 0
+				: len);
+
+		return BLANKS.substring(0, blanksLen) + str;
+	}
+
+	public long getCode() {
+		return this.code;
+	}
+
+	/**
+	 * Sets the exception's code.
+	 */
+	public void setCode(long code) {
+		this.code = code;
+	}
+
+	public String getFormatString() {
+		return this.formatString;
+	}
+
+	/**
+	 * Sets the format string.
+	 * 
+	 * @param formatString
+	 */
+	public void setFormatString(String formatString) {
+		this.formatString = formatString;
+	}
+
+	public String getMessageKey() {
+		return this.messageKey;
+	}
+
+	/**
+	 * Sets the property messageKey.
+	 * 
+	 * @param messageKey
+	 */
+	public void setMessageKey(String messageKey) {
+		this.messageKey = messageKey;
+	}
+
+	public Iterator iterator() {
+		return new BaseExceptionIterator(this);
+	}
+
+	/**
+	 * @return A map that serves to replace in the format string the keys with
+	 *         the corresponding values.
+	 */
+	protected Map values() {
+		if (values == null) {
+			values = new HashMap();
+		}
+		return values;
+	}
+
+	protected void setValue(String name, Object value) {
+		if (values == null) {
+			values = new HashMap();
+		}
+		values.put(name, value);
+	}
+
+	/**
+	 * Sets the property translator.
+	 * 
+	 * @param translator
+	 *            It(He,She) is used to translate the messages associated with
+	 *            the exceptions.
+	 */
+	public static void setTranslator(ExceptionTranslator translator) {
+		BaseException.translator = translator;
+	}
+
+	public static void setTranslator(Object translator) {
+		BaseException.translator = new TranslatorWraper(translator);
+	}
+
+}
+
+class TranslatorWraper implements ExceptionTranslator {
+
+	private Object translator = null;
+	private Method method = null;
+
+	public TranslatorWraper(Object translator) {
+		Class theClass = translator.getClass();
+		String s = "";
+
+		this.translator = translator;
+		try {
+			method = theClass
+					.getMethod("getText", new Class[] { s.getClass() });
+		} catch (Exception e) {
+			throw new RuntimeException(
+					"El objeto translator suministrado no tiene el metodo getText apropiado.",
+					e);
+		}
+
+	}
+
+	public String getText(String key) {
+		try {
+			return (String) (method.invoke(translator, new String[] { key }));
+		} catch (Exception e) {
+			return key;
+		}
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseRuntimeException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseRuntimeException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseRuntimeException.java	(revision 1235)
@@ -0,0 +1,320 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 
+ * Esta clase esta pensada para actuar como clase base para las excepciones que
+ * se lanzan dentro del proyecto de gvSIG.
+ * 
+ * A�ade la implementacion necesaria para disponer de mensajes de error
+ * internacionalizables, a traves del metodo getLocalizedMessage, asi como una
+ * serie de metodos que nos permiten obtener los mesanes de error de la cadena
+ * de excepciones enlazadas a traves de su "causa", asi como utilidades que
+ * permitan recorrer de forma comoda esta cadena de excepciones por medio de un
+ * Iterador.
+ * 
+ * TODO: extract common code with the {@link BaseException} class to a common
+ * helper
+ * 
+ * @author Equipo de desarrollo de gvSIG.
+ * 
+ */
+public abstract class BaseRuntimeException extends RuntimeException implements IBaseException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2872163082105463370L;
+
+	protected String messageKey;
+
+	/**
+	 * TODO: remove the variable, use the Exception get/setMessage() instead.
+	 */
+	protected String formatString;
+
+	/**
+	 * Unique code of error.
+	 */
+	protected long code;
+	private Map values;
+
+    public BaseRuntimeException(BaseException exception) {
+    	super(exception);
+    }
+
+	/**
+	 * Constructs a BaseException with a default message format, a key to find a
+	 * localized message format, and a unique code to identify the exception.
+	 * 
+	 * @param message
+	 *            the default messageFormat to describe the exception
+	 * @param key
+	 *            the key to use to search a localized messageFormnata
+	 * @param code
+	 *            the unique code to identify the exception
+	 */
+	public BaseRuntimeException(String message, String key, long code) {
+		super(message);
+		this.values = null;
+		this.formatString = message;
+		this.messageKey = key;
+		this.code = code;
+	}
+
+	/**
+	 * Constructs a BaseException with a default message format, a key to find a
+	 * localized message format, and a unique code to identify the exception.
+	 * 
+	 * @param message
+	 *            the default messageFormat to describe the exception
+	 * @param cause
+	 *            the original cause of the exception
+	 * @param key
+	 *            the key to use to search a localized messageFormnata
+	 * @param code
+	 *            the unique code to identify the exception
+	 */
+	public BaseRuntimeException(String message, Throwable cause, String key, long code) {
+		super(message, cause);
+		this.formatString = message;
+		this.messageKey = key;
+		this.code = code;
+	}
+
+	/**
+	 * Returns the format string received in the parameter with its keys
+	 * replaced with the corresponding values of the map.
+	 * 
+	 * @param formatString
+	 * @param values
+	 *            map
+	 * @return string formatted
+	 */
+	private String format(String formatString, Map values) {
+		if (values != null) {
+
+			// If there is no message format, create a text with the values.
+			if (formatString == null) {
+				return "values = ".concat(values.toString());
+			} else {
+				// Replace the keys as variables with the values in the Map
+				Iterator keys = values.keySet().iterator();
+				String message = formatString;
+				while (keys.hasNext()) {
+					String key = (String) keys.next();
+					Object value = values.get(key);
+					message = replaceVariable(message, key, value == null ? ""
+							: value.toString());
+				}
+				return message;
+			}
+		}
+		// Return the original format message in any other case
+		return formatString;
+	}
+
+	/**
+	 * Method to replace message variables, not using the new String.replaceAll
+	 * method for Java ME CDC Compatibility.
+	 */
+	private String replaceVariable(String text, String varName,
+			String replacementString) {
+		String searchString = "%(".concat(varName).concat(")");
+		StringBuffer sBuffer = new StringBuffer();
+		int pos = 0;
+		while ((pos = text.indexOf(searchString)) != -1) {
+			sBuffer.append(text.substring(0, pos) + replacementString);
+			text = text.substring(pos + searchString.length());
+		}
+		sBuffer.append(text);
+		return sBuffer.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Throwable#getMessage()
+	 */
+	public String getMessage() {
+		return format(this.formatString, values());
+	}
+
+	public String getMessage(int indent) {
+		return BaseException.insertBlanksAtStart(
+				format(formatString, values()), indent);
+	}
+
+	public String getLocalizedMessage() {
+		return getLocalizedMessage(BaseException.translator, 0);
+	}
+
+	public String getLocalizedMessage(ExceptionTranslator translator, int indent) {
+
+		String fmt;
+		if (translator == null) {
+			translator = BaseException.translator;
+		}
+		if (translator == null) {
+			fmt = getFormatString();
+		} else {
+			fmt = getMessageKey();
+			if (fmt == null) {
+				fmt = getFormatString();
+			} else {
+				fmt = translator.getText(fmt);
+			}
+		}
+		return BaseException.insertBlanksAtStart(format(fmt, values()), indent);
+	}
+
+	public String getMessageStack() {
+		return getMessageStack(0);
+	}
+
+	public String getMessageStack(int indent) {
+		Iterator iter = this.iterator();
+		StringBuffer msgBuffer = new StringBuffer();
+		int i = 1;
+//		msgBuffer.append(this.getMessage(indent));
+		while (iter.hasNext()) {
+			Throwable ex = ((Throwable) iter.next());
+
+			if (msgBuffer.length() > 0) {
+				msgBuffer.append("\n");
+			}
+
+			if (ex instanceof IBaseException) {
+				IBaseException bex = (IBaseException) ex;
+				 msgBuffer.append(bex.getMessage(indent * i));
+			} else {
+				msgBuffer.append(BaseException.insertBlanksAtStart(
+						ex.getMessage(), indent
+						* i));
+			}
+
+			i++;
+		}
+		return msgBuffer.toString();
+	}
+
+	public String getLocalizedMessageStack() {
+		return getLocalizedMessageStack(BaseException.translator, 0);
+	}
+
+	public String getLocalizedMessageStack(ExceptionTranslator translator,
+			int indent) {
+		Iterator iter = this.iterator();
+		StringBuffer msgBuffer = new StringBuffer();
+		// msgBuffer.append(this.getLocalizedMessage());
+		Exception ex;
+		while (iter.hasNext()) {
+			ex = ((Exception) iter.next());
+			if (msgBuffer.length() > 0) {
+				msgBuffer.append("\n");
+			}
+
+			if (ex instanceof IBaseException) {
+				IBaseException bex = (IBaseException) ex;
+				msgBuffer.append(bex.getLocalizedMessage(translator, indent));
+			} else {
+				msgBuffer.append(ex.getLocalizedMessage());
+			}
+		}
+		return msgBuffer.toString();
+	}
+
+	public long getCode() {
+		return this.code;
+	}
+
+	/**
+	 * Sets the exception's code.
+	 */
+	public void setCode(long code) {
+		this.code = code;
+	}
+
+	public String getFormatString() {
+		return this.formatString;
+	}
+
+	/**
+	 * Sets the format string.
+	 * 
+	 * @param formatString
+	 */
+	public void setFormatString(String formatString) {
+		this.formatString = formatString;
+	}
+
+	public String getMessageKey() {
+		return this.messageKey;
+	}
+
+	/**
+	 * Sets the property messageKey.
+	 * 
+	 * @param messageKey
+	 */
+	public void setMessageKey(String messageKey) {
+		this.messageKey = messageKey;
+	}
+
+	public Iterator iterator() {
+		return new BaseExceptionIterator(this);
+	}
+
+	/**
+	 * @return A map that serves to replace in the format string the keys with
+	 *         the corresponding values.
+	 */
+	protected Map values() {
+		if (values == null) {
+			values = new HashMap();
+		}
+		return values;
+	}
+
+	protected void setValue(String name, Object value) {
+		if (values == null) {
+			values = new HashMap();
+		}
+		values.put(name, value);
+	}
+
+	public String toString() {
+		return format(this.formatString, values());
+	}
+
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/IBaseException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/IBaseException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/IBaseException.java	(revision 1235)
@@ -0,0 +1,145 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.Iterator;
+
+/**
+ *
+ *
+ * @author Equipo de desarrollo de gvSIG
+ *
+ */
+public interface IBaseException {
+
+	/**
+	 *  Returns the message that describes the exception.
+	 *
+	 *  @return The message.
+	 */
+	public String getMessage();
+
+	/**
+	 *  Returns the message that describes the exception, with indentation.
+	 *
+	 *  @param indent Quantity of blanks to insert
+	 *         at the start of the message.
+	 *  @return The message with indentation.
+	 */
+	public String getMessage(int indent);
+
+	/**
+	 *  Returns the translated message that describes the exception.
+	 *
+	 *  @return The translated message with indentation.
+	 */
+	public String getLocalizedMessage();
+
+	/**
+	 *  Returns the translated message that
+	 *  describes the exception with indentation.
+	 *
+	 *  @param translator Instance of a class that fulfills
+	 *         the IExceptionTranslator interface.
+	 *         His method "getText" takes charge returning
+	 *         the expression, correspondent to the key that
+	 *         delivers him, translated into the configured language.
+	 *  @param indent Quantity of blanks to insert
+	 *         at the start of the message.
+	 *  @return The translated message with indentation.
+	 */
+	public String getLocalizedMessage(ExceptionTranslator translator, int indent);
+
+	/**
+	 *  Crosses the exceptions chained through cause to conform
+	 *  the message.
+	 *
+	 *  @return The compound message with all the messages
+	 *          of the stack of exceptions.
+	 */
+	public String getMessageStack();
+
+	/**
+	 *  Crosses the exceptions chained through cause to conform
+	 *  the compound message with indentation.
+	 *
+	 *  @param indent Quantity of blanks to insert
+	 *         at the start of the messages.
+	 *  @return The compound message with all the messages
+	 *          of the stack of exceptions.
+
+	 */
+	public String getMessageStack(int indent);
+
+	/**
+	 *  Crosses the exceptions chained through cause
+	 *  to conform the compound message in the corresponding language.
+	 *
+	 *  @return The translated compound message.
+	 *
+	 */
+	public String getLocalizedMessageStack();
+
+	/**
+	 *  Crosses the exceptions chained through cause
+	 *  to conform the compound message in the corresponding language.
+	 *
+	 *  @param translator Instance of a class that fulfills
+	 *         the IExceptionTranslator interface.
+	 *         His method "getText" takes charge returning
+	 *         the expression, correspondent to the key that
+	 *         delivers him, translated into the configured language.
+	 *  @param indent Quantity of blanks to insert
+	 *         at the start of the messages.
+	 *  @return The translated message with indentation.
+	 *
+	 */
+	public String getLocalizedMessageStack(ExceptionTranslator translator,
+			int indent);
+
+
+	/**
+	 *  @return The exception's code.
+	 */
+	public long getCode();
+
+	/**
+	 *  @return The format string.
+	 */
+	public String getFormatString();
+
+	/**
+	 *  @return The message key associated to the exception.
+	 */
+	public String getMessageKey();
+
+	/**
+	 *  @return A iterator for the chained exceptions.
+	 */
+	public Iterator iterator();
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseExceptionIterator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseExceptionIterator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/BaseExceptionIterator.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.util.Iterator;
+
+class BaseExceptionIterator implements Iterator {
+	
+	Throwable exception;
+	
+	BaseExceptionIterator(BaseException exception){
+		this.exception = exception;
+	}
+	
+	BaseExceptionIterator(BaseRuntimeException exception){
+		this.exception = exception;
+	}
+	
+	/** 
+	 *  @return true if the iteration has more elements.
+	 */
+	public boolean hasNext() {
+		return this.exception != null;
+	}
+	
+	/** 
+	 *  @return The next element in the iteration.
+	 */
+	public Object next() {
+		Throwable exception = this.exception;
+		this.exception = exception.getCause();
+		return exception;
+	}
+	
+	/** 
+	 *  @throws "UnsupportedOperationException" because
+	 *  the remove operation will not be supported
+	 *  by this Iterator.
+	 */
+	public void remove() {
+		throw new UnsupportedOperationException();
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ListBaseException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ListBaseException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/ListBaseException.java	(revision 1235)
@@ -0,0 +1,286 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.exception;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.*;
+
+/**
+ * @author Equipo de desarrollo de gvSIG
+ *
+ */
+public abstract class ListBaseException extends BaseException implements List{
+	public ListBaseException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	public ListBaseException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3585958130775326741L;
+	private List exceptions = new ArrayList();
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#size()
+	 */
+	public int size() {
+		return this.exceptions.size();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#isEmpty()
+	 */
+	public boolean isEmpty() {
+		return this.exceptions.isEmpty();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#contains(java.lang.Object)
+	 */
+	public boolean contains(Object arg0) {
+		return this.exceptions.contains(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#toArray()
+	 */
+	public Object[] toArray() {
+		return this.exceptions.toArray();
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public Object[] toArray(Object[] arg0) {
+		return this.exceptions.toArray(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public boolean add(Object arg0) {
+		return this.exceptions.add(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#remove(java.lang.Object)
+	 */
+	public boolean remove(Object arg0) {
+		return this.exceptions.remove(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public boolean containsAll(Collection arg0) {
+		return this.exceptions.contains(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public boolean addAll(Collection arg0) {
+		return this.exceptions.addAll(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @param arg1
+	 * @return
+	 */
+	public boolean addAll(int arg0, Collection arg1) {
+		return this.exceptions.addAll(arg0, arg1);
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public boolean removeAll(Collection arg0) {
+		return this.exceptions.removeAll(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @return
+	 */
+	public boolean retainAll(Collection arg0) {
+		return this.exceptions.retainAll(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.Collection#clear()
+	 */
+	public void clear() {
+		this.exceptions.clear();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#get(int)
+	 */
+	public Object get(int arg0) {
+		return this.exceptions.get(arg0);
+	}
+
+	/**
+	 * @param arg0
+	 * @param arg1
+	 * @return
+	 */
+	public Object set(int arg0, Object arg1) {
+		return this.exceptions.set(arg0, arg1);
+	}
+
+	/**
+	 * @param arg0
+	 * @param arg1
+	 */
+	public void add(int arg0, Object arg1) {
+		this.exceptions.add(arg0, arg1);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#remove(int)
+	 */
+	public Object remove(int arg0) {
+		return this.exceptions.remove(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#indexOf(java.lang.Object)
+	 */
+	public int indexOf(Object arg0) {
+		return this.exceptions.indexOf(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#lastIndexOf(java.lang.Object)
+	 */
+	public int lastIndexOf(Object arg0) {
+		return this.exceptions.lastIndexOf(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#listIterator()
+	 */
+	public ListIterator listIterator() {
+		return this.exceptions.listIterator();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#listIterator(int)
+	 */
+	public ListIterator listIterator(int arg0) {
+		return this.exceptions.listIterator(arg0);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.util.List#subList(int, int)
+	 */
+	public List subList(int arg0, int arg1) {
+		return this.exceptions.subList(arg0, arg1);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Throwable#getMessage()
+	 */
+	public String getMessage() {
+		return getMessage(0);
+	}
+	
+	public String getMessage(int indent) {
+		String msg = super.getMessage();
+		Exception ex;
+		Iterator iter=this.exceptions.iterator();
+		while (iter.hasNext()) {
+			ex = (Exception) iter.next();
+			if( ex instanceof IBaseException ) {
+				IBaseException bex = (IBaseException) ex;
+				msg = msg + "\n  " + insertBlanksAtStart(bex.getMessage(indent+2), indent+2) ;
+			} else {
+				msg = msg + "\n  " + insertBlanksAtStart(ex.getMessage(), indent+2) ;
+			}
+		}
+		return msg;
+	}
+
+	public String getLocalizedMessage(ExceptionTranslator exceptionTranslator,
+			int indent) {
+		String msg = super.getLocalizedMessage(exceptionTranslator, indent);
+		Exception bex;
+		Iterator iter=this.exceptions.iterator();
+		while (iter.hasNext()) {
+			bex = (Exception) iter.next();
+			if( bex instanceof IBaseException ) {
+				msg = msg + "\n  " + ((IBaseException)bex).getLocalizedMessage(exceptionTranslator, indent);
+			} else {
+				msg = msg + "\n  " + bex.getLocalizedMessage();
+			}
+		}
+		return BaseException.insertBlanksAtStart(msg,indent);
+	}
+	
+	public void printStackTrace(PrintStream s) {
+        super.printStackTrace(s);
+        s.println("Contained exceptions: ");
+        int counter = 0;
+        Iterator iter = this.exceptions.iterator();
+        while (iter.hasNext()) {
+            counter++;
+            s.print("EXCEPTION " + counter + ": ");
+            Exception ex = (Exception) iter.next();
+            ex.printStackTrace(s);
+        }
+    }
+
+	public void printStackTrace() {
+		printStackTrace(System.err);
+	}
+	
+    public void printStackTrace(PrintWriter s) {
+        super.printStackTrace(s);
+        s.println("Contained exceptions: ");
+        int counter = 0;
+        Iterator iter = this.exceptions.iterator();
+        while (iter.hasNext()) {
+            counter++;
+            s.print("EXCEPTION " + counter + ": ");
+            Exception ex = (Exception) iter.next();
+            ex.printStackTrace(s);
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/NotYetImplemented.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/NotYetImplemented.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/exception/NotYetImplemented.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.exception;
+
+
+public class NotYetImplemented extends BaseRuntimeException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4448165879403648365L;
+	private final static String MESSAGE_FORMAT = "Operation %(operation)s not yet implemented.";
+	private final static String MESSAGE_KEY = "_NotYetImplemented";
+
+	public NotYetImplemented() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("operation","");
+	}
+
+	public NotYetImplemented(String operation) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("operation", "'".concat(operation).concat("'") );
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypesManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypesManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypesManager.java	(revision 1235)
@@ -0,0 +1,87 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes;
+
+import java.util.Iterator;
+import java.util.Locale;
+
+/**
+ * Manages data types.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public interface DataTypesManager {
+
+    public interface Coercion {
+
+        public Object coerce(Object value) throws CoercionException;
+    }
+
+    public interface CoercionWithLocale extends Coercion {
+
+        public Object coerce(Object value, Locale locale) throws CoercionException;
+    }
+    
+    public DataType get(int type);
+
+    public boolean isValidType(int type);
+
+    public boolean isObject(int type);
+
+    public boolean isContainer(int type);
+
+    public String getTypeName(int type);
+
+    public int getType(String name);
+
+    public Class getDefaultClass(int type);
+
+    /**
+     * Returns a DataType whose default class is the one provided.
+     * As there may be more than one {@link DataType} objects with the same
+     * default class, it will return only one of them.
+     * 
+     * @param defaultClass
+     *            the default class of the data type asked
+     * @return the DataType whose default class is the one provided.
+     */
+    public DataType getDataType(Class defaultClass);
+
+    public String getSubtype(int type);
+
+    public int addtype(int type, String subtype, String name,
+        Class defaultClass, Coercion coercion);
+
+    public Coercion getCoercion(int type);
+
+    public void setCoercion(int type, Coercion coercion);
+
+    public void addCoercion(int type, Coercion coercion);
+
+    public Object coerce(int type, Object value) throws CoercionException;
+
+    public Iterator iterator();
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypesManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataType.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataType.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataType.java	(revision 1235)
@@ -0,0 +1,54 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes;
+
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+public interface DataType {
+
+	public boolean isObject() ;
+	
+	public boolean isDynObject();
+
+	public boolean isContainer() ;
+	
+	public boolean isNumeric();
+	
+	public String getName() ;
+	
+	public int getType() ;
+
+	public Class getDefaultClass() ;
+
+	public String getSubtype() ;
+
+	public Coercion getCoercion() ;
+	
+	public void setCoercion(Coercion coercion) ;
+	
+	public void addCoercion(Coercion coercion) ;
+	
+	public Object coerce(Object value) throws CoercionException;
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypes.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypes.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypes.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes;
+
+
+/**
+ * This interface defines a set of constants for 
+ * basic data types supported by gvSIG.
+ */
+public interface DataTypes {
+	
+	public static final int INVALID = 0x00;
+	
+	public static final int UNKNOWN = 0x00;
+	public static final int BOOLEAN = 0x01;
+	public static final int BYTE = 0x02;
+	public static final int CHAR = 0x03;
+	public static final int INT = 0x04;
+	public static final int LONG = 0x05;
+	public static final int FLOAT = 0x06;
+	public static final int DOUBLE = 0x07;
+	public static final int STRING = 0x08;
+	public static final int DATE = 0x09;
+	public static final int TIME = 0x0A;
+	public static final int TIMESTAMP = 0x0B;
+	public static final int BYTEARRAY = 0x0C;
+	public static final int FILE = 0x0D;
+	public static final int FOLDER = 0x0E;
+	public static final int DYNOBJECT = 0x0F;
+	public static final int URL = 0x10;
+	public static final int URI = 0x11;
+	public static final int VERSION = 0x12;
+
+	
+	public static final int CONTAINER = 0x20;
+	public static final int ARRAY = 0x21;
+	public static final int LIST = 0x22;
+	public static final int SET = 0x23;
+	public static final int MAP = 0x24;
+
+	public static final int OBJECT = 0x40;
+
+	public static final int MAX_TYPE_VALUE = 0x70;
+	
+	public static final String SUBTYPE_FILE = "File";
+	public static final String SUBTYPE_FOLDER = "Folder";
+	public static final String SUBTYPE_DATE = "Date";
+	public static final String SUBTYPE_TEXT = "Text";
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/CoercionException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/CoercionException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/CoercionException.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes;
+
+public class CoercionException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4367810513187193469L;
+	
+	public CoercionException() {
+		super();
+	}
+	
+	public CoercionException(String msg) {
+		super(msg);
+	}
+	
+	public CoercionException(Throwable cause) {
+		super(cause);
+	}
+	
+	public CoercionException(String msg, Throwable cause) {
+		super(msg, cause);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/CoercionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataTypesManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataTypesManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataTypesManager.java	(revision 1235)
@@ -0,0 +1,250 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.gvsig.installer.lib.api.Version;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToBoolean;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToByte;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDate;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToDouble;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToFile;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToFloat;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToInt;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToLong;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToObject;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToString;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToTime;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToTimestamp;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToURI;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToURL;
+import org.gvsig.tools.dataTypes.impl.coercion.CoerceToVersion;
+import org.gvsig.tools.dynobject.DynObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultDataTypesManager implements DataTypesManager, DataTypes {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultDataTypesManager.class);
+
+    private static final int NEWINDEXES_AT = OBJECT + 1;
+
+    private DataType[] types = new DefaultDataType[MAX_TYPE_VALUE];
+
+    public DefaultDataTypesManager() {
+
+        this.addtype(BOOLEAN, null, "Boolean", Boolean.class,
+            new CoerceToBoolean());
+        this.addtype(BYTE, null, "Byte", Byte.class, new CoerceToByte());
+        this.addtype(CHAR, null, "Char", Character.class, new CoerceToString());
+        this.addtype(INT, null, "Integer", Integer.class, new CoerceToInt());
+        this.addtype(LONG, null, "Long", Long.class, new CoerceToLong());
+        this.addtype(FLOAT, null, "Float", Float.class, new CoerceToFloat());
+        this.addtype(DOUBLE, null, "Double", Double.class, new CoerceToDouble());
+        this.addtype(STRING, null, "String", String.class, new CoerceToString());
+        this.addtype(DATE, SUBTYPE_DATE, "Date", Date.class, new CoerceToDate());
+        this.addtype(TIME, SUBTYPE_DATE, "Time", Date.class, new CoerceToTime());
+        this.addtype(TIMESTAMP, null, "Timestamp", Timestamp.class, new CoerceToTimestamp());
+        this.addtype(VERSION, null, "Version", Version.class, new CoerceToVersion());
+
+        this.addtype(BYTEARRAY, null, "ByteArray", null, null);
+        this.addtype(FILE, SUBTYPE_FILE, "File", File.class, new CoerceToFile());
+        this.addtype(FOLDER, SUBTYPE_FOLDER, "Folder", File.class,
+            new CoerceToFile());
+        this.addtype(DYNOBJECT, null, "DynObject", DynObject.class, null);
+        this.addtype(URL, null, "URL", URL.class, new CoerceToURL());
+        this.addtype(URI, null, "URI", URI.class, new CoerceToURI());
+
+        this.addtype(ARRAY, null, "Array", null, null);
+        this.addtype(LIST, null, "List", List.class, null);
+        this.addtype(SET, null, "Set", Set.class, null);
+        this.addtype(MAP, null, "Map", Map.class, null);
+
+        this.addtype(OBJECT, null, "Object", Object.class, new CoerceToObject());
+    }
+
+    public synchronized int addtype(int type, String subtype, String name,
+        Class defaultClass, Coercion coercion) {
+        if (type == INVALID) {
+            type = getNewObjectIndexType();
+        }
+        if (type < 1 || type > MAX_TYPE_VALUE) {
+            throw new IllegalArgumentException("Wrong type "
+                + Integer.toHexString(type).toUpperCase() + ".");
+        }
+
+        try {
+            // Check if the type has been already registereds
+            get(type);
+            throw new IllegalArgumentException("type "
+                + Integer.toHexString(type).toUpperCase() + ", name " + name
+                + ", already registered as " + getTypeName(type) + ".");
+        } catch (IllegalArgumentException e) {
+            // OK, the type is still not registered.
+        }
+
+        DataType dataType =
+            new DefaultDataType(type, subtype, name, defaultClass, coercion);
+        types[type] = dataType;
+        LOG.info("Registered data type {}.", dataType.toString());
+        return type;
+    }
+
+    private int getNewObjectIndexType() {
+        for (int i = NEWINDEXES_AT; i <= MAX_TYPE_VALUE; i++) {
+            if (types[i] == null) {
+                return i;
+            }
+        }
+        return DataTypes.INVALID;
+    }
+
+    public DataType get(int type) {
+        DataType dataType = null;
+        if (type > 0 && type <= MAX_TYPE_VALUE) {
+            dataType = types[type];
+        }
+
+        if (dataType == null) {
+            throw new IllegalArgumentException("DataType " + type
+                + " not registered");
+        }
+
+        return dataType;
+    }
+
+    public boolean isValidType(int type) {
+        return type > 0 && type <= MAX_TYPE_VALUE && this.types[type] != null;
+    }
+
+    public boolean isObject(int type) {
+        return (type & DataTypes.OBJECT) == DataTypes.OBJECT;
+    }
+
+    public boolean isContainer(int type) {
+        return (type & DataTypes.CONTAINER) == DataTypes.CONTAINER;
+    }
+
+    public int getType(String name) {
+        if (name != null) {
+            for (int i = 0; i < types.length; i++) {
+                if (types[i] != null
+                    && name.equalsIgnoreCase(types[i].getName())) {
+                    return i;
+                }
+            }
+        }
+        return DataTypes.INVALID;
+    }
+
+    public String getTypeName(int type) {
+        DataType dataType = get(type);
+        String name = dataType.getName();
+        if (name == null) {
+            return "unknow";
+        }
+        return name;
+    }
+
+    public Class getDefaultClass(int type) {
+        DataType dataType = get(type);
+        return dataType.getDefaultClass();
+    }
+
+    public String getSubtype(int type) {
+        DataType dataType = get(type);
+        return dataType.getSubtype();
+    }
+
+    public Coercion getCoercion(int type) {
+        DataType dataType = get(type);
+        return dataType.getCoercion();
+    }
+
+    public void setCoercion(int type, Coercion coercion) {
+        DataType dataType = get(type);
+        dataType.setCoercion(coercion);
+    }
+
+    public void addCoercion(int type, Coercion coercion) {
+        DataType dataType = get(type);
+        dataType.addCoercion(coercion);
+    }
+
+    public Object coerce(int type, Object value) throws CoercionException {
+        DataType dataType = get(type);
+        return dataType.coerce(value);
+    }
+
+    public Iterator iterator() {
+        List list = new ArrayList();
+        DataType type = null;
+        for (int i = 0; i < this.types.length; i++) {
+            type = this.types[i];
+            if (type != null)
+                list.add(this.types[i]);
+        }
+        return list.iterator();
+    }
+
+    public DataType getDataType(Class defaultClass) {
+        // First look for a class with exact match
+        for (int i = 0; i < types.length; i++) {
+            if (types[i] != null) {
+                Class typeClass = types[i].getDefaultClass();
+                if (typeClass != null && typeClass.equals(defaultClass)) {
+                    return types[i];
+                }
+            }
+        }
+        // Then look for a class which is an interface or parent
+        for (int i = 0; i < types.length; i++) {
+            if (types[i] != null) {
+                Class typeClass = types[i].getDefaultClass();
+                if (typeClass != null
+                    && typeClass.isAssignableFrom(defaultClass)) {
+                    return types[i];
+                }
+            }
+        }
+        throw new IllegalArgumentException(
+            "There is not any registered data type with the class or a "
+                + "parent of the class: " + defaultClass);
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataTypesManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataType.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataType.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataType.java	(revision 1235)
@@ -0,0 +1,215 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl;
+
+import java.text.MessageFormat;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultDataType implements DataType {
+
+	private static final Logger LOG = LoggerFactory.getLogger(DefaultDataTypesManager.class);
+	
+	private Coercion coercion;
+	private Class defaultClass;
+	private String subtype;
+	private int type;
+	private String name;
+	
+	DefaultDataType(int type, String subtype, String name, Class defaultClass, Coercion coercion) {
+
+		if( name == null ) {
+			LOG.trace("Can't register null type name for type {}.", new Object[] { Integer.toHexString(type).toUpperCase()});
+			throw new IllegalArgumentException();
+		}
+		this.type = type;
+		this.subtype = subtype;
+		this.name = name;
+		this.defaultClass  = defaultClass;
+		this.coercion = coercion;
+	}
+	
+	public Object coerce(Object value) throws CoercionException {
+		// http://en.wikipedia.org/wiki/Type_conversion#Implicit_type_conversion
+
+		if( this.coercion != null ) {
+			return this.coercion.coerce(value);
+		}
+		if( defaultClass == null ) {
+			return value; // �?
+		}
+		if( defaultClass.isInstance(value) ) {
+			return value;
+		}
+		throw new CoercionException();
+	}
+
+	public Coercion getCoercion() {
+		return this.coercion;
+	}
+
+	public Class getDefaultClass() {
+		return this.defaultClass;
+	}
+
+	public String getSubtype() {
+		return this.subtype;
+	}
+
+	public int getType() {
+		return this.type;
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	public boolean isContainer() {
+		return (type & DataTypes.CONTAINER) == DataTypes.CONTAINER;
+	}
+
+	public boolean isObject() {
+		return (type & DataTypes.OBJECT) == DataTypes.OBJECT;
+	}
+
+	public boolean isDynObject() {
+		return type == DataTypes.DYNOBJECT;
+	}
+
+	public void setCoercion(Coercion coercion) {
+		this.coercion = coercion;
+		LOG.trace("Add coercion operation for data type {}.", new Object[] { name });
+	}
+
+	public void addCoercion(Coercion coercion) {
+		LinkedCoercions coercions = null;
+		if (this.coercion instanceof LinkedCoercions) {
+			coercions = (LinkedCoercions) this.coercion;
+		} else {
+			coercions = new LinkedCoercions();
+			coercions.add(this.coercion);
+			this.coercion = coercions;
+		}
+		coercions.add(coercion);
+		LOG.trace("Add coercion operation for data type {}.", new Object[] { name });
+	}
+
+	public String toString() {
+		return MessageFormat.format(
+				"type=0x{0};subtype={1};name={2};class={3};coercion={4}", 
+				new Object[] {
+					Integer.toHexString(type).toUpperCase(),
+					subtype,
+					name,
+					defaultClass==null? null:defaultClass.getName(),
+					coercion==null? null:coercion.getClass().getName()
+				}
+		);
+	}
+
+	public boolean isNumeric() {
+		if( type == DataTypes.DOUBLE ||
+			type == DataTypes.FLOAT ||
+		    type == DataTypes.INT ||
+			type == DataTypes.LONG){
+			return true;
+		}
+		return false;
+	}
+
+	public class LinkedCoercions implements Coercion {
+		
+		public class LinkedCoercion {
+			Coercion coercion;
+			LinkedCoercion theNext;
+			
+			LinkedCoercion(Coercion coercion, LinkedCoercion next) {
+				this.theNext = next; 
+				this.coercion = coercion;
+			}
+			
+			public Object coerce(Object value) throws CoercionException {
+				return this.coercion.coerce(value);
+			}
+			
+			public boolean is(Coercion coercion) {
+				return coercion.getClass().getName().equals(this.coercion.getClass().getName());
+			}
+			
+			public boolean hasNext() {
+				return this.theNext != null;
+			}
+			
+			public LinkedCoercion next() {
+				return this.theNext;
+			}
+		}
+		
+		LinkedCoercion head = null;
+		
+		public LinkedCoercions() {
+			super();
+		}
+		
+		public void add(Coercion coercion) {
+			if( !this.contains(coercion)) {
+				head = new LinkedCoercion(coercion, head);
+			}
+		}
+
+		public boolean contains(Coercion coercion) {
+			LinkedCoercion x = head;
+			while( x!=null ) {
+				if( x.is(coercion)) {
+					return true;
+				}
+				x = x.next();
+			}
+			return false;
+		}
+		
+		public Object coerce(Object value) throws CoercionException {
+			LinkedCoercion x = head;
+			while( x!=null ) {
+				try {
+					return x.coerce(value);
+				} catch (CoercionException e) {
+					x = x.next();
+					if( x==null ) {
+						throw e;
+					}
+				}
+			}
+			throw new CoercionException();
+		}
+
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDateTime.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDateTime.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDateTime.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Coerces a value to a {@link Date}. If the value is not a {@link Date}, it
+ * will use the {@link Object#toString()} method to convert the
+ * resulting {@link String} to a Date object using the current locale default
+ * formatter for DateTime through the
+ * {@link DateFormat#getDateTimeInstance(int)} method
+ * and the {@link DateFormat#SHORT} style for the date and the
+ * {@link DateFormat#MEDIUM} style for the hour.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToDateTime extends AbstractCoerceToDate {
+
+    protected DateFormat createFormatter(Locale locale) {
+        return DateFormat.getDateTimeInstance(DateFormat.SHORT,
+            DateFormat.MEDIUM, locale);
+    }
+
+    protected String getDateType() {
+        return "DateTime or Timestamp";
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTime.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTime.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTime.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Coerces a value to a {@link Date}. If the value is not a {@link Date}, it
+ * will use the {@link Object#toString()} method to convert the
+ * resulting {@link String} to a Date object using the current locale default
+ * formatter for Time through the {@link DateFormat#getTimeInstance(int)} method
+ * and the {@link DateFormat#MEDIUM} style.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToTime extends AbstractCoerceToDate {
+
+    protected DateFormat createFormatter(Locale locale) {
+        return DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
+    }
+
+    protected String getDateType() {
+        return "Time";
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+public class CoerceToLong implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if( ! (value instanceof Long) ) {
+				if( value instanceof Number ) {
+					value = new Long(((Number)value).longValue());
+				} else {
+					String s = value.toString();
+                                        if( s == null ) {
+                                            return null;
+                                        }
+                                        s = s.trim().toLowerCase();
+                                        if( s.length()==0 ) {
+                                            return null;
+                                        }
+					if( s.startsWith("0x")) {
+						value = Long.valueOf(s.substring(2), 16);
+					} else {
+					    value = Long.valueOf(s);
+					}
+				}
+			}
+			return value;
+		} catch(Exception e) {
+			throw new CoercionException(e); 
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURI.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURI.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURI.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+
+public class CoerceToURI implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		if( ! (value instanceof URI) ) {
+			if( value instanceof String ) {
+				try {
+					value = new URI((String) value);
+				} catch (URISyntaxException e) {
+					throw new CoercionException(e);
+				}
+			} else {
+                                String s = value.toString();
+                                if( s == null ) {
+                                    return null;
+                                }
+                                s = s.trim().toLowerCase();
+                                if( s.length()==0 ) {
+                                    return null;
+                                }
+				throw new CoercionException();
+			}
+		}
+		return value;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURI.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/AbstractCoerceToDate.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/AbstractCoerceToDate.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/AbstractCoerceToDate.java	(revision 1235)
@@ -0,0 +1,105 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.CoercionWithLocale;
+
+/**
+ * Abstract implementation for Date coercion classes. If the value is not a
+ * {@link Date}, it will use the {@link Object#toString()} method to convert the
+ * resulting {@link String} to a Date object.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public abstract class AbstractCoerceToDate implements CoercionWithLocale {
+
+    public Object coerce(Object value) throws CoercionException {
+        return coerce(value, Locale.getDefault());
+    }
+
+    public Object coerce(Object value, Locale locale) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+        if (!(value instanceof Date)) {
+            DateFormat dateFormatter = createFormatter(locale);
+            String valueStr = value.toString();
+            if( valueStr == null ) {
+                return null;
+            }
+            valueStr = valueStr.trim();
+            if( valueStr.length()==0 ) {
+                return null;
+            }
+            
+            try {
+                Date d = dateFormatter.parse(valueStr);
+                if (d == null) {
+                    throwCoercionException(dateFormatter, valueStr, null);
+                }
+                return d;
+            } catch (ParseException e) {
+                throwCoercionException(dateFormatter, valueStr, e);
+            }
+        }
+        return value;
+    }
+
+    private void throwCoercionException(DateFormat format, String valueStr,
+        ParseException e) throws CoercionException {
+        String formatDesc =
+            format instanceof SimpleDateFormat ? ((SimpleDateFormat) format)
+                .toLocalizedPattern() : format.toString();
+        throw new CoercionException("The value to coerce (\"" + valueStr
+            + "\") has an invalid " + getDateType()
+            + " String format. The expected one is: " + formatDesc, e);
+    }
+
+    /**
+     * Returns the {@link DateFormat} to apply when the value to coerce is not
+     * of Date type and it will be parsed as String.
+     * 
+     * @return the {@link DateFormat} to apply to parse the value to coerce as
+     *         {@link String}
+     */
+    protected abstract DateFormat createFormatter(Locale locale);
+
+    /**
+     * Returns the name of the Date type being coerced. Ex: Date, DateTime,
+     * Time. Only used for description when an error is produced when coercing
+     * the value.
+     * 
+     * @return the name of the Date type being coerced
+     */
+    protected abstract String getDateType();
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURL.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURL.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURL.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+
+public class CoerceToURL implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		if( ! (value instanceof URL) ) {
+			if( value instanceof String ) {
+				try {
+					value = new URL((String) value);
+				} catch (MalformedURLException e) {
+					throw new CoercionException(e);
+				}
+			} else {
+                                String s = value.toString();
+                                if( s == null ) {
+                                    return null;
+                                }
+                                s = s.trim().toLowerCase();
+                                if( s.length()==0 ) {
+                                    return null;
+                                }
+				throw new CoercionException();
+			}
+		}
+		return value;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToURL.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+public class CoerceToByte implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+
+		try {
+			if( ! (value instanceof Byte) ) {
+				if( value instanceof Number ) {
+                    value = new Byte(((Number) value).byteValue());
+				} else {
+					String s = value.toString();
+                                        if( s == null ) {
+                                            return null;
+                                        }
+                                        s = s.trim().toLowerCase();
+                                        if( s.length()==0 ) {
+                                            return null;
+                                        }
+					if( s.startsWith("0x")) {
+						value = Byte.valueOf(s.substring(2), 16);
+					} else {
+					    value = Byte.valueOf(value.toString());
+					}
+				}
+			}
+			return value;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTimestamp.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTimestamp.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToTimestamp.java	(revision 1235)
@@ -0,0 +1,87 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.sql.Timestamp;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+
+/**
+ * Utility class to force instantiation of Timestamp objects.
+ * If a plugin provides a datasource with a timestamp type which
+ * is not java.sql.Timestamp, then the plugin will have
+ * to perform a conversion or coercion between
+ * its Timestamp type and java.sql.Timestamp if it's not automatic.
+ * 
+ * Postgresql JDBC uses java.sql.Timestamp, so no problem
+ * 
+ * Oracle uses oracle.sql.TIMESTAMP which is automatically
+ * converted, so this coercion is enough
+ * 
+ * @author jldominguez
+ *
+ */
+public class CoerceToTimestamp extends CoerceToTime {
+
+    public static final String NOW_STRING = "now";
+    
+    public Object coerce(Object value) throws CoercionException {
+        if (value instanceof Timestamp) {
+            return value;
+        } else {
+            String str = value.toString();
+            if( str == null ) {
+                return null;
+            }
+            str = str.trim().toLowerCase();
+            if( str.length()==0 ) {
+                return null;
+            }
+            // ----------- (1) Try normal parsing
+            try {
+                return Timestamp.valueOf(str); 
+            } catch (Exception ex) {
+                // Pass exception
+            }
+            // ----------- (2) Try parsing milliseconds
+            try {
+                long ms = Long.parseLong(str);
+                return new Timestamp(ms); 
+            } catch (Exception ex) {
+                // Pass exception
+            }
+            // ----------- (3) Accept "now"
+            if (NOW_STRING.equalsIgnoreCase(str) ) {                
+                return new Timestamp(System.currentTimeMillis());
+            }
+            /*
+             * Finally try as time
+             */
+            return super.coerce(value);
+        }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java	(revision 1235)
@@ -0,0 +1,96 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.CoercionWithLocale;
+
+public class CoerceToFloat implements CoercionWithLocale {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if (!(value instanceof Float)) {
+				if (value instanceof Number) {
+                    value = new Float(((Number) value).floatValue());
+				} else {
+					String s = value.toString();
+                                        if( s == null ) {
+                                            return null;
+                                        }
+                                        s = s.trim().toLowerCase();
+                                        if( s.length()==0 ) {
+                                            return null;
+                                        }
+					if( s.startsWith("0x")) {
+						value = new Float(Long.parseLong(s.substring(2), 16));
+					} else {
+					    value = Float.valueOf(s);
+					}
+				}
+			}
+			return value;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+	}
+
+	public Object coerce(Object value, Locale locale) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if (!(value instanceof Double)) {
+				if (value instanceof Number) {
+					value = new Double(((Number) value).doubleValue());
+				} else {
+					String s = value.toString().trim().toLowerCase();
+					if( s.startsWith("0x")) {
+						value = new Double(Long.parseLong(s.substring(2), 16));
+					} else {
+						ParsePosition p = new ParsePosition(0);
+						NumberFormat nf = NumberFormat.getInstance(locale);
+						Number num = nf.parse(s,p);
+						if( p.getErrorIndex()>0 || p.getIndex()<s.length() ) {
+							throw new CoercionException("can't coerce to float with locale "+locale.getLanguage());
+						}
+						value = new Float(num.floatValue());
+					}
+				}
+			}
+			return value;
+		} catch (CoercionException e) {
+			throw e;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToObject.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToObject.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToObject.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.CoercionWithLocale;
+
+public class CoerceToObject implements CoercionWithLocale {
+
+    public Object coerce(Object value) throws CoercionException {
+        return value;
+    }
+
+    public Object coerce(Object value, Locale locale) throws CoercionException {
+        return value;
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToObject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToString.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToString.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToString.java	(revision 1235)
@@ -0,0 +1,69 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+import org.gvsig.tools.dataTypes.DataTypesManager.CoercionWithLocale;
+
+public class CoerceToString implements CoercionWithLocale {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if( !(value instanceof String )) {
+				value = value.toString();
+			}
+			return value;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+
+	}
+
+	public Object coerce(Object value, Locale locale) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if( !(value instanceof String )) {
+				if( value instanceof Float || value instanceof Double ) {
+					NumberFormat nf = NumberFormat.getInstance(locale);
+					value = nf.format(((Number)value).doubleValue());
+				} else {
+					value = value.toString();
+				}
+			}
+			return value;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToString.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java	(revision 1235)
@@ -0,0 +1,95 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.CoercionWithLocale;
+
+public class CoerceToDouble implements CoercionWithLocale {
+
+    public Object coerce(Object value) throws CoercionException {
+        if (value == null) {
+            return null;
+        }
+        try {
+            if (!(value instanceof Double)) {
+                if (value instanceof Number) {
+                    value = new Double(((Number) value).doubleValue());
+                } else {
+                    String s = value.toString();
+                    if (s == null) {
+                        return null;
+                    }
+                    s = s.trim().toLowerCase();
+                    if (s.length() == 0) {
+                        return null;
+                    }
+                    if (s.startsWith("0x")) {
+                        value = new Double(Long.parseLong(s.substring(2), 16));
+                    } else {
+                        value = Double.valueOf(s);
+                    }
+                }
+            }
+            return value;
+        } catch (Exception e) {
+            throw new CoercionException(e);
+        }
+    }
+
+    public Object coerce(Object value, Locale locale) throws CoercionException {
+        if (value == null) {
+            return null;
+        }
+        try {
+            if (!(value instanceof Double)) {
+                if (value instanceof Number) {
+                    value = new Double(((Number) value).doubleValue());
+                } else {
+                    String s = value.toString().trim().toLowerCase();
+                    if (s.startsWith("0x")) {
+                        value = new Double(Long.parseLong(s.substring(2), 16));
+                    } else {
+                        ParsePosition p = new ParsePosition(0);
+                        NumberFormat nf = NumberFormat.getInstance(locale);
+                        Number num = nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("can't coerce to double with locale " + locale.getLanguage());
+                        }
+                        value = new Double(num.doubleValue());
+                    }
+                }
+            }
+            return value;
+        } catch (CoercionException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new CoercionException(e);
+        }
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDate.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDate.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDate.java	(revision 1235)
@@ -0,0 +1,50 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Coerces a value to a {@link Date}. If the value is not a {@link Date}, it
+ * will use the {@link Object#toString()} method to convert the
+ * resulting {@link String} to a Date object using the current locale default
+ * formatter for Date through the {@link DateFormat#getDateInstance(int)} method
+ * and the {@link DateFormat#SHORT} style.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class CoerceToDate extends AbstractCoerceToDate {
+
+    protected DateFormat createFormatter(Locale locale) {
+        return DateFormat.getDateInstance(DateFormat.SHORT, locale);
+    }
+
+    protected String getDateType() {
+        return "Date";
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFile.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFile.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFile.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import java.io.File;
+import java.net.URI;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+
+public class CoerceToFile implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+		if( value==null ) {
+			return null;
+		}
+		if( ! (value instanceof File) ) {
+			if( value instanceof String ) {
+				value = new File((String) value);
+			} else if( value instanceof URI ) {
+				value = new File((URI) value);
+			} else {
+                                String s = value.toString();
+                                if( s == null ) {
+                                    return null;
+                                }
+                                s = s.trim().toLowerCase();
+                                if( s.length()==0 ) {
+                                    return null;
+                                }
+				throw new CoercionException();
+			}
+		}
+		return value;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFile.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToBoolean.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToBoolean.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToBoolean.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+public class CoerceToBoolean implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+
+		try {
+			if (!(value instanceof Boolean)) {
+				if (value instanceof Number) {
+					if (((Number) value).intValue() == 1) {
+						value = Boolean.TRUE;
+					} else {
+						value = Boolean.FALSE;
+					}
+				} else {
+					String s = value.toString();
+                                        if( s == null ) {
+                                            return null;
+                                        }
+                                        s = s.trim().toLowerCase();
+                                        if( s.length()==0 ) {
+                                            return null;
+                                        }
+					value = Boolean.valueOf(s);
+				}
+			}
+			return value;
+		} catch (Exception e) {
+			throw new CoercionException(e);
+		}
+
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToBoolean.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToVersion.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToVersion.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToVersion.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import org.gvsig.installer.lib.api.Version;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+import org.gvsig.tools.packageutils.PackageManager;
+
+public class CoerceToVersion implements Coercion {
+
+    public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+        if (!(value instanceof Version)) {
+            try {
+	            PackageManager manager = ToolsLocator.getPackageManager();
+	            Version version = manager.createVersion();
+                    String s = value.toString();
+                    if( s == null ) {
+                        return null;
+                    }
+                    s = s.trim().toLowerCase();
+                    if( s.length()==0 ) {
+                        return null;
+                    }
+                    version.parse(s);
+                    value = version;
+            } catch(Exception ex) {
+            	throw new CoercionException(ex.getMessage(),ex);
+            }
+        }
+        return value;
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToVersion.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.dataTypes.impl.coercion;
+
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
+
+public class CoerceToInt implements Coercion {
+
+	public Object coerce(Object value) throws CoercionException {
+    	if( value == null ) {
+    		return null;
+    	}
+		try {
+			if( ! (value instanceof Integer) ) {
+				if( value instanceof Number ) {
+                    value = new Integer(((Number) value).intValue());
+				} else {
+					String s = value.toString();
+                                        if( s == null ) {
+                                            return null;
+                                        }
+                                        s = s.trim().toLowerCase();
+                                        if( s.length()==0 ) {
+                                            return null;
+                                        }
+					if( s.startsWith("0x")) {
+						value = Integer.valueOf(s.substring(2), 16);
+					} else {
+					    value = Integer.valueOf(s);
+					}
+				}
+			}
+			return value;
+		} catch(Exception e) {
+			throw new CoercionException(e); 
+		}
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/VisitCanceledException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/VisitCanceledException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/VisitCanceledException.java	(revision 1235)
@@ -0,0 +1,92 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.visitor;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Exception thrown when a visit of a {@link Visitor} is cancelled.
+ * <p>
+ * This exception must be catched by a {@link Visitable} when is processing a
+ * {@link Visitor} and cancel the process.
+ * </p>
+ * <p>
+ * A {@link Visitor} must throw this exception if it wants to cancel a visit in
+ * progress.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class VisitCanceledException extends BaseException {
+
+	private static final long serialVersionUID = 7551988965463140258L;
+
+	private static final String KEY = "_VisitCanceledException";
+
+	private static final String DEFAULT_MESSAGE = "Visit canceled";
+
+	/**
+	 * Creates a new {@link VisitCanceledException}.
+	 */
+	public VisitCanceledException() {
+		super(DEFAULT_MESSAGE, KEY, serialVersionUID);
+	}
+
+	/**
+	 * Creates a new {@link VisitCanceledException} with a cause.
+	 * 
+	 * @param cause
+	 *            of the exception
+	 */
+	public VisitCanceledException(Throwable cause) {
+		super(DEFAULT_MESSAGE, cause, KEY, serialVersionUID);
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitor.java	(revision 1235)
@@ -0,0 +1,48 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.visitor;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Interface for objects which are able to visit a {@link Visitable} object.
+ * 
+ * @author 2008-2009 Jos� Manuel Viv�
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Visitor {
+
+	/**
+	 * Visits one of the objects provided by a {@link Visitable}.
+	 * 
+	 * @param obj
+	 *            the object to perform the action with
+	 * @throws VisitCanceledException
+	 *             thrown if the visit ha to be cancelled by the
+	 *             {@link Visitable}
+	 * @throws BaseException
+	 *             if there is an error performing the visit
+	 */
+	public void visit(Object obj) throws VisitCanceledException, BaseException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractVisitable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractVisitable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractVisitable.java	(revision 1235)
@@ -0,0 +1,65 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.visitor.impl;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract base implementation for {@link Visitable} classes.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractVisitable implements Visitable {
+
+	private static final Logger LOG =
+			LoggerFactory.getLogger(AbstractVisitable.class);
+
+	public final void accept(Visitor visitor) throws BaseException {
+		try {
+			doAccept(visitor);
+		} catch (VisitCanceledException ex) {
+			// The visit has been cancelled by the visitor, so we finish here.
+			LOG.debug("The visit has been cancelled by the visitor: {}",
+					visitor);
+		}
+	}
+
+	/**
+	 * Provides each value of this container to the provided {@link Visitor}.
+	 * The {@link VisitCanceledException} will be managed by the parent
+	 * {@link AbstractVisitable} class, so simply throw it.
+	 */
+	protected abstract void doAccept(Visitor visitor)
+			throws VisitCanceledException, BaseException;
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/impl/AbstractIndexedVisitable.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.visitor.impl;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.IndexedVisitable;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract base implementation for {@link Visitable} classes.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractIndexedVisitable extends AbstractVisitable
+		implements IndexedVisitable {
+
+	private static final Logger LOG =
+			LoggerFactory.getLogger(AbstractIndexedVisitable.class);
+
+	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);
+		}
+	}
+
+	protected void doAccept(Visitor visitor) throws VisitCanceledException,
+			BaseException {
+		doAccept(visitor, 0);
+	}
+
+	/**
+	 * Provides each value of this container to the provided {@link Visitor}.
+	 * The {@link VisitCanceledException} will be managed by the parent
+	 * {@link AbstractIndexedVisitable} class, so simply throw it.
+	 */
+	protected abstract void doAccept(Visitor visitor, long firstValueIndex)
+			throws VisitCanceledException, BaseException;
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/Visitable.java	(revision 1235)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.visitor;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Interface for containers which are able to provide each of its values to a
+ * given {@link Visitor}.
+ * 
+ * @author 2008-2009 Jos� Manuel Viv�
+ * @author 2009-     <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Visitable {
+
+	/**
+	 * Provides each value of this container to the provided {@link Visitor}.
+	 * 
+	 * @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;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/IndexedVisitable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/IndexedVisitable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/IndexedVisitable.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.visitor;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * {@link Visitable} extension to add the option to start the visit begging from
+ * a provided index.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface IndexedVisitable extends Visitable {
+
+	/**
+	 * Provides each value of this container to the provided {@link Visitor},
+	 * beginning from the provided index position.
+	 * 
+	 * @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: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/NotSupportedOperationException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/NotSupportedOperationException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/visitor/NotSupportedOperationException.java	(revision 1235)
@@ -0,0 +1,58 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.visitor;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Exception thrown when a {@link Visitor} is provided with an object not
+ * supported.
+ * 
+ * @author 2009- Jorge Piera Llodr� (jorge.piera@iver.es)
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class NotSupportedOperationException extends BaseException{
+
+	private static final long serialVersionUID = -2240464016042818342L;
+
+	private static final String KEY = "geometries_reader_not_exists";
+	private static final String MESSAGE =
+			"The visitor %(visitor) doesn't implements any "
+					+ "operation for the object %(object)";
+
+	/**
+	 * Creates a new {@link NotSupportedOperationException}.
+	 * 
+	 * @param visitor
+	 *            the visitor which not supports the object
+	 * @param object
+	 *            the visited unsupported object
+	 */
+	public NotSupportedOperationException(Visitor visitor, Object object){
+		super(MESSAGE, KEY, serialVersionUID);
+		setValue("visitor", visitor);
+		setValue("object", object);
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Manager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Manager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Manager.java	(revision 1235)
@@ -0,0 +1,84 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.service;
+
+import org.gvsig.tools.dynobject.DynObject;
+
+/**
+ * Creates parameters for services and services themselves.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Manager {
+
+	/**
+	 * Creates a new object to contain service parameters values.
+	 * 
+	 * @param serviceName
+	 *            the name of the service whose parameters have to be created
+	 * @return an empty parameters container
+	 * @throws ServiceException
+	 *             if there is not any service registered with the given name
+	 */
+	DynObject createServiceParameters(String serviceName)
+			throws ServiceException;
+
+	/**
+	 * Creates a new {@link Service} based on the given parameters.
+	 * 
+	 * @param parameters
+	 *            of the {@link Service} to create
+	 * @return the new created {@link Service}
+	 * @throws ServiceException
+	 *             if there is an error creating the Service, or the parameters
+	 *             are not valid
+	 */
+	Service getService(DynObject parameters) throws ServiceException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractPersistentProviderServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractPersistentProviderServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractPersistentProviderServices.java	(revision 1235)
@@ -0,0 +1,134 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.service.Service;
+
+/**
+ * Base Persistent {@link ProviderServices}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractPersistentProviderServices extends
+		AbstractProviderServices implements Persistent {
+
+	private static final String PROVIDER_SERVICES_DYNCLASS_NAME =
+			"ProviderServices";
+
+	private static final String FIELD_SERVICE = "service";
+
+	/**
+	 * Empty constructor to be used only for persistence purposes.
+	 */
+	public AbstractPersistentProviderServices() {
+		// Nothing to do
+		registerProviderServicesPersistence();
+	}
+
+	public final void loadFromState(PersistentState state)
+			throws PersistenceException {
+		// Load own properties
+		setService((Service) state.get(FIELD_SERVICE));
+
+		// Load child class properties
+		doLoadFromState(state);
+	}
+
+	public final void saveToState(PersistentState state)
+			throws PersistenceException {
+		// Persist own properties
+		state.set(FIELD_SERVICE, getService());
+
+		// Persist child class properties
+		doSaveToState(state);
+	}
+
+	private void registerProviderServicesPersistence() {
+		DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager();
+		DynStruct dynClass =
+				dynObjectManager.get(PROVIDER_SERVICES_DYNCLASS_NAME);
+		if (dynClass == null) {
+			dynClass = createProviderServicesDynClass(dynObjectManager);
+		}
+
+		// Extend the base definition with the one of the child class
+		DynStruct childDynClass = getProviderServicesChildDynClass();
+		if (childDynClass == null) {
+			childDynClass = dynClass;
+		} else {
+			childDynClass.extend(dynClass);
+		}
+	}
+
+	private DynStruct createProviderServicesDynClass(
+			DynObjectManager dynObjectManager) {
+		// Add the ProviderFactory base DynClass definition.
+		PersistenceManager pmanager= ToolsLocator.getPersistenceManager();
+		DynStruct definition = pmanager.addDefinition(getClass(), PROVIDER_SERVICES_DYNCLASS_NAME, (String)null, null, null);
+		
+		// Service parameter
+		definition.addDynFieldObject(FIELD_SERVICE).setMandatory(true);
+
+		return definition;
+	}
+
+	/**
+	 * Return the {@link DynClass} of the persisted attributes of the child
+	 * class.
+	 * 
+	 * @return the {@link DynClass} for persistence of the child service class
+	 */
+	protected abstract DynClass getProviderServicesChildDynClass();
+
+	/**
+	 * Set the state of the child class persistent attributes from the state
+	 * passed as parameter.
+	 * 
+	 * @param state
+	 *            to load the attribute values from
+	 * @see Persistent#loadFromState(PersistentState)
+	 */
+	protected abstract void doLoadFromState(PersistentState state);
+
+	/**
+	 * Saves the internal state of the child class persistent attributes on the
+	 * provided PersistentState object.
+	 * 
+	 * @param state
+	 *            to save the attribute values to
+	 */
+	protected abstract void doSaveToState(PersistentState state);
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderFactory.java	(revision 1235)
@@ -0,0 +1,115 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Base {@link ProviderFactory} implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractProviderFactory implements ProviderFactory {
+
+	private DynClass parametersDynClass;
+
+	/**
+	 * Creates a new {@link AbstractProviderFactory}.
+	 */
+	public AbstractProviderFactory() {
+		setParametersDynClass(createParametersDynClass());
+	}
+
+	public String getName() {
+		return getParametersDynClass().getName();
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(
+				parametersDynClass);
+	}
+
+	public final Provider create(DynObject parameters, ProviderServices services)
+			throws ServiceException {
+		try {
+			ToolsLocator.getDynObjectManager().validate(parameters);
+		} catch (DynObjectValidateException e) {
+			throw new ServiceParametersValidationException(e);
+		}
+		Provider provider = doCreate(parameters, services);
+		provider.setProviderServices(services);
+		return provider;
+	}
+
+	/**
+	 * Returns the {@link DynClass} of the parameters for this factory
+	 * {@link Provider}s.
+	 * 
+	 * @return the parameters {@link DynClass}
+	 */
+	private DynClass getParametersDynClass() {
+		return parametersDynClass;
+	}
+
+	/**
+	 * Sets the {@link DynClass} of the parameters for this factory
+	 * {@link Provider}s.
+	 * 
+	 * @param parametersDynClass
+	 *            the parameters {@link DynClass}
+	 */
+	protected void setParametersDynClass(DynClass parametersDynClass) {
+		this.parametersDynClass = parametersDynClass;
+	}
+
+	/**
+	 * Creates a new {@link Provider} with the given parameters and
+	 * {@link ProviderServices}.
+	 * 
+	 * @param parameters
+	 *            to create the {@link Provider}
+	 * @param services
+	 *            to be used by the {@link Provider}
+	 * @return the created provider
+	 */
+	protected abstract Provider doCreate(DynObject parameters,
+			ProviderServices services);
+
+	/**
+	 * Creates the {@link DynClass} of the parameters for this factory
+	 * {@link Provider}s.
+	 * 
+	 * @return the {@link DynClass} of the parameters for this factory
+	 *         {@link Provider}s.
+	 */
+	protected abstract DynClass createParametersDynClass();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderManager.java	(revision 1235)
@@ -0,0 +1,118 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Base {@link ProviderManager} implementation which stores the registered
+ * {@link ProviderFactory} objects into a {@link Map}, using the name as the
+ * key.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractProviderManager implements ProviderManager, ProviderManager_WithGetFactories {
+
+
+	public void addProviderFactory(ProviderFactory providerFactory) {
+		ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.add(this.getRegistryKey(),this.getRegistryDescription());
+	    ep.append(providerFactory.getName(), null, providerFactory);
+		providerFactory.initialize();
+	}
+
+	protected abstract String getRegistryKey();
+	
+	protected abstract String getRegistryDescription();
+
+	public Provider createProvider(DynObject serviceParameters,
+			ProviderServices providerServices) throws ServiceException {
+		String serviceName = serviceParameters.getDynClass().getName();
+		ProviderFactory factory = getProviderFactory(serviceName);
+		return factory == null ? null : factory.create(serviceParameters,
+				providerServices);
+	}
+
+	public DynObject createServiceParameters(String serviceName)
+			throws ServiceException {
+		return getProviderFactory(serviceName).createParameters();
+	}
+
+    public ProviderFactory getProviderFactory(String serviceName)
+			throws ParametersException, NotRegisteredException {
+		ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.get(this.getRegistryKey());
+		ProviderFactory factory = null; 
+
+		if (ep != null) {
+			try {
+				factory = ((ProviderFactory) ep.create(serviceName));
+			} catch (InstantiationException e) {
+				throw new ParametersException(
+						"Can't instance provider factory", e);
+			} catch (IllegalAccessException e) {
+				throw new ParametersException("Can't access provider factory",
+						e);
+			}
+		}
+
+		if (factory == null) {
+			throw new NotRegisteredException(serviceName);
+		}
+		return factory;
+	}
+    
+    public List getProviderFactories() {
+    	List factories = new ArrayList(); 
+    	ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.add(this.getRegistryKey(),this.getRegistryDescription());
+
+		Iterator it = ep.iterator();
+		while( it.hasNext() ) {
+			ExtensionPoint.Extension extension = (ExtensionPoint.Extension) it.next();
+			try {
+				ProviderFactory factory = (ProviderFactory) extension.create();
+				factories.add(factory);
+			} catch (InstantiationException e) {
+				// Ignore, ProviderFactory are ExtensionSingleton and can't throw this exception
+			} catch (IllegalAccessException e) {
+				// Ignore, ProviderFactory are ExtensionSingleton and can't throw this exception
+			}
+		}
+		return factories;
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderRegistration.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderRegistration.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderRegistration.java	(revision 1235)
@@ -0,0 +1,87 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Base {@link ProviderRegistration} implementation which delegates on child
+ * classed the search of {@link ProviderFactory} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractProviderRegistration implements
+		ProviderRegistration {
+
+	public void registerProviderFactories(ProviderManager providerManager,
+			Class providerInterface) {
+		registerProviders(providerManager,
+				findProviderFactories(providerInterface));
+	}
+
+	public void registerProviderFactories(ProviderManager providerManager,
+			Class providerInterface, ClassLoader classLoader) {
+		registerProviders(providerManager, findProviderFactories(
+				providerInterface, classLoader));
+	}
+
+	/**
+	 * Returns the list of {@link ProviderFactory} objects which implement or
+	 * extend the given interface or class.
+	 * 
+	 * @param providerInterface
+	 *            of the returned {@link ProviderFactory} objects
+	 * @return the found {@link ProviderFactory} objects
+	 */
+	protected abstract Set findProviderFactories(Class providerInterface);
+
+	/**
+	 * Returns the list of {@link ProviderFactory} objects which implement or
+	 * extend the given interface or class.
+	 * 
+	 * @param providerInterface
+	 *            of the returned {@link ProviderFactory} objects
+	 * @param classLoader
+	 *            to use to load or find the {@link ProviderFactory} objects
+	 * @return the found {@link ProviderFactory} objects
+	 */
+	protected abstract Set findProviderFactories(Class providerInterface,
+			ClassLoader classLoader);
+
+	private void registerProviders(ProviderManager providerManager,
+			Set providers) {
+		if (providers != null) {
+			for (Iterator iterator = providers.iterator(); iterator.hasNext();) {
+				ProviderFactory providerFactory =
+						(ProviderFactory) iterator.next();
+				providerManager.addProviderFactory(providerFactory);
+			}
+		}
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceFactory.java	(revision 1235)
@@ -0,0 +1,119 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Base {@link ServiceFactory} implementation.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class AbstractServiceFactory implements ServiceFactory {
+
+	private DynClass parametersDynClass;
+
+	/**
+	 * Creates a new {@link AbstractServiceFactory}.
+	 */
+	public AbstractServiceFactory() {
+		setParametersDynClass(createParametersDynClass());
+	}
+
+	public String getName() {
+		return getParametersDynClass().getName();
+	}
+
+	public DynObject createParameters() {
+		return ToolsLocator.getDynObjectManager().createDynObject(
+				parametersDynClass);
+	}
+
+	public final Service create(DynObject parameters,
+			ServiceManager serviceManager)
+			throws ServiceException {
+		try {
+			ToolsLocator.getDynObjectManager().validate(parameters);
+		} catch (DynObjectValidateException e) {
+			throw new ServiceParametersValidationException(e);
+		}
+		Service service = doCreate(parameters, serviceManager);
+		return service;
+	}
+
+	/**
+	 * Returns the {@link DynClass} of the parameters for this factory
+	 * {@link Service}s.
+	 * 
+	 * @return the parameters {@link DynClass}
+	 */
+	private DynClass getParametersDynClass() {
+		return parametersDynClass;
+	}
+
+	/**
+	 * Sets the {@link DynClass} of the parameters for this factory
+	 * {@link Service}s.
+	 * 
+	 * @param parametersDynClass
+	 *            the parameters {@link DynClass}
+	 */
+	protected void setParametersDynClass(DynClass parametersDynClass) {
+		this.parametersDynClass = parametersDynClass;
+	}
+
+	/**
+	 * Creates a new {@link Service} with the given parameters and
+	 * {@link ServiceManager}.
+	 * 
+	 * @param parameters
+	 *            to create the {@link Service}
+	 * @param serviceManager
+	 *            to be used by the {@link Service}
+	 * @return the created service
+	 * @throws ServiceException
+	 *             if the parameters are not valid or there is an error creating
+	 *             the {@link Service}
+	 */
+	protected abstract Service doCreate(DynObject parameters,
+			ServiceManager serviceManager) throws ServiceException;
+
+	/**
+	 * Creates the {@link DynClass} of the parameters for this factory
+	 * {@link Service}s.
+	 * 
+	 * @return the {@link DynClass} of the parameters for this factory
+	 *         {@link Service}s.
+	 */
+	protected abstract DynClass createParametersDynClass();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceParametersValidationException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceParametersValidationException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceParametersValidationException.java	(revision 1235)
@@ -0,0 +1,53 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Exception thrown when the parameters provided for a service are not valid.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ServiceParametersValidationException extends ServiceException {
+
+	private static final long serialVersionUID = -1104610937183856037L;
+
+	private static final String MESSAGE_KEY =
+			"_ServiceParametersValidationException";
+	private static final String MESSAGE_FORMAT =
+			"The service parameters values are not valid";
+
+	/**
+	 * Creates a new {@link ServiceParametersValidationException}.
+	 */
+	public ServiceParametersValidationException(DynObjectValidateException cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProvider.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProvider.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProvider.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+/**
+ * Base {@link Provider} implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractProvider implements Provider {
+
+	private ProviderServices providerServices;
+
+	/**
+	 * Creates a new {@link Provider} with the provider services to use.
+	 * 
+	 * @param providerServices
+	 *            to use
+	 */
+	public AbstractProvider(ProviderServices providerServices) {
+		this.providerServices = providerServices;
+	}
+
+	public void setProviderServices(ProviderServices services) {
+		this.providerServices = services;
+	}
+
+	/**
+	 * Returns the {@link ProviderServices} to be used by this {@link Provider}.
+	 * 
+	 * @return the providerServices to use
+	 */
+	protected ProviderServices getProviderServices() {
+		return providerServices;
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractServiceManager.java	(revision 1235)
@@ -0,0 +1,126 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPointManager;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base {@link ServiceManager} implementation which stores the registered
+ * {@link ServiceFactory} objects into a {@link Map}, using the name as the key.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class AbstractServiceManager implements ServiceManager {
+	private static final Logger logger = LoggerFactory.getLogger(AbstractServiceManager.class);
+
+	public void addServiceFactory(ServiceFactory serviceFactory) {
+		ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.add(this.getRegistryKey(), this
+				.getRegistryDescription());
+		ep.append(serviceFactory.getName(), null, serviceFactory);
+		serviceFactory.initialize();
+		logger.info(this.getName()+" register service '"+serviceFactory.getName()+"' factory "+serviceFactory.getClass().getName()+".");
+	}
+
+	protected String getName() {
+		String s = this.getClass().getName(); // .getSimpleName() snif
+		try {
+			String[] x = s.split(".");
+			return x[x.length-1];
+		} catch(Exception ex) {
+			return s;
+		}
+	}
+	
+	protected abstract String getRegistryKey();
+
+	protected abstract String getRegistryDescription();
+
+	public Service createService(DynObject serviceParameters)
+			throws ServiceException {
+		String serviceName = serviceParameters.getDynClass().getName();
+		ServiceFactory factory = getServiceFactory(serviceName);
+		return factory == null ? null : factory.create(serviceParameters, this);
+	}
+
+	public DynObject createServiceParameters(String serviceName)
+			throws ServiceException {
+		return getServiceFactory(serviceName).createParameters();
+	}
+
+	private ServiceFactory getServiceFactory(String serviceName)
+			throws ParametersException, NotRegisteredException {
+		ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.get(this.getRegistryKey());
+		ServiceFactory factory = null;
+		try {
+			factory = ((ServiceFactory) ep.create(serviceName));
+		} catch (InstantiationException e) {
+			throw new ParametersException("Can't instance service factory", e);
+		} catch (IllegalAccessException e) {
+			throw new ParametersException("Can't access service factory", e);
+		}
+
+		if (factory == null) {
+			throw new NotRegisteredException(serviceName);
+		}
+		return factory;
+	}
+	
+	public List getServiceFactories() {
+    	List factories = new ArrayList(); 
+    	ExtensionPointManager epm = ToolsLocator.getExtensionPointManager();
+		ExtensionPoint ep = epm.add(this.getRegistryKey(),this.getRegistryDescription());
+
+		Iterator it = ep.iterator();
+		while( it.hasNext() ) {
+			ExtensionPoint.Extension extension = (ExtensionPoint.Extension) it.next();
+			try {
+				ServiceFactory factory = (ServiceFactory) extension.create();
+				factories.add(factory);
+			} catch (InstantiationException e) {
+				// Ignore, ServiceFactory are ExtensionSingleton and can't throw this exception
+			} catch (IllegalAccessException e) {
+				// Ignore, ServiceFactory are ExtensionSingleton and can't throw this exception
+			}
+		}
+		return factories;
+    }
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager_WithGetFactories.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager_WithGetFactories.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager_WithGetFactories.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import java.util.List;
+
+public interface ProviderManager_WithGetFactories {
+
+    public ProviderFactory getProviderFactory(String serviceName) throws ParametersException, NotRegisteredException ;
+
+    public List getProviderFactories();
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager_WithGetFactories.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ParametersException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ParametersException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ParametersException.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Exception thrown when a service is needed but the provider or service
+ * implementation is not registered.
+ * 
+ * @author 2009- <a href="badia_jos@gvsig.org">Jos� Bad�a</a> - gvSIG team
+ */
+public class ParametersException extends ServiceException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7302330967991851480L;
+	private final static String MESSAGE_KEY = "_ParametersException";
+	private final static String MESSAGE_FORMAT = "Can't create parameters for '%(name)'";
+
+	/**
+	 * Creates a new {@link ParametersException}.
+	 * 
+	 * @param name
+	 *            the name of the provider which is not registered
+	 */
+	public ParametersException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+	}
+
+	public ParametersException(String name, Throwable e) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.initCause(e);
+		setValue("name", name);
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderFactory.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.extensionpoint.ExtensionSingleton;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Creates new {@link Provider}s and its parameters.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface ProviderFactory extends ExtensionSingleton {
+
+	/**
+	 * Returns the name of the providers created by this factory.
+	 * 
+	 * @return the provider name
+	 */
+	String getName();
+
+	/**
+	 * Creates a new {@link Provider}.
+	 * 
+	 * @param parameters
+	 *            for the {@link Provider}
+	 * @param services
+	 *            to be used by the {@link Provider}
+	 * @return the new {@link Provider}
+	 * @throws ServiceException
+	 *             if the parameters are not valid or there is an error creating
+	 *             the {@link Provider}
+	 */
+	Provider create(DynObject parameters, ProviderServices services)
+			throws ServiceException;
+
+	/**
+	 * Creates the parameters for the {@link Provider} created by this factory.
+	 * 
+	 * @return the provider parameters
+	 */
+	DynObject createParameters();
+
+	/**
+	 * Initialices the factory.
+	 */
+	void initialize();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/AbstractProviderServices.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.AbstractService;
+import org.gvsig.tools.service.Service;
+
+/**
+ * Base {@link ProviderServices} implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractProviderServices implements ProviderServices {
+
+	private Service service;
+
+	/**
+	 * Empty constructor to be used only for persistence purposes.
+	 */
+	public AbstractProviderServices() {
+		// Nothing to do
+	}
+
+	public DynObject getParameters(){
+		return ((AbstractService)this.getService()).getServiceParameters();
+	}
+
+	public Service getService() {
+		return service;
+	}
+
+	public void setService(Service service) {
+		this.service = service;
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderRegistration.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderRegistration.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderRegistration.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+/**
+ * Registers {@link ProviderFactory} objects which implement the given interface
+ * or extend the given class, into a {@link ProviderManager}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface ProviderRegistration {
+
+	/**
+	 * Registers {@link ProviderFactory} objects which implement or extend the
+	 * given class.
+	 * 
+	 * @param providerManager
+	 *            to register the factories to
+	 * @param providerInterface
+	 *            of the {@link ProviderFactory} objects to register
+	 */
+	void registerProviderFactories(ProviderManager providerManager,
+			Class providerInterface);
+
+	/**
+	 * Registers {@link ProviderFactory} objects which implement or extend the
+	 * given class.
+	 * 
+	 * @param providerManager
+	 *            to register the factories to
+	 * @param providerInterface
+	 *            of the {@link ProviderFactory} objects to register
+	 * @param classLoader
+	 *            to use to load or find the {@link ProviderFactory} objects
+	 */
+	void registerProviderFactories(ProviderManager providerManager,
+			Class providerInterface, ClassLoader classLoader);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderManager.java	(revision 1235)
@@ -0,0 +1,85 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Manager the registration of {@link ProviderFactory} objects and the creation
+ * of Providers.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface ProviderManager {
+
+	/**
+	 * Adds a new {@link ProviderFactory} to the registry.
+	 * 
+	 * @param providerFactory
+	 *            to add
+	 */
+	void addProviderFactory(ProviderFactory providerFactory);
+
+	/**
+	 * Creates a new {@link Provider}.
+	 * 
+	 * @param serviceParameters
+	 *            for the {@link Provider}
+	 * @param providerServices
+	 *            to be used by the {@link Provider}
+	 * @return the new {@link Provider}
+	 * @throws ServiceException
+	 *             if the parameters are not valid or there is an error creating
+	 *             the {@link Provider}
+	 */
+	Provider createProvider(DynObject serviceParameters,
+			ProviderServices providerServices) throws ServiceException;
+
+	/**
+	 * Creates a new {@link ProviderServices} object to be used by the
+	 * {@link Provider}s.
+	 * 
+	 * @param service
+	 *            to create the related {@link ProviderServices} with.
+	 * @return the provider services
+	 */
+	ProviderServices createProviderServices(Service service);
+
+	/**
+	 * Creates the parameters for the {@link Provider} created by the factory
+	 * with the given name.
+	 * 
+	 * @param serviceName
+	 *            name of the factory to create the {@link Provider}
+	 * @return the provider parameters
+	 */
+	DynObject createServiceParameters(String serviceName)
+			throws ServiceException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceFactory.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.extensionpoint.ExtensionSingleton;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Creates new {@link Service}s and its parameters.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public interface ServiceFactory extends ExtensionSingleton {
+
+	/**
+	 * Returns the name of the services created by this factory.
+	 * 
+	 * @return the service name
+	 */
+	String getName();
+
+	/**
+	 * Creates a new {@link Service}.
+	 * 
+	 * @param parameters
+	 *            for the {@link Service}
+	 * @param serviceManager
+	 *            to be used by the {@link Service}
+	 * @return the new {@link Service}
+	 * @throws ServiceException
+	 *             if the parameters are not valid or there is an error creating
+	 *             the {@link Service}
+	 */
+	Service create(DynObject parameters, ServiceManager serviceManager)
+			throws ServiceException;
+
+	/**
+	 * Creates the parameters for the {@link Service} created by this factory.
+	 * 
+	 * @return the service parameters
+	 */
+	DynObject createParameters();
+
+	/**
+	 * Initializes the factory.
+	 */
+	void initialize();
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/Provider.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/Provider.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/Provider.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+/**
+ * Interface for service providers.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Provider {
+
+	void setProviderServices(ProviderServices services);
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ServiceManager.java	(revision 1235)
@@ -0,0 +1,72 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Manages the registration of {@link ServiceFactory} objects and the creation
+ * of Services.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public interface ServiceManager {
+
+	/**
+	 * Adds a new {@link ServiceFactory} to the registry.
+	 * 
+	 * @param serviceFactory
+	 *            to add
+	 */
+	void addServiceFactory(ServiceFactory serviceFactory);
+
+	/**
+	 * Creates a new {@link Service}.
+	 * 
+	 * @param serviceParameters
+	 *            for the {@link Service}
+	 * @return the new {@link Service}
+	 * @throws ServiceException
+	 *             if the parameters are not valid or there is an error creating
+	 *             the {@link Provider}
+	 */
+	Service createService(DynObject serviceParameters) throws ServiceException;
+
+	/**
+	 * Creates the parameters for the {@link Service} created by the factory
+	 * with the given name.
+	 * 
+	 * @param serviceName
+	 *            name of the factory to create the {@link Service}
+	 * @return the service parameters
+	 */
+	DynObject createServiceParameters(String serviceName)
+			throws ServiceException;
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/NotRegisteredException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/NotRegisteredException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/NotRegisteredException.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.spi;
+
+import org.gvsig.tools.service.ServiceException;
+
+/**
+ * Exception thrown when a service through a Provider or a Service
+ * implementation is needed but the provider is not registered.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public class NotRegisteredException extends ServiceException {
+
+	private static final long serialVersionUID = 7440696464556384843L;
+
+	private final static String MESSAGE_KEY = "_NotRegisteredException";
+	private final static String MESSAGE_FORMAT = "No provider or service "
+			+ "implementation has been registered with the name '%(name)'";
+
+	/**
+	 * Creates a new {@link NotRegisteredException}.
+	 * 
+	 * @param name
+	 *            the name of the provider or service implementation which is
+	 *            not registered
+	 */
+	public NotRegisteredException(String name) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderServices.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderServices.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/spi/ProviderServices.java	(revision 1235)
@@ -0,0 +1,71 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.service.spi;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Service;
+
+/**
+ * Provides services to a {@link Provider}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface ProviderServices {
+
+	/**
+	 * Returns the {@link Service} at the API level.
+	 * 
+	 * @return the service
+	 */
+	Service getService();
+	
+	public DynObject getParameters();
+	
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractMultiServiceImplManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractMultiServiceImplManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractMultiServiceImplManager.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ServiceManager;
+
+/**
+ * Base {@link Manager} implementation for managers which depend on the
+ * registration of multiple service implementations.
+ * 
+ * @author 2009- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class AbstractMultiServiceImplManager implements Manager {
+
+	private final ServiceManager serviceManager;
+
+	public AbstractMultiServiceImplManager(ServiceManager serviceManager) {
+		this.serviceManager = serviceManager;
+	}
+
+	public DynObject createServiceParameters(String serviceName)
+			throws ServiceException {
+		return getServiceManager().createServiceParameters(serviceName);
+	}
+
+	/**
+	 * Returns the service Manager
+	 * 
+	 * @return the {@link ServiceManager}
+	 */
+	public ServiceManager getServiceManager() {
+		return serviceManager;
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractManager.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ProviderManager;
+
+/**
+ * Base {@link Manager} implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractManager implements Manager {
+
+	private final ProviderManager providerManager;
+
+	public AbstractManager(ProviderManager providerManager) {
+		this.providerManager = providerManager;
+	}
+
+	public DynObject createServiceParameters(String serviceName)
+			throws ServiceException {
+		return getProviderManager().createServiceParameters(serviceName);
+	}
+
+	public ProviderManager getProviderManager() {
+		return providerManager;
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceException.java	(revision 1235)
@@ -0,0 +1,79 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.service;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Service related parent exception. Extend it for new exceptions in the service
+ * package.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ServiceException extends BaseException {
+
+	private static final long serialVersionUID = 2904189349641567182L;
+
+	/**
+	 * @see BaseException#BaseException(String, String, long)
+	 */
+	public ServiceException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	/**
+	 * @see BaseException#BaseException(String, Throwable, String, long)
+	 */
+	public ServiceException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Service.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Service.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/Service.java	(revision 1235)
@@ -0,0 +1,67 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.service;
+
+
+/**
+ * A service.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface Service {
+
+	/**
+	 * Returns a reference to the {@link Manager} which manages this server.
+	 * 
+	 * @return the server's {@link Manager}
+	 */
+	Manager getManager();
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/impl/DefaultProviderRegistration.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/impl/DefaultProviderRegistration.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/impl/DefaultProviderRegistration.java	(revision 1235)
@@ -0,0 +1,69 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service.impl;
+
+import java.util.Set;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.service.spi.AbstractProviderRegistration;
+import org.gvsig.tools.service.spi.ProviderFactory;
+import org.gvsig.tools.service.spi.ProviderRegistration;
+import org.gvsig.tools.util.ServiceLoader;
+
+/**
+ * {@link ProviderRegistration} implementation which finds
+ * {@link ProviderFactory} objects automatically using the {@link ServiceLoader}
+ * .
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultProviderRegistration extends AbstractProviderRegistration {
+
+	private final ServiceLoader serviceLoader;
+
+	public DefaultProviderRegistration() {
+		this(ToolsLocator.getServiceLoader());
+	}
+
+	public DefaultProviderRegistration(ServiceLoader serviceLoader) {
+		this.serviceLoader = serviceLoader;
+	}
+
+	private ServiceLoader getServiceLoader() {
+		return serviceLoader;
+	}
+
+	protected Set findProviderFactories(Class providerInterface) {
+		return getServiceLoader().load(providerInterface);
+	}
+
+	protected Set findProviderFactories(Class providerInterface,
+			ClassLoader classLoader) {
+		return getServiceLoader().load(providerInterface, classLoader);
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractService.java	(revision 1235)
@@ -0,0 +1,140 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.AbstractProviderServices;
+import org.gvsig.tools.service.spi.Provider;
+import org.gvsig.tools.service.spi.ProviderManager;
+import org.gvsig.tools.service.spi.ProviderServices;
+
+/**
+ * {@link Service} base parent implementation, delegating in the child classes
+ * the retrieval of the {@link ProviderManager}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractService implements Service {
+
+	private DynObject serviceParameters;
+	private ProviderServices providerServices;
+	private Provider provider;
+
+	/**
+	 * Empty constructor to be used only for persistence purposes.
+	 */
+	public AbstractService() {
+		// Nothing to do
+	}
+
+	/**
+	 * Creates a new {@link AbstractService}.
+	 * 
+	 * @param serviceParameters
+	 *            the parameters of the current service
+	 * @throws ServiceException
+	 *             if there is an error with the parameters
+	 */
+	public AbstractService(DynObject serviceParameters) throws ServiceException {
+		init(serviceParameters, createProviderServices());
+	}
+
+	/**
+	 * Returns the service parameters this services was created with
+	 * 
+	 * @return the service parameters
+	 */
+	public DynObject getServiceParameters() {
+		return serviceParameters;
+	}
+
+	/**
+	 * Initialices the service.
+	 * 
+	 * @param serviceParameters
+	 *            the service parameters
+	 * @param providerServices
+	 *            the provider services
+	 * @throws ServiceException
+	 *             thrown while creating the provider
+	 */
+	protected void init(DynObject serviceParameters,
+			ProviderServices providerServices) throws ServiceException {
+		setServiceParameters(serviceParameters);
+		setProviderServices(providerServices);
+		setProvider(createProvider(serviceParameters));
+		((AbstractProviderServices)providerServices).setService(this);
+	}
+
+	/**
+	 * Returns the provider related to this service.
+	 * 
+	 * @return the provider
+	 */
+	protected Provider getProvider() {
+		return provider;
+	}
+
+	/**
+	 * Returns the provider services to be used by the provider of this service.
+	 * 
+	 * @return the provider services
+	 */
+	protected ProviderServices getProviderServices() {
+		return providerServices;
+	}
+
+	/**
+	 * Returns the reference to the {@link ProviderManager}.
+	 * 
+	 * @return the ProviderManager
+	 */
+	protected abstract ProviderManager getProviderManager();
+
+	private void setServiceParameters(DynObject serviceParameters) {
+		this.serviceParameters = serviceParameters;
+	}
+
+	private void setProvider(Provider provider) {
+		this.provider = provider;
+	}
+
+	private Provider createProvider(DynObject serviceParameters)
+			throws ServiceException {
+		return getProviderManager().createProvider(serviceParameters,
+				providerServices);
+	}
+
+	private ProviderServices createProviderServices() {
+		return getProviderManager().createProviderServices(this);
+	}
+
+	private void setProviderServices(ProviderServices providerServices) {
+		this.providerServices = providerServices;
+	}
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractPersistentService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractPersistentService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/AbstractPersistentService.java	(revision 1235)
@@ -0,0 +1,151 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.tools.service;
+
+import org.gvsig.tools.ToolsLocator;
+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.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.service.spi.ProviderServices;
+
+/**
+ * Base {@link Service} implementation which is also {@link Persistent}.
+ * <p>
+ * The persistence is based on the service parameters, which are persisted by
+ * this implementation. Child implementation services must persist their own
+ * additional properties.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractPersistentService extends AbstractService
+		implements Persistent {
+
+	private static final String SERVICE_DYNCLASS_NAME = "Service";
+
+	private static final String FIELD_PARAMETERS = "parameters";
+
+	private static final String FIELD_PROVIDER_SERVICES = "provider-services";
+
+	/**
+	 * Empty constructor to be used only for persistence purposes.
+	 */
+	public AbstractPersistentService() {
+		registerServicePersistence();
+	}
+
+	/**
+	 * @see AbstractService#AbstractService(DynObject).
+	 */
+	public AbstractPersistentService(DynObject serviceParameters)
+			throws ServiceException {
+		super(serviceParameters);
+		registerServicePersistence();
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		DynObject serviceParameters = (DynObject) state.get(FIELD_PARAMETERS);
+		ProviderServices providerServices =
+				(ProviderServices) state.get(FIELD_PROVIDER_SERVICES);
+		try {
+			init(serviceParameters, providerServices);
+		} catch (ServiceException e) {
+			throw new PersistenceException(e);
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set(FIELD_PARAMETERS, getServiceParameters());
+		state.set(FIELD_PROVIDER_SERVICES, getProviderServices());
+	}
+
+	private void registerServicePersistence() {
+		DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager();
+		DynStruct dynClass = dynObjectManager.get(SERVICE_DYNCLASS_NAME);
+		if (dynClass == null) {
+			dynClass = createServiceDynClass(dynObjectManager);
+		}
+
+		// Extend the base definition with the one of the child class
+		DynStruct childDynClass = getServiceChildDynClass();
+		if (childDynClass == null) {
+			childDynClass = dynClass;
+		} else {
+			childDynClass.extend(dynClass);
+		}
+		
+	}
+
+	private DynStruct createServiceDynClass(DynObjectManager dynObjectManager) {
+		// Add the ProviderFactory base DynClass definition.
+
+		PersistenceManager pmanager= ToolsLocator.getPersistenceManager();
+		DynStruct definition = pmanager.addDefinition(getClass(), SERVICE_DYNCLASS_NAME, (String)null, null, null);
+
+		// Service parameters field
+		definition.addDynFieldObject(FIELD_PARAMETERS).setMandatory(true);
+		// Provider services field
+		definition.addDynFieldObject(FIELD_PROVIDER_SERVICES).setMandatory(true);
+
+		return definition;
+	}
+
+	/**
+	 * Return the {@link DynClass} of the persisted attributes of the child
+	 * class.
+	 * 
+	 * @return the {@link DynClass} for persistence of the child service class
+	 */
+	protected abstract DynClass getServiceChildDynClass();
+
+	/**
+	 * Set the state of the child class persistent attributes from the state
+	 * passed as parameter.
+	 * 
+	 * @param state
+	 *            to load the attribute values from
+	 * @see Persistent#loadFromState(PersistentState)
+	 */
+	protected abstract void doLoadFromState(PersistentState state);
+
+	/**
+	 * Saves the internal state of the child class persistent attributes on the
+	 * provided PersistentState object.
+	 * 
+	 * @param state
+	 *            to save the attribute values to
+	 */
+	protected abstract void doSaveToState(PersistentState state);
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceInitializationException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceInitializationException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/service/ServiceInitializationException.java	(revision 1235)
@@ -0,0 +1,81 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public 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.tools.service;
+
+import org.gvsig.tools.dynobject.DynObject;
+
+/**
+ * Exception thrown when there is an error while initializing a service.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ServiceInitializationException extends ServiceException {
+
+	private static final long serialVersionUID = -2239943565331174126L;
+	private static final String KEY = "_ServiceInitializationException";
+	private static final String MESSAGE =
+			"Error initializing service with parameters: %(serviceParameters)";
+
+	/**
+	 * Creates a new {@link ServiceInitializationException} with the parameters
+	 * of the service being initialized.
+	 * 
+	 * @param serviceParameters
+	 *            of the service being initialized
+	 * @param cause
+	 *            original cause of the exception
+	 */
+	public ServiceInitializationException(DynObject serviceParameters,
+			Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+		setValue("serviceParameters", serviceParameters);
+	}
+
+}
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractCancellableTask.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractCancellableTask.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractCancellableTask.java	(revision 1235)
@@ -0,0 +1,55 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ * Abstract class for tasks, threads, that implements the interface CancellableTask.  
+ * This handle the status of the cancelationRequest flag. 
+ */
+
+public abstract class AbstractCancellableTask extends Thread implements CancellableTask {
+
+    protected boolean cancellationRequested;
+
+    protected AbstractCancellableTask() {
+    	this.cancellationRequested = false;
+    }
+
+    protected AbstractCancellableTask(String threadName) {
+        super(threadName);
+        this.cancellationRequested = false;
+    }
+    
+    public void cancelRequest() {
+        this.cancellationRequested = true;
+    }
+
+    public boolean isCancellationRequested() {
+        return this.cancellationRequested;
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractCancellableTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/MonitorableTask.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/MonitorableTask.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/MonitorableTask.java	(revision 1235)
@@ -0,0 +1,29 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+public interface MonitorableTask extends CancellableTask{
+
+	public TaskStatus getTaskStatus();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/MonitorableTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/SimpleTaskStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/SimpleTaskStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/SimpleTaskStatus.java	(revision 1235)
@@ -0,0 +1,151 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+public interface SimpleTaskStatus extends TaskStatus {
+
+    /**
+     * Used by the task to set the title associated to the task.
+     * It can't be changed.
+     * 
+     * @param tittle
+     * 
+     * @deprecated @see {@link SimpleTaskStatus#setTitle(String)}
+     */
+    public void setTittle(String tittle);
+
+    /**
+     * Used by the task to set the title associated to the task.
+     * It can't be changed.
+     * 
+     * @param title
+     */
+    public void setTitle(String title);
+
+	/**
+	 * Used by the task to set a message associated to the current action of the task
+	 *  
+	 * @param message
+	 */
+	public void message(String message);
+	
+	/**
+	 * Used by the task to set the value for min and max steps of the task.
+	 * These are used with the "curvalue" to calculate the
+	 * percentage of completion.
+	 * 
+	 * @param min
+	 * @param max
+	 */
+    public void setRangeOfValues(long min, long max);
+
+    /**
+	 * Used by the task to set the current step of the task. 
+	 * 
+	 * @param value
+	 * @see setRangeOfValues
+	 * 
+	 */
+	public void setCurValue(long value);
+
+	/**
+	 * Used by the task to inform that it has terminated without errors.
+	 */
+	public void terminate();
+
+	/**
+	 * Used by the task to inform that it has terminated cancelled by the user
+	 * or another task.
+	 */
+	public void cancel();
+
+	/**
+	 * Used by the task to inform that it has terminated with errors.
+	 */
+	public void abort();
+
+	/**
+	 * Remove this TaskStatus from the TaskStatusManager
+	 */
+	public void remove();
+	
+	/**
+	 * Add this TaskStatus to the TaskStatusManager.
+	 * If TaskStatus already in the manager this is updated.
+	 */
+	public void add();
+
+	/**
+	 * Used by the task to inform that this task es cacellable.
+	 * 
+	 * @param cancellable
+	 */
+	public void setCancellable(boolean cancellable);
+
+	/**
+	 * Used by the task to inform that this TaskStatus is removed
+	 * from the manager automatically when the task is terminated and the manager
+	 * need.
+	 * 
+	 * @param autoremove
+	 */
+	public void setAutoremove(boolean autoremove);
+	
+	/**
+	 * Return the autoremove value of this TaskStatus.
+	 * 
+	 * @return
+	 */
+	public boolean getAutoRemove();
+	
+	
+	/**
+	 * Set the estatus of task to inteterminate.
+	 * Reset values of range and current value.
+	 * 
+	 * @param Indeterminate
+	 */
+	public void setIndeterminate();
+	 
+	/**
+	 * Este metodo guarda los valores de progreso y el mensaje de la tarea
+     * para ser restaurados posteriormente invocando al metodo {@link #pop()}.
+     * 
+     * Los metodos {@link #push()} y {@link #pop()} estan pensado para gestionar 
+     * subtareas dentro de un tareas, de forma que las subtareas puedan tener su 
+     * propio progreso y mensaje mientras se estan ejecutando.
+     * 
+     * @see {@link #pop()}
+	 */
+	public void push();
+	
+	/**
+	 * Este metodo esta pensado para restaurar los ultimos valores de progreso y
+	 * mensaje que se guardaron invocando al metodo {@link #push()}.
+	 * 
+	 * @see {@link #push()}
+	 */
+	public void pop();
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/SimpleTaskStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatusManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatusManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatusManager.java	(revision 1235)
@@ -0,0 +1,122 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+import java.util.Map;
+
+import org.gvsig.tools.observer.Observable;
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public interface TaskStatusManager extends Observable {
+
+	/**
+	 * Add the TaskStatus to the TaskStatusManager. If TaskStatus already in the
+	 * manager this is updated.
+	 * 
+	 * @param taskStatus to add to the manager
+	 */
+	public void add(TaskStatus taskStatus);
+
+	/**
+	 * Retrieve a TaskStatus from the manager by code.
+	 * 
+	 * @param code of the TaskStatus to retrieve
+	 * @return
+	 */
+	public TaskStatus get(String code);
+
+	/**
+	 * Remove the TaskStatus by the passed code from the manager
+	 *
+	 * @param code of the TaskStatus to remove
+	 */
+	public void remove(String code);
+
+	/**
+	 * Remove the TaskStatus from the mananger.
+	 * 
+	 * @param taskStatus
+	 */
+	public void remove(TaskStatus taskStatus);
+
+	/**
+	 * Get a unmodifiable Map with all the TaskStatus in the 
+	 * manager. The keys of map are the code of TaskStatus.
+	 * 
+	 * @return Map of TaskStatus.
+	 */
+	public Map getAll();
+
+	/**
+	 * Return a new code to a TaskStatus.
+	 * 
+	 * @return
+	 */
+	public String getNewCode();
+
+	/**
+	 * Inform to the manager that this task status has changed.
+	 * This method has used by the implementation of TaskStatus
+	 * to inform to the manager of changes in a TaskStatus.
+	 * 
+	 * @param taskstatus
+	 */
+	public void update(TaskStatus taskstatus);
+
+	    /**
+     * Create a new instance of the default implementation of a
+     * SimpleTaskStatus.
+     * 
+     * @param label
+     *            used in the title of the new TaskStatus.
+     * 
+     * @deprecated @see
+     *             {@link TaskStatusManager#createDefaultSimpleTaskStatus(String)}
+     * 
+     * @return the new SimpleTaskStatus.
+     */
+	public SimpleTaskStatus creteDefaultSimpleTaskStatus(String label);
+
+    /**
+     * Create a new instance of the default implementation of a
+     * SimpleTaskStatus.
+     * 
+     * @param label
+     *            used in the title of the new TaskStatus.
+     * 
+     * @return the new SimpleTaskStatus.
+     */
+    public SimpleTaskStatus createDefaultSimpleTaskStatus(String label);
+
+	/**
+	 * Return the running task status most recent.
+	 *  
+	 * @return
+	 */
+	public TaskStatus getRunningTaskStatusMostRecent();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatusManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/DefaultTaskStatusManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/DefaultTaskStatusManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/DefaultTaskStatusManager.java	(revision 1235)
@@ -0,0 +1,137 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task.impl;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.gvsig.tools.observer.ObservableHelper;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.TaskStatusManager;
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class DefaultTaskStatusManager implements TaskStatusManager {
+
+	private static final int MAXTASKS_TO_AUTOREMOVE = 15;
+
+	private static long codeCounter = 1;
+
+	private Map tasksStatus = null;
+	private ObservableHelper observers = null;
+
+	public DefaultTaskStatusManager() {
+		this.tasksStatus = new LinkedHashMap();
+		this.observers = new ObservableHelper();
+	}
+
+	synchronized public void add(TaskStatus taskStatus) {
+		this.tasksStatus.put(taskStatus.getCode(), taskStatus);
+		this.update(taskStatus);
+	}
+
+	synchronized public TaskStatus get(String code) {
+		return (TaskStatus) (this.tasksStatus.get(code));
+	}
+
+	synchronized public void remove(String code) {
+		this.tasksStatus.remove(code);
+		this.update((TaskStatus) this.tasksStatus.get(code));
+	}
+
+	synchronized public void remove(TaskStatus taskStatus) {
+		this.tasksStatus.remove(taskStatus.getCode());
+		this.update(null);
+	}
+
+	public String getNewCode() {
+		return Long.toBinaryString(codeCounter++);
+	}
+
+	synchronized public Map getAll() {
+		return Collections.unmodifiableMap(this.tasksStatus);
+	}
+
+	synchronized public void addObserver(Observer o) {
+		this.observers.addObserver(o);
+	}
+
+	synchronized public void deleteObserver(Observer o) {
+		this.observers.deleteObserver(o);
+	}
+
+	synchronized public void deleteObservers() {
+		this.observers.deleteObservers();
+	}
+
+	synchronized public void update(TaskStatus taskstatus) {
+		if (taskstatus != null
+				&& this.tasksStatus.get(taskstatus.getCode()) == null) {
+			// This TaskStatus not is registered in this manager.
+			return;
+		}
+		this.observers.notifyObservers(this, taskstatus);
+		if (taskstatus != null) {
+			if (!taskstatus.isRunning()) {
+				if (taskstatus instanceof SimpleTaskStatus) {
+					if (((SimpleTaskStatus) taskstatus).getAutoRemove()) {
+						if (this.tasksStatus.size() > MAXTASKS_TO_AUTOREMOVE) {
+							((SimpleTaskStatus) taskstatus).remove();
+						}
+					}
+				}
+			}
+		}
+	}
+
+	public SimpleTaskStatus creteDefaultSimpleTaskStatus(String tittle) {
+        return createDefaultSimpleTaskStatus(tittle);
+    }
+
+    public SimpleTaskStatus createDefaultSimpleTaskStatus(String title) {
+        return new BaseTaskStatus(title);
+	}
+
+	synchronized public TaskStatus getRunningTaskStatusMostRecent() {
+		TaskStatus mostRecent = null;
+		Iterator taskStatusIterator = this.tasksStatus.values().iterator();
+		while( taskStatusIterator.hasNext() ) {
+			TaskStatus current = (TaskStatus) taskStatusIterator.next();
+			if ( current.isRunning() ) {
+				if( mostRecent==null || current.getLastModification().compareTo(mostRecent.getLastModification())>0 ) {
+					mostRecent = current;
+				}
+			}
+		}
+		return mostRecent;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/DefaultTaskStatusManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/BaseTaskStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/BaseTaskStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/BaseTaskStatus.java	(revision 1235)
@@ -0,0 +1,316 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task.impl;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.observer.ObservableHelper;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.gvsig.tools.task.TaskStatusManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class BaseTaskStatus implements SimpleTaskStatus {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(BaseTaskStatus.class);
+
+    protected class SubtaskValues {
+		long minValue = 0;
+        long maxValue = 0;
+        long curValue = 0;
+        String message = null;
+        
+        public Object clone() {
+        	SubtaskValues other = new SubtaskValues();
+        	other.curValue = this.curValue;
+        	other.maxValue = this.maxValue;
+        	other.minValue = this.minValue;
+        	other.message = this.message;
+        	return other;
+        }
+    }
+    
+    protected Date lastModification = null;
+
+    protected SubtaskValues values;
+    protected List subtaskStack = null ;
+    
+    protected String title = null;
+    protected String code = null;
+    
+    protected boolean isCancelled = false;
+    protected boolean isAbortedByError = false;
+    protected boolean isRunning = true;
+    
+    protected TaskStatusManager manager = null;
+
+	protected boolean isCancellable;
+
+	protected boolean isCancellationRequested;
+
+	protected ObservableHelper observers = null;
+
+	protected boolean autoremove;
+
+    private long startMillis;
+    
+    public BaseTaskStatus(String title) {
+    	this.manager =  ToolsLocator.getTaskStatusManager();
+    	this.autoremove = true;
+        this.title = title;
+        this.values = new SubtaskValues();
+        this.isCancelled = false;
+        this.isAbortedByError = false;
+        this.isRunning = true;
+        this.isCancellable = false;
+        this.isCancellationRequested = false;
+        this.code = this.manager.getNewCode();
+        this.observers = new ObservableHelper();
+        this.touch();
+    }
+    
+    public BaseTaskStatus(String tittle, long minValue, long maxValue) {
+    	this(tittle);
+        this.values.minValue = minValue;
+        this.values.maxValue = maxValue;
+    }
+    
+    public void setRangeOfValues(long min, long max) {
+        this.values.minValue = min;
+        this.values.maxValue = max;
+    }
+    
+    protected void touch() {
+    	Date now = new Date(); 
+    	if( this.lastModification!=null && (now.getTime() - this.lastModification.getTime()) > 2000 ) {
+    		this.values.message = null;
+    	}
+        this.lastModification = now;
+        this.manager.update(this);
+        this.observers.notifyObservers(this, null);
+    }
+    
+    public Date getLastModification() {
+    	return this.lastModification;
+    }
+    
+    public void message(String message) {
+    	this.values.message = message;
+    	this.touch();
+    }
+    
+    public String getTitle() {
+        return this.title;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public void setCurValue(long value) {
+        this.values.curValue = value;
+        this.touch();
+    }
+    
+    public int getCompleted() {
+        if( !this.isRunning ) {
+            return 100;
+        }
+        if( this.values.maxValue == this.values.minValue ) {
+        	// No se puede calcular ya que no se ha indicado el numero de elementos
+        	// sobre los que se esta trabajando, asi que devoobemos el 100%.
+        	return 100;
+        }
+        try {
+            return (int) (((this.values.curValue-this.values.minValue)*100)/(this.values.maxValue-this.values.minValue));
+        } catch( Exception e) {
+            return 100;
+        }
+    }
+
+    public String getLabel() {
+    	String progress;
+    	
+        if( this.values.maxValue == this.values.minValue ) {
+        	// No se puede calcular ya que no se ha indicado el numero de elementos
+        	// sobre los que se esta trabajando.
+        	if( this.values.curValue > 0 ) {
+        		progress = " (" + this.values.curValue + ")";
+        	} else {
+        		progress = "";
+        	}
+        } else {
+            progress = " (" + (this.values.curValue-this.values.minValue) + " / " + (this.values.maxValue-this.values.minValue) + ")" ;
+        }
+    	if( this.values.message == null ) {
+            return progress;
+    	} else {
+            return this.values.message + progress;
+    	}
+    }
+
+    public void terminate() {
+    	if( !isRunning ) {
+    		return;
+    	}
+        this.isRunning = false;
+        if (LOG.isDebugEnabled()) {
+            long endMillis = System.currentTimeMillis();
+            LOG.debug("Terminated status {} execution in {} ms", getTitle(),
+                new Long(endMillis - startMillis));
+        }
+        this.touch();
+    }
+    
+    public void cancel() {
+    	if( !isRunning ) {
+    		return;
+    	}
+        this.isCancelled = true;
+        this.isRunning = false;
+        this.touch();
+    }
+
+    public void abort() {
+    	if( !isRunning ) {
+    		return;
+    	}
+        this.isAbortedByError = true;
+        this.isRunning = false;
+        this.touch();
+    }
+    
+    public boolean isCancelled() {
+        return this.isCancelled;
+    }
+
+    public boolean isAborted() {
+        return this.isAbortedByError;
+    }
+
+    public boolean isRunning() {
+        return this.isRunning;
+    }
+
+	public TaskStatusManager getManager() {
+		return this.manager;
+	}
+
+	public boolean isIndeterminate() {
+		return this.values.minValue == this.values.maxValue;
+	}
+
+	public void add() {
+		this.manager.add(this);
+        if (LOG.isDebugEnabled()) {
+            startMillis = System.currentTimeMillis();
+        }
+	}
+
+	public void remove() {
+		this.manager.remove(this);
+	}
+
+	public boolean isCancellable() {
+		return this.isCancellable;
+	}
+
+	public void setCancellable(boolean cancellable) {
+		this.isCancellable = cancellable;
+	}
+
+	synchronized public boolean isCancellationRequested() {
+		return this.isCancellationRequested;
+	}
+
+	synchronized public void cancelRequest() {
+		this.isCancellationRequested = true;
+	}
+
+	synchronized public void addObserver(Observer o) {
+		this.observers.addObserver(o);
+	}
+
+	synchronized public void deleteObserver(Observer o) {
+		this.observers.deleteObserver(o);
+	}
+
+	synchronized public void deleteObservers() {
+		this.observers.deleteObservers();
+	}
+
+	public void setTittle(String tittle) {
+        setTitle(tittle);
+    }
+
+    public void setTitle(String title) {
+        if (this.title != null) {
+            return;
+        }
+        this.title = title;
+    }
+
+	public void setAutoremove(boolean autoremove) {
+		this.autoremove = autoremove;
+	}
+
+	public boolean getAutoRemove() {
+		return this.autoremove;
+	}
+
+	public void push() {
+		if( this.subtaskStack == null ) {
+			this.subtaskStack = new ArrayList();
+		}
+		this.subtaskStack.add(0, this.values);
+		this.values = (SubtaskValues) this.values.clone();
+	}
+
+	public void pop() {
+		if( this.subtaskStack == null && this.subtaskStack.isEmpty() ) {
+			return;
+		}
+		this.values = (SubtaskValues) this.subtaskStack.get(0);
+		this.subtaskStack.remove(0);
+		touch();
+	}
+
+	public void setIndeterminate() {
+		this.values.maxValue = 0;
+		this.values.minValue = 0;
+		this.values.curValue = 0;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/impl/BaseTaskStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractMonitorableTask.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractMonitorableTask.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractMonitorableTask.java	(revision 1235)
@@ -0,0 +1,84 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+import org.gvsig.tools.ToolsLocator;
+
+/**
+ * 
+ * @author jjdelcerro
+ *
+ * Abstract class for tasks, threads, that implements the interface MonitorableTask.  
+ * This handle the status of the cancelationRequest flag and TaskStatus. 
+ * 
+ * See http://blog.gvsig.org/2012/08/07/hilos-y-gvsig-1
+ */
+public class AbstractMonitorableTask extends AbstractCancellableTask  implements MonitorableTask{
+
+	protected SimpleTaskStatus taskStatus = null;
+	
+	protected AbstractMonitorableTask(String taskName, boolean autoAddTaskStatus) {
+		super();
+		if( taskName != null ) {
+			super.setName(taskName);
+		}
+		TaskStatusManager manager = ToolsLocator.getTaskStatusManager();
+        this.taskStatus = manager.createDefaultSimpleTaskStatus(taskName);
+        if( autoAddTaskStatus ) {
+        	this.taskStatus.add();
+        }
+	}
+	
+	protected AbstractMonitorableTask(String taskName) {
+		this(taskName, true);
+	}
+	
+	protected AbstractMonitorableTask(boolean autoAddTaskStatus) {
+		this(null, autoAddTaskStatus);
+	}
+	
+	protected AbstractMonitorableTask() {
+		this(null, true);
+	}
+	
+	public void setTaskName(String name) {
+		super.setName(name);
+		this.taskStatus.setTitle(name);
+	}
+	
+	public TaskStatus getTaskStatus() {
+		return this.taskStatus;
+	}
+	
+	protected SimpleTaskStatus getSimpleTaskStatus() {
+		return this.taskStatus;
+	}
+	
+	public void cancelRequest() {
+		super.cancelRequest();
+		this.taskStatus.cancelRequest();
+	}
+	
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/AbstractMonitorableTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/Cancellable.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/Cancellable.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/Cancellable.java	(revision 1235)
@@ -0,0 +1,63 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ */
+package org.gvsig.tools.task;
+
+/**
+ * <p><code>Cancellable</code> interface is designed for adding support to notify that a task must be cancelled.</p>
+ * 
+ * <p>This is useful if a process is hung up, blocking, or simply if user wants cancel it, for instance, a
+ *  drawing process of a heavy layer.</p>
+ * 
+ * <p>The classes which implement this interface are force to share the canceling information, in order to be
+ *  notified about the current status of it. This implies a synchronous canceling process, that could be implemented by
+ *  another object.</p>
+ *  
+ *  @deprecated Use CancellableTask
+ */
+public interface Cancellable {
+	/**
+	 * <p>Determines if the related task must be canceled.</p>
+	 * 
+	 * @return <code>true</code> if task must been canceled; otherwise <code>false</code>
+	 * 
+	 * @see #setCanceled(boolean)
+	 * 
+     * @deprecated Use CancellableTask.isCancellationRequested
+	 */
+	boolean isCanceled();
+
+	/**
+	 * <p>Sets if the related task must be canceled.</p>
+	 * 
+	 * @param canceled <code>true</code> if the task must be canceled; otherwise <code>false</code>
+	 * 
+	 * @see #isCanceled()
+	 * 
+     * @deprecated Use CancellableTask.cancelRequest
+	 */
+	void setCanceled(boolean canceled);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/RunnableWithParameters.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/RunnableWithParameters.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/RunnableWithParameters.java	(revision 1235)
@@ -0,0 +1,65 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public abstract class RunnableWithParameters implements Runnable {
+	protected List parameters = null;
+	protected Object returnValue;
+
+	public RunnableWithParameters() {
+		this.parameters = null;
+	}
+
+	public RunnableWithParameters(Object[] parameters) {
+		this.parameters = Arrays.asList(parameters);
+	}
+
+	public void setParameters(Object[] parameters) {
+		this.parameters = Arrays.asList(parameters);
+	}
+	
+	public List getParameters() {
+		if( this.parameters == null ) {
+			this.parameters = new ArrayList();
+		}
+		return parameters;
+	}
+	
+	public RunnableWithParameters add(Object paramter) {
+		this.getParameters().add(paramter);
+		return this;
+	}
+	
+	public Object get(int index) {
+		return this.parameters.get(index);
+	}
+	
+	public Object getReturnValue() {
+		return this.returnValue;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/RunnableWithParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatus.java	(revision 1235)
@@ -0,0 +1,118 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+import java.util.Date;
+
+import org.gvsig.tools.observer.Observable;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public interface TaskStatus extends CancellableTask, Observable {
+
+    /**
+     * Get the title associated to the task of this TaskStatus
+     * 
+     * @return the task title
+     */
+    public String getTitle();
+    
+    /**
+     * Gte the code of this TaskStatus.
+     * 
+     * @return code of task
+     */
+    public String getCode();
+
+    /**
+     * Retorna el porcentaje de completitud de la tarea asociada 
+     * a este TaskStatus. 
+     * 
+     * @return el porcentaje de completitud.
+     */
+    public int getCompleted();
+    
+    /**
+     * Get a label that represent the status of the task
+     * 
+     * @return
+     */
+    public String getLabel();
+    
+    /**
+     * Return true if the task has cancelled by the
+     * user or another task.
+     * 
+     * @return
+     */
+    public boolean isCancelled();
+    
+    /**
+     * Return true if the task has terminated with errors.
+     * 
+     * @return
+     */
+    public boolean isAborted();
+    
+    /**
+     * Return true if the task is running.
+     * 
+     * @return
+     */
+    public boolean isRunning();
+    
+    /**
+     * Returns date of last modificaction of status.
+     *  
+     * @return
+     */
+    public Date getLastModification();
+    
+    /**
+     * Return the TaskStatusManager associated to this TaskStatus.
+     * 
+     * @return the TaskStatusManager
+     */
+    public TaskStatusManager getManager();
+    
+    /**
+     * Return true if the completion of this task
+     * can't calculate.
+     * 
+     * @return 
+     */
+    public boolean isIndeterminate();
+    
+    /**
+     * Return true if the task associated to this
+     * TaskStatus can be canceled.
+     * @return
+     */
+    public boolean isCancellable();
+    
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/TaskStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/CancellableTask.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/CancellableTask.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/CancellableTask.java	(revision 1235)
@@ -0,0 +1,36 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.task;
+
+public interface CancellableTask {
+	/**
+	 * Return true if has request to cancel to the task.
+	 */
+	boolean isCancellationRequested();
+
+	/**
+	 * Request to the task that cancel.
+	 */
+	void cancelRequest();
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/task/CancellableTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueMatch.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueMatch.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueMatch.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+public class EvaluatorFieldValueMatch extends EvaluatorFieldValue {
+
+	private Object value;
+
+	EvaluatorFieldValueMatch(String fieldName, Object value) {
+		super(fieldName, MATCH);
+		this.value = value;
+	}
+
+	/**
+	 * Get the value to mach.
+	 *
+	 * @return the match value or null if not aplicable.
+	 */
+	public Object getValue() {
+		return this.value;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueRange.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueRange.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueRange.java	(revision 1235)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+public class EvaluatorFieldValueRange extends EvaluatorFieldValue {
+
+
+	private Object value1;
+	private Object value2;
+
+	EvaluatorFieldValueRange(String fieldName, Object value1,
+			Object value2) {
+		super(fieldName, RANGE);
+		this.value1 = value1;
+		this.value1 = value2;
+	}
+
+	/**
+	 * Get the initial value used in the range operation.
+	 *
+	 * @return the first value or null if not aplicable.
+	 */
+	public Object getValue1() {
+		return this.value1;
+	}
+
+	/**
+	 * Get the final value used in the range operation.
+	 *
+	 * @return the final value or null if not aplicable.
+	 */
+	public Object getValue2() {
+		return this.value2;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorException.java	(revision 1235)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+
+public class EvaluatorException extends BaseException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7636817907827177835L;
+	private final static String MESSAGE_FORMAT = "Evaluator Error.";
+	private final static String MESSAGE_KEY = "_OperationException";
+
+	protected Map values = new HashMap();
+
+	public EvaluatorException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+
+
+	public EvaluatorException(String message, Throwable cause, String key, long code) {
+	    super(message, cause, key, code);
+	}
+
+
+	protected void setValue(String name, Object value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/Evaluator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/Evaluator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/Evaluator.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+/**
+ * This interface provides the necessary methods for processing CQL expressions.
+ *
+ *
+ */
+public interface Evaluator {
+
+	/**
+	 * Evaluate with the data passed as parameter.
+	 *
+	 * @param data
+	 * @return the result of the evaluation.
+	 * 
+	 * @throws EvaluatorException if an issue is found while evaluating.
+	 * The subclass {@link EvaluatorParseException} is used to indicate
+	 * a problem while parsing (malformed expression) rather than a
+	 * problem while evaluating.
+	 * 
+	 */
+	public Object evaluate(EvaluatorData data) throws EvaluatorException;
+
+	/**
+	 * Get the symbolic name of the evaluator.
+	 *
+	 * @return evaluator's name
+	 */
+	public String getName();
+
+	/**
+	 * Get a description of the action performed with the evaluator.
+	 *
+	 * @return evaluator's description
+	 */
+	public String getDescription();
+
+	/**
+	 * Get a SQL representation of the evaluator.
+	 * 
+	 * @return the SQL string or null if not supported.
+	 */
+	public String getSQL();
+
+	/**
+	 * Get information about fiels used in the evaluator.
+	 * 
+	 * @return
+	 */
+	public EvaluatorFieldsInfo getFieldsInfo();
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValue.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValue.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValue.java	(revision 1235)
@@ -0,0 +1,66 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+public class EvaluatorFieldValue {
+
+	final public static int GENERIC = 0;
+	final public static int MATCH = 1;
+	final public static int RANGE = 2;
+	final public static int NEAREST = 3;
+
+	private int type;
+	private String fieldName;
+
+
+	EvaluatorFieldValue(String fieldName) {
+		this(fieldName, GENERIC);
+	}
+
+	EvaluatorFieldValue(String fieldName, int type) {
+		this.fieldName = fieldName;
+		this.type = type;
+	}
+
+	/**
+	 * Get the type of operation realiced over the field.
+	 *
+	 * The posibles values are: MATCH RANGE or NEAREST
+	 *
+	 * @return an int with the type of operation
+	 */
+	public int getType() {
+		return this.type;
+	}
+
+	/**
+	 * Get the fieldName over the operation is realiced.
+	 *
+	 * @return String name of field.
+	 */
+	public String getFieldName() {
+		return this.fieldName;
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AndEvaluator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AndEvaluator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AndEvaluator.java	(revision 1235)
@@ -0,0 +1,84 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * <p>
+ * This evaluator is a set of evaluators that are applied used the and
+ * operator. It means that the evaluate method only returns <code>true</code>
+ * if all the evaluators return <code>true</code>.  
+ * </p>
+ * <p>
+ * A condition to use this type of evaluators is that the evaluate method
+ * of all the single evaluators has to return a boolean value.
+ * </p>
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class AndEvaluator extends AbstractEvaluator{
+    private List evaluators = new ArrayList();    
+
+    public AndEvaluator(Evaluator evaluator) {
+        super();         
+        addEvaluator(evaluator);    
+    }
+
+    public Object evaluate(EvaluatorData data) throws EvaluatorException {
+        for (int i=0 ; i<evaluators.size() ; i++){
+            Evaluator evaluator = (Evaluator)evaluators.get(i);
+            if (!((Boolean)evaluator.evaluate(data)).booleanValue()){
+                return Boolean.FALSE;
+            }
+        }
+        return Boolean.TRUE;
+    }
+
+    public String getName() {       
+        return "a set of evaluators";
+    }
+
+    public void addEvaluator(Evaluator evaluator){
+        if (evaluator != null){
+            evaluators.add(evaluator);
+        }
+    }
+
+    public String getSQL() {       
+        if (evaluators.size() > 0){
+            StringBuffer stringBuffer = new StringBuffer(((Evaluator)evaluators.get(0)).getSQL());
+            for (int i=1 ; i<evaluators.size() ; i++){
+                stringBuffer.append(" and " + ((Evaluator)evaluators.get(i)).getSQL());
+            }
+            return stringBuffer.toString();
+        }else{
+            return "";
+        }
+    }   
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AndEvaluator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueNearest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueNearest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldValueNearest.java	(revision 1235)
@@ -0,0 +1,75 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+public class EvaluatorFieldValueNearest extends EvaluatorFieldValue {
+
+	private int count;
+	private Object tolerance;
+	private Object value1;
+
+	EvaluatorFieldValueNearest(String fieldName, int count,
+			Object tolerance,
+			Object value) {
+		super(fieldName, NEAREST);
+		this.count = count;
+		this.tolerance = tolerance;
+		this.value1 = value;
+	}
+
+	EvaluatorFieldValueNearest(String fieldName, int count, Object value) {
+		super(fieldName, NEAREST);
+		this.count = count;
+		this.tolerance = null;
+		this.value1 = value;
+	}
+
+
+	/**
+	 * Get the count used in the nearest operation.
+	 *
+	 * @return the count or -1 if not aplicable.
+	 */
+	public int getCount() {
+		return this.count;
+	}
+
+	/**
+	 * Get the tolerance.
+	 *
+	 * @return the tolerance or -1 if not aplicable.
+	 */
+	public Object getTolerance() {
+		return this.tolerance;
+	}
+
+	/**
+	 * Get the value.
+	 *
+	 * @return the match value or null if not aplicable.
+	 */
+	public Object getValue() {
+		return this.value1;
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldsInfo.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldsInfo.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorFieldsInfo.java	(revision 1235)
@@ -0,0 +1,88 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public final class EvaluatorFieldsInfo {
+	private Map fields = new HashMap();
+	private String[] names = null;
+
+	public String[] getFieldNames() {
+		if (names == null) {
+			Set namesSet = fields.keySet();
+            names = (String[]) namesSet.toArray(new String[namesSet.size()]);
+		}
+		return names;
+	}
+
+	public EvaluatorFieldValue[] getFieldValues(String name) {
+        List values = (List) this.fields.get(name);
+        return values == null ? null : (EvaluatorFieldValue[]) values
+            .toArray(new EvaluatorFieldValue[values.size()]);
+	}
+
+	public void addFieldValue(String name) {
+		EvaluatorFieldValue field = new EvaluatorFieldValue(name);
+		this.addFieldValue(field);
+	}
+
+	public void addMatchFieldValue(String name, Object value) {
+		EvaluatorFieldValue field = new EvaluatorFieldValueMatch(name, value);
+		this.addFieldValue(field);
+	}
+
+	public void addRangeFieldValue(String name, Object value1, Object value2) {
+		EvaluatorFieldValue field = new EvaluatorFieldValueRange(name, value1,
+				value2);
+		this.addFieldValue(field);
+	}
+
+	public void addNearestFieldValue(String name, int count, Object value) {
+		EvaluatorFieldValue field = new EvaluatorFieldValueNearest(name, count,
+				value);
+		this.addFieldValue(field);
+	}
+
+	public void addNearestFieldValue(String name, int count, Object tolerance,Object value) {
+		EvaluatorFieldValue field = new EvaluatorFieldValueNearest(name, count,
+				tolerance,
+				value);
+		this.addFieldValue(field);
+	}
+
+	private void addFieldValue(EvaluatorFieldValue field) {
+		List list = (List) this.fields.get(field.getFieldName());
+		if (list == null) {
+			this.names = null;
+			list = new ArrayList();
+			this.fields.put(field.getFieldName(), list);
+		}
+		list.add(field);
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorWithDescriptions.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorWithDescriptions.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorWithDescriptions.java	(revision 1235)
@@ -0,0 +1,80 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+
+/**
+ * 
+ * Extends the Evaluator interface to provide descriptions
+ * of available functions and operators
+ * 
+ * @see Evaluator
+ * 
+ * @author jldominguez
+ *
+ */
+public interface EvaluatorWithDescriptions extends Evaluator {
+    
+    /**
+     * 
+     * This interface provide methods to describe a function
+     * or operator supported by a evaluator
+     * 
+     * @see Evaluator
+     * 
+     * @author jldominguez
+     *
+     */
+    public interface Description {
+        
+        public String getName();
+        public String getDescription();
+        public String getTemplate();
+        
+        public static final int DATATYPE_CATEGORY_ALL = 0; // 00000
+        public static final int DATATYPE_CATEGORY_NUMBER = 1; // 00001
+        public static final int DATATYPE_CATEGORY_STRING = 2; // 00010
+        public static final int DATATYPE_CATEGORY_DATETIME = 4; // 00100
+        public static final int DATATYPE_CATEGORY_BOOLEAN = 8; // 01000
+        public static final int DATATYPE_CATEGORY_GEOMETRY = 16; // 10000
+
+        /**
+         * Returns an integer using flags:
+         *  1 => 0001 => only numerical
+         *  2 => 0010 => only string
+         *  3 => 0011 => numerical and string
+         *  etc
+         *  
+         * @see EvaluatorData
+         * @return
+         */
+        public int getDataTypeCategories();
+        
+    }
+    
+    public Description[] getAvailableOperators();
+    
+    public Description[] getAvailableFunctions();
+    
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AbstractEvaluator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AbstractEvaluator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/AbstractEvaluator.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+
+public abstract class AbstractEvaluator implements Evaluator {
+	private EvaluatorFieldsInfo fieldsInfo = new EvaluatorFieldsInfo();
+
+	public String getDescription() {
+		return "";
+	}
+
+	public String getSQL() {
+		return null;
+	}
+
+	public EvaluatorFieldsInfo getFieldsInfo() {
+		return fieldsInfo;
+	}
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorData.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorData.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorData.java	(revision 1235)
@@ -0,0 +1,41 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+import java.util.Iterator;
+
+public interface EvaluatorData {
+
+	public Object getDataValue(String name);
+
+	public Object getContextValue(String name);
+
+	public Iterator getDataValues();
+
+	public Iterator getDataNames();
+
+	public boolean hasDataValue(String name);
+
+	public boolean hasContextValue(String name);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorParseException.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorParseException.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/evaluator/EvaluatorParseException.java	(revision 1235)
@@ -0,0 +1,47 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.evaluator;
+
+
+/**
+ * 
+ * This class is used to indicate that the problem
+ * found by the evaluator has to do with the parsing process
+ * (malformed expression) rather than a problem with the values.
+ * 
+ * @author jldominguez
+ *
+ */
+public class EvaluatorParseException extends EvaluatorException {
+    
+    private static final long serialVersionUID = 4061296892696703517L;
+    private final static String MESSAGE_FORMAT = "Evaluator Parse Error.";
+    private final static String MESSAGE_KEY = "_ParseException";
+    
+    public EvaluatorParseException(Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+    }
+
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/javadoc/overview.html
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/javadoc/overview.html	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/javadoc/overview.html	(revision 1235)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+<!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.tools.lib package documentation</title>
+</head>
+<body>
+
+	<p>TODO: Example library overview.</p>
+	
+	<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p>
+
+</body>
+</html>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/persistence/xml/persistentState_base.xsd
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/persistence/xml/persistentState_base.xsd	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/persistence/xml/persistentState_base.xsd	(revision 1235)
@@ -0,0 +1,386 @@
+<?xml version="1.0"?>
+<!--
+
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://www.gvsig.org/libTools"	
+	xmlns:tools="http://www.gvsig.org/libTools"
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+    elementFormDefault="unqualified"
+    attributeFormDefault="unqualified"
+>
+
+<xs:simpleType name="stateTypeId">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="String"/>
+      <xs:enumeration value="ObjectReference"/>
+      <xs:enumeration value="Boolean"/>
+      <xs:enumeration value="Integer"/>
+      <xs:enumeration value="List"/>
+      <xs:enumeration value="Set"/>
+      <xs:enumeration value="Map"/>
+      <xs:enumeration value="Double"/>
+      <xs:enumeration value="Long"/>
+      <xs:enumeration value="Float"/>
+      <xs:enumeration value="Date"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_String">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="String"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_ObjectReference">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="ObjectReference"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Boolean">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Boolean"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+
+<xs:simpleType name="stateTypeId_Integer">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Integer"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+
+<xs:simpleType name="stateTypeId_List">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="List"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Set">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Set"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Map">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Map"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Double">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Double"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Long">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Long"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Float">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Float"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="stateTypeId_Date">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="Date"/>
+      <xs:enumeration value="null"/>
+    </xs:restriction>
+</xs:simpleType>
+
+
+<xs:simpleType name="xml_persistence_version">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[0-9]*[.][0-9]*[.][0-9]*"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="boolean" xmlns="http://www.gvsig.org/libTools">
+    <xs:restriction base="xs:NMTOKEN">
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+    </xs:restriction>
+</xs:simpleType>
+
+
+<xs:complexType name="state_attribute">	
+	<xs:attribute name="type" type="tools:stateTypeId"/>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Null" mixed="true">
+	<xs:attribute name="type" type="tools:stateTypeId" fixed="null"/>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Integer">
+	<xs:simpleContent>
+		<xs:extension base="xs:integer">
+			<xs:attribute name="type" type="tools:stateTypeId_Integer" />
+		</xs:extension>
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Integer_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:integer">
+			<xs:attribute name="type" type="tools:stateTypeId_Integer" fixed="Integer"/>
+		</xs:extension>
+	</xs:simpleContent>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Long">
+	<xs:simpleContent>
+		<xs:extension base="xs:long">
+			<xs:attribute name="type" type="tools:stateTypeId_Long"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Long_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:long">
+			<xs:attribute name="type" type="tools:stateTypeId_Long" fixed="Long"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Date">
+	<xs:simpleContent>
+		<xs:extension base="xs:long">
+			<xs:attribute name="type" type="tools:stateTypeId_Date"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Date_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:long">
+			<xs:attribute name="type" type="tools:stateTypeId_Date" fixed="Date"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Float">
+	<xs:simpleContent>
+		<xs:extension base="xs:float">
+			<xs:attribute name="type" type="tools:stateTypeId_Float" />
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Float_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:float">
+			<xs:attribute name="type" type="tools:stateTypeId_Float" fixed="Float"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Double">
+	<xs:simpleContent>
+		<xs:extension base="xs:double">
+			<xs:attribute name="type" type="tools:stateTypeId_Double"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Double_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:double">
+			<xs:attribute name="type" type="tools:stateTypeId_Double" fixed="Double"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Boolean">
+	<xs:simpleContent>
+		<xs:extension base="tools:boolean">
+			<xs:attribute name="type" type="tools:stateTypeId_Boolean"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Boolean_notNull">
+	<xs:simpleContent>
+		<xs:extension base="tools:boolean">
+			<xs:attribute name="type" type="tools:stateTypeId_Boolean" fixed="Boolean"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_String">
+	<xs:simpleContent>
+		<xs:extension base="xs:string">
+			<xs:attribute name="type" type="tools:stateTypeId_String"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_String_notNull">
+	<xs:simpleContent>
+		<xs:extension base="xs:string">
+			<xs:attribute name="type" type="tools:stateTypeId_String" fixed="String"/>
+		</xs:extension>		
+	</xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_List">
+	<xs:sequence>
+		<xs:element name="listItem" type="tools:state_attribute" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_List"/>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_List_notNull">
+	<xs:sequence>
+		<xs:element name="listItem" type="tools:state_attribute" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_List" fixed="List"/>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Set">
+	<xs:sequence>
+		<xs:element name="setItem" type="tools:state_attribute" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_Set"/>
+</xs:complexType>
+
+
+<xs:complexType name="state_attribute_Set_notNull">
+	<xs:sequence>
+		<xs:element name="setItem" type="tools:state_attribute" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_Set" fixed="Set"/>
+</xs:complexType>
+
+
+<xs:complexType name="mapItem">
+	<xs:all>
+		<xs:element name="key" type="tools:state_attribute"/>
+		<xs:element name="value" type="tools:state_attribute"/>
+	</xs:all>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Map">
+	<xs:sequence>		
+		<xs:element name="mapItem" type="tools:mapItem" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_Map"/>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_Map_notNull">
+	<xs:sequence>		
+		<xs:element name="mapItem" type="tools:mapItem" maxOccurs="unbounded"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_Map" fixed="Map"/>
+</xs:complexType>
+
+<xs:attributeGroup name="xlink_attributes">
+	<xs:attribute name="type" xmlns="http://www.w3.org/1999/xlink" type="xs:string" fixed="simple" use="required"/>
+	<xs:attribute name="href" xmlns="http://www.w3.org/1999/xlink" use="required">
+		<xs:simpleType>
+			<xs:restriction base="xs:string">
+				<xs:pattern value="states[#]id[(]['][0-9]*['][)]"/>
+			</xs:restriction>
+		</xs:simpleType>
+	</xs:attribute>
+</xs:attributeGroup>
+
+<xs:complexType name="objectReference">
+	<xs:attribute name="id_state" type="xs:integer"/>
+	<xs:attributeGroup ref="tools:xlink_attributes"/>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_ObjectReference">
+	<xs:all>		
+		<xs:element name="reference" type="tools:objectReference"/>
+	</xs:all>
+	<xs:attribute name="type" type="tools:stateTypeId_ObjectReference"/>
+</xs:complexType>
+
+<xs:complexType name="state_attribute_ObjectReference_notNull">
+	<xs:sequence>		
+		<xs:element name="reference" type="tools:objectReference" maxOccurs="1" minOccurs="1"/>
+	</xs:sequence>
+	<xs:attribute name="type" type="tools:stateTypeId_ObjectReference" fixed="ObjectReference"/>
+</xs:complexType>
+
+
+ 
+<xs:attributeGroup name="state_attributes">
+	<xs:attribute name="id" type="xs:integer" use="required"/>
+</xs:attributeGroup>
+
+ 
+<xs:element name="XMLPersitence">
+  <xs:complexType>
+    <xs:all>
+    
+      <xs:element name="persistence_xml_version" type="tools:xml_persistence_version" 
+      		minOccurs="1" maxOccurs="1"/>
+      <xs:element name="rootState" minOccurs="1" maxOccurs="1">
+        <xs:complexType>
+		  <xs:attribute name="id_state" type="xs:integer" use="required"/>
+		  <xs:attributeGroup ref="tools:xlink_attributes"/>
+		</xs:complexType>
+      </xs:element>
+      <xs:element name="states">
+      	<xs:complexType>
+      		<xs:sequence>
+      			<xs:any minOccurs="1" maxOccurs="unbounded"/>
+      		</xs:sequence>
+      	</xs:complexType>
+      </xs:element>
+      
+      
+    </xs:all>
+  </xs:complexType>
+</xs:element>
+</xs:schema>
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text.properties
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text.properties	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text.properties	(revision 1235)
@@ -0,0 +1,26 @@
+#
+# gvSIG. Desktop Geographic Information System.
+#
+# Copyright (C) 2007-2013 gvSIG Association.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+# For any additional information, do not hesitate to contact us
+# at info AT gvsig.com, or visit our website www.gvsig.com.
+#
+
+# Resource bundle texts for the Spanish language locale (es)
+Example.returns_value=devuelve el valor
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text_en.properties
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text_en.properties	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/org/gvsig/tools/lib/i18n/text_en.properties	(revision 1235)
@@ -0,0 +1,26 @@
+#
+# gvSIG. Desktop Geographic Information System.
+#
+# Copyright (C) 2007-2013 gvSIG Association.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+# For any additional information, do not hesitate to contact us
+# at info AT gvsig.com, or visit our website www.gvsig.com.
+#
+
+# Resource bundle texts for the English language locale (en)
+Example.returns_value=returns value
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/README.txt	(revision 1235)
@@ -0,0 +1,31 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+Put into this folder the resources needed by your library classes.
+
+This folder is added to the runtime classpath, so you can load any resources 
+through the ClassLoader.
+
+By default, into this folder you can find some examples of resource bundle 
+property files that may be used by your library classes.
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1,2 @@
+org.gvsig.tools.ToolsLibrary
+org.gvsig.tools.persistence.xml.XMLPersistenceLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/pom.xml	(revision 1235)
@@ -0,0 +1,83 @@
+<?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.tools.lib</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.lib</name>
+    <description>Tools related to application framework architecture
+	and implementations of design patterns</description>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools</artifactId>
+        <version>3.0.57</version>
+    </parent>
+    <dependencies>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+            <scope>compile</scope>
+            </dependency>
+
+        <dependency>
+            <groupId>easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.kxml</groupId>
+            <artifactId>kxml2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                </configuration>
+                <executions>
+                    <!-- Generates a jar file only with the test classes -->
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>animal-sniffer-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>check-java-api</id>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <configuration>
+                            <signature>
+                                <groupId>org.codehaus.mojo.signature</groupId>
+                                <artifactId>java15</artifactId>
+                                <version>1.0</version>
+                            </signature>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib/README.txt	(revision 1235)
@@ -0,0 +1,39 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+The project structure of this project is the following:
+
+Project
+|-pom.xml:   		Maven 2 configuration file.
+`-src
+  |-main:    		Project source code, resources and configuration
+  | |-java:  		Java source code
+  | |-resources:	Resources needed by the code (resource bundles, images, etc.)   
+  | `-javadoc:		Javadoc common resources	
+  `-test:    		Unit tests source code, resources and configuration
+    |-java:  		Unit tests java source code
+    `-resources:	Resources needed by the test code (resource bundles, images, etc.)   
+
+Look at the main folders for a README.txt file with more information on the 
+contents of each folder.
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.lib
___________________________________________________________________
Added: svn:ignore
   + .settings
target
.classpath
.project
bin


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringDynObjectComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringDynObjectComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringDynObjectComponentFactory.java	(revision 1235)
@@ -0,0 +1,81 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.jform;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceFactory;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponentFactory;
+import org.gvsig.tools.swing.spi.AbstractDynObjectFactory;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class StringDynObjectComponentFactory extends AbstractDynObjectFactory
+    implements ServiceFactory, JDynObjectComponentFactory {
+
+    private static final String SERVICE_NAME = "form.string";
+
+    public JDynObjectComponent createJDynObjectComponent(DynStruct definition, DynObject currentValue,
+			DynObjectModel model, boolean writable) throws ServiceException {
+		return new StringJDynObjectComponent(definition, currentValue, model, writable);
+    }
+
+    @Override
+    public String getFactoryDescription() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getFactoryName() {
+        return SERVICE_NAME;
+    }
+
+    @Override
+    public String getFactorySubType() {
+        return null;
+    }
+
+    @Override
+    public Integer getFactoryType() {
+        return 0;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringJDynObjectComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringJDynObjectComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/StringJDynObjectComponent.java	(revision 1235)
@@ -0,0 +1,198 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.serv.jform;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractDynObjectComponent;
+
+/**
+ * Simple {@link JDynObjectComponent} implementation which shows a
+ * {@link DynObject} as a String.
+ * <p>
+ * <strong>NOTE:</strong> initial dummy implementation to be replaced with a
+ * more complete one.
+ * </p>
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class StringJDynObjectComponent extends AbstractDynObjectComponent
+    implements JDynObjectComponent {
+
+    private static final long serialVersionUID = 5716325904557339463L;
+    private JPanel panel;
+
+    /**
+     * @param definition 
+     * @throws ServiceException
+     * @see JDynObjectView#JDynObjectView(DynObject).
+     */
+	public StringJDynObjectComponent(DynStruct definition, DynObject currentValue, DynObjectModel model,
+			boolean writable)
+        throws ServiceException {
+	    super();
+	    setModel(model);
+	    setDynField(definition);
+	    setDynObject(currentValue);
+        this.initUI();
+    }
+
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#
+     * addValueChangedListener
+     * (org.gvsig.tools.swing.api.dynobject.ValueChangedListener)
+     */
+    public void addValueChangedListener(ValueChangedListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+     */
+    public JComponent asJComponent() {
+        return panel;
+    }
+
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * org.gvsig.tools.swing.api.dynobject.ValueChangedListener#handleValueChanged
+     * (org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent)
+     */
+    public void handleValueChanged(JDynFieldComponent field) {
+        // TODO Auto-generated method stub
+
+    }
+//
+//    private boolean hasDynObject(){
+//        return this.getDynObject()!=null);
+//    }
+    
+    private void initUI() {
+        panel = new JPanel();
+        panel.setLayout(new BorderLayout());
+        JLabel label;
+        if (hasDynObject()){
+            label =
+                new JLabel("<html><pre>".concat(this.getDynObject().toString())
+                    .concat("</pre></html>"));
+            
+        }else{
+            label =
+                new JLabel("<html><pre>".concat(this.getDynField().toString())
+                    .concat("</pre></html>"));          
+        }
+        panel.add(label, BorderLayout.CENTER);
+    }
+
+    public void setValue(Object value) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void requestFocus() {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public Object getDefaultFieldValue() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DynField getDynField() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Object getFieldValue() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setFieldValue(Object value) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public Object getValue() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void setPrintValue(Object value) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String getPrintValue() {
+        return this.toString();
+    }
+
+    @Override
+    protected void addParametersFromModel() throws ServiceException {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void handleValueChanged(JDynFieldComponent jDynFieldComponent,
+        String errorMessage) {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+
+    public DynField getParentDynField() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/ToolsSwingDefaultDynObjectImplLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/ToolsSwingDefaultDynObjectImplLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/java/org/gvsig/tools/swing/serv/jform/ToolsSwingDefaultDynObjectImplLibrary.java	(revision 1235)
@@ -0,0 +1,56 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.jform;
+
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.ToolsSwingLibrary;
+import org.gvsig.tools.swing.spi.ToolsSwingServiceLocator;
+
+/**
+ * {@link Library} for the default tools swing implementation.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class ToolsSwingDefaultDynObjectImplLibrary extends AbstractLibrary {
+	
+	@Override
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsServiceOf(ToolsSwingLibrary.class);
+	}
+
+    @Override
+    protected void doInitialize() throws LibraryException {
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+        ServiceManager dsManager = ToolsSwingServiceLocator.getServiceManager();
+
+        dsManager.addServiceFactory(new StringDynObjectComponentFactory());              
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.swing.serv.jform.ToolsSwingDefaultDynObjectImplLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform/pom.xml	(revision 1235)
@@ -0,0 +1,11 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.serv.jform</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.serv.jform</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing.serv</artifactId>
+        <version>3.0.34-SNAPSHOT</version>
+    </parent>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jform
___________________________________________________________________
Added: svn:ignore
   + .settings
bin
target
.classpath
.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/pom.xml	(revision 1235)
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.serv.field</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.serv.field</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing.serv</artifactId>
+        <version>3.0.34-SNAPSHOT</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>net.sf</groupId>
+            <artifactId>flib-jcalendar</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDateDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDateDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDateDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,127 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.JDateCalendarDynFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class JDateDynFieldComponentFactory extends
+    AbstractJDynFieldComponentFactory implements JDynFieldComponentFactory {
+
+    private static final String FACTORY_DESCRIPTION = "";
+    private int type = DataTypes.DATE;
+    private String subType = DataTypes.SUBTYPE_DATE;
+
+    /**
+     * @param time
+     */
+    public JDateDynFieldComponentFactory() {
+        this.type = DataTypes.DATE;
+        this.subType = DataTypes.SUBTYPE_DATE;
+    }
+
+    /**
+     * @param time
+     */
+    public JDateDynFieldComponentFactory(int type, String subType) {
+        this.type = type;
+        this.subType = subType;
+    }
+
+    /**
+     * @param time
+     */
+    public JDateDynFieldComponentFactory(int type) {
+        this.type = type;
+        this.subType = null;
+    }
+
+	public JDynFieldComponent createJDynFieldComponent(DynField definition, ValueField parent,
+			boolean writable) throws ServiceException {
+		// TODO: take into account the writable flag
+		return new JDateCalendarDynFieldComponent(definition, parent, writable);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * 
+     * org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryDescription
+     * ()
+     */
+    @Override
+    public String getFactoryDescription() {
+        return FACTORY_DESCRIPTION;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#
+     * getFactorySubType()
+     */
+    @Override
+    public String getFactorySubType() {
+        return subType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#
+     * getFactoryType()
+     */
+    @Override
+    public Integer getFactoryType() {
+        if (this.type == 0) {
+            return DataTypes.DATE;
+        }
+        return this.type;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JBooleanDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JBooleanDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JBooleanDynFieldComponent.java	(revision 1235)
@@ -0,0 +1,214 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class JBooleanDynFieldComponent extends AbstractJDynFieldComponent
+    implements JDynFieldComponent, ActionListener {
+
+    private JRadioButton btTrue;
+    private JRadioButton btFalse;
+    private JRadioButton btUnknown;
+    private Boolean value;
+    private JPanel panel;
+    private ButtonGroup group;
+
+	/**
+	 * @param writable 
+	 * @param definition 
+	 * @param writable
+	 * @param dynField
+	 * @param value
+	 * @throws ServiceException
+	 */
+	public JBooleanDynFieldComponent(DynField definition, ValueField parent, boolean writable)
+        throws ServiceException {
+		super(definition, parent, writable);
+        if (parent.getDynField().isContainer()) {
+            this.btUnknown.setEnabled(false);
+        }
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        Object source = e.getSource();
+        if (source == btTrue) {
+            this.setValue(true);
+        } else
+            if (source == btFalse) {
+                this.setValue(false);
+            } else {
+                this.setValue(null);
+            }
+
+    }
+
+    @Override
+    protected void afterUI() {
+
+    }
+
+    public JComponent asJComponent() {
+        return panel;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    @Override
+    protected void initData() {
+
+    }
+
+    @Override
+    protected void initUI() {
+        // In initialization code:
+        // Create the radio buttons.
+        String txtTrue = this.translate("True");
+        String txtFalse = this.translate("False");
+        String txtUnkown = this.translate("Unknown");
+
+        btTrue = new JRadioButton(txtTrue);
+        btTrue.setMnemonic(KeyEvent.VK_T);
+        btTrue.setActionCommand(txtTrue);
+
+        btFalse = new JRadioButton(txtFalse);
+        btFalse.setMnemonic(KeyEvent.VK_F);
+        btFalse.setActionCommand(txtFalse);
+
+        btUnknown = new JRadioButton(txtUnkown);
+        btUnknown.setMnemonic(KeyEvent.VK_U);
+        btUnknown.setActionCommand(txtUnkown);
+
+        // Group the radio buttons.
+        group = new ButtonGroup();
+        group.add(btTrue);
+        group.add(btFalse);
+        group.add(btUnknown);
+
+        // Register a listener for the radio buttons.
+        btUnknown.addActionListener(this);
+        btTrue.addActionListener(this);
+        btFalse.addActionListener(this);
+
+        // Initializing panel
+        // panel = new JPanel(new BorderLayout());
+
+        panel = this.createBoxLayout(btTrue, btFalse, 1, 1, null);
+        panel.add(btUnknown);
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return this.getDynField().isMandatory();
+    }
+
+    public void requestFocus() {
+        btFalse.requestFocus();
+    }
+
+    public void setEnabled(boolean isEnabled) {
+        // We are trying to enable something that is ReadOnly.
+        // This is not possible
+        if ((this.isReadOnly()) && (isEnabled == true)) {
+            return;
+        }
+
+        btFalse.setEnabled(isEnabled);
+        btTrue.setEnabled(isEnabled);
+        btUnknown.setEnabled(isEnabled);
+    }
+
+    @Override
+    protected void setJDynFieldComponentListeners() {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    protected void setReadOnly() {
+        this.setEnabled(false);
+    }
+
+    protected void setNullValue() {
+        btTrue.setSelected(false);
+        btFalse.setSelected(false);
+        btUnknown.setSelected(true);
+        this.value = null;
+    }
+
+    protected void setNonNullValue(Object value) {
+        if (value instanceof String) {
+        	value = Boolean.parseBoolean((String) value);
+        	if (value == null){
+                setNullValue();
+                return;        		
+        	}
+        }
+        this.value = (Boolean) value;
+
+        btUnknown.setSelected(false);
+        if (this.value == true) {
+            btTrue.setSelected(true);
+            btFalse.setSelected(false);
+        } else
+            if (this.value == false) {
+                btFalse.setSelected(true);
+                btTrue.setSelected(false);
+            } else {
+                setNullValue();
+            }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JFileDynfieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JFileDynfieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JFileDynfieldComponent.java	(revision 1235)
@@ -0,0 +1,240 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.io.File;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.file.JFileChooser;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class JFileDynfieldComponent extends AbstractJDynFieldComponent
+    implements JDynFieldComponent, FocusListener, KeyListener {
+
+    private JTextField tfFile;
+    private JPanel panel;
+    private File file;
+    private String previousText;
+    private JFileChooser fc;
+    private JButton jBtnChangeFile;
+
+	/**
+	 * @param field 
+	 * @param parent
+	 * @param writable 
+	 * @param writable
+	 * @param dynField
+	 * @throws ServiceException
+	 */
+	public JFileDynfieldComponent(DynField field, ValueField parent, boolean writable)
+        throws ServiceException {
+		super(field, parent, writable);
+    }
+
+    @Override
+    protected void afterUI() {
+     
+
+    }
+
+    public void focusGained(FocusEvent e) {
+        previousText = tfFile.getText();
+    }
+
+    public void focusLost(FocusEvent e) {
+        // if (!this.isValid())
+        // tfFile.setText(previousText);
+        previousText = tfFile.getText();
+        this.file = new File(previousText);
+        this.fireValueChangedEvent();
+    }
+
+    public JComponent asJComponent() {
+        return panel;
+    }
+
+    @Override
+    protected void initData() {
+        previousText = "";
+    }
+
+    @Override
+    protected void initUI() {
+        tfFile = new JTextField();
+        tfFile.addKeyListener(this);
+        panel = this.createBoxLayout(tfFile,getJBtnChangeFile() , 1, 1, null); 
+        initBtnChangeFile();
+    }
+
+    /**
+     * This method initializes jButton
+     * 
+     * @return javax.swing.JButton
+     */
+    private JButton getJBtnChangeFile() {
+        if (jBtnChangeFile == null) {
+            jBtnChangeFile = new JButton();
+            jBtnChangeFile.setText("..."); //$NON-NLS-1$
+            jBtnChangeFile.setPreferredSize(new java.awt.Dimension(26, 26));
+        }
+        return jBtnChangeFile;
+    }
+    
+    private void initBtnChangeFile() {
+        getJBtnChangeFile().addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                showResultProviderDialog();
+            }
+
+        });
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return this.getDynField().isMandatory();
+    }
+
+    private void refresh() {
+        if (file != null)
+            tfFile.setText(file.getAbsolutePath());
+        else
+            tfFile.setText("");
+        if ((!isReadOnly())&&(!this.jBtnChangeFile.isVisible())){
+            this.jBtnChangeFile.setVisible(true);
+        }
+    }
+
+    public void requestFocus() {
+		// tfFile.requestFocus();
+    }
+
+    public void setEnabled(boolean isEnabled) {
+        tfFile.setEnabled(isEnabled);
+        this.getJBtnChangeFile().setEnabled(isEnabled);
+    }
+
+    @Override
+    protected void setJDynFieldComponentListeners() {
+        tfFile.addFocusListener(this);
+    }
+
+    @Override
+    protected void setReadOnly() {
+        tfFile.setEditable(false);
+        this.jBtnChangeFile.setVisible(false);
+    }
+
+    protected void setNullValue() {
+        file = null;
+        this.refresh();
+    }
+
+    protected void setNonNullValue(Object value) {
+        file = (File) value;
+        this.refresh();
+    }
+
+    public void showResultProviderDialog() {
+        fc =  new JFileChooser(this);
+        fc.alignToField(this);
+        fc.showDialog();
+    }
+
+    public void keyPressed(KeyEvent e) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void keyReleased(KeyEvent e) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void keyTyped(KeyEvent e) {
+       isValid();
+       this.fireValueChangedEvent();
+    }
+
+    /**
+     * @param path
+     */
+    private boolean checkPath(String path) {
+        if ((path==null)||(path.equals(""))){
+            if (this.getDynField().isMandatory())
+                return false;
+            return true;
+        }
+        java.io.File f = new File(path);
+        this.file = f;        
+        return true;
+    }
+
+    @Override
+    public boolean isValid() {
+        String path = this.tfFile.getText();
+        return checkPath(path);
+    }
+
+    public Object getValue() {
+        return this.file;
+    }
+
+    public String toString() {
+        if (this.file == null){
+            return null;
+        }
+        return this.file.getAbsolutePath();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/JNullValueMuttableTextFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/JNullValueMuttableTextFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/JNullValueMuttableTextFieldComponent.java	(revision 1235)
@@ -0,0 +1,358 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field.component.date;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.Locale;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.api.usability.DynFieldEditor;
+
+/**
+ * 
+ * This class is used a JSpinner to accept null values by changing to an empty
+ * JTextField when the value is null when clicking to the null component, the
+ * JTextField will disappear and the currentValue will be shown in the JSpinner.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class JNullValueMuttableTextFieldComponent extends JPanel implements
+		NullValueMuttableModel, KeyListener, FocusListener {
+
+	/**
+     * 
+     */
+	private static final long serialVersionUID = -7772372354714908644L;
+
+	private JTextField textField;
+	private JButton btnEmptyLabel;
+
+	private DynFieldEditor editor;
+	private ValueField field;
+	// private Object value;
+
+	private boolean isReadOnly;
+
+	private ImageIcon icon;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param field
+	 *            the {@link DynField} to which the field refers to.
+	 * @param initialValue
+	 *            the initial value to be set.
+	 * @param locale
+	 */
+	public JNullValueMuttableTextFieldComponent(ValueField field,
+			Object initialValue, Locale locale, ImageIcon btnEmptyImageIcon) {
+		super();
+		this.setLocale(locale);
+		this.field = field;
+		this.isReadOnly = field.getDynField().isReadOnly();
+		this.icon = btnEmptyImageIcon;
+		initUI();
+		afterUI(initialValue, locale);
+		this.fireValueChangedEvent();
+	}
+
+	public void addEmptyButtonActionListener(ActionListener listener) {
+		this.getBtnEmpty().addActionListener(listener);
+	}
+
+	public void addValueChangedListener(ValueChangedListener listener) {
+		if (listener instanceof JDynFieldComponent) {
+			this.listenerList.add(ValueChangedListener.class, listener);
+		}
+	}
+
+	private void afterUI(Object initialValue, Locale locale) {
+		if (getDynField().isReadOnly()) {
+			this.isReadOnly = true;
+			getJTextField().setVisible(false);
+			getBtnEmpty().setVisible(false);
+
+			getJSpinner().setValue(initialValue);
+			getJSpinner().setEnabled(false);
+		} else {
+			setValue(initialValue);
+		}
+	}
+
+	public void fireValueChangedEvent() {
+		ValueChangedListener[] list = this.listenerList
+				.getListeners(ValueChangedListener.class);
+		for (ValueChangedListener listener : list) {
+			listener.handleValueChanged((JDynFieldComponent) listener);
+		}
+	}
+
+	public String getValidationMessage() {
+		try {
+			this.getDynField().validate(this.getValue());
+			return "";
+		} catch (DynFieldValidateException e) {
+			return e.getMessage(3);
+		}
+	}
+
+	/**
+	 * Gets the image button component
+	 * 
+	 * @return the Image button component
+	 */
+	private JButton getBtnEmpty() {
+		if (btnEmptyLabel != null) {
+			return btnEmptyLabel;
+		}
+
+		String description = "Empties the field value.";
+
+		btnEmptyLabel = new JButton();
+		btnEmptyLabel.setActionCommand("BTN_CLEAR");
+		btnEmptyLabel.setOpaque(false);
+		btnEmptyLabel.setBorderPainted(false);
+
+		btnEmptyLabel.setBorder(BorderFactory.createEmptyBorder());
+		btnEmptyLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+		btnEmptyLabel.setVerticalAlignment(SwingConstants.TOP);
+
+		if (icon != null) {
+			icon.setDescription(description);
+			btnEmptyLabel.setSize(new java.awt.Dimension(icon.getIconWidth(),
+					icon.getIconHeight()));
+
+			btnEmptyLabel.setIcon(icon);
+		}
+
+		btnEmptyLabel.addActionListener(new ActionListener() {
+
+			public void actionPerformed(ActionEvent e) {
+				setEmptyValue();
+			}
+		});
+		return btnEmptyLabel;
+	}
+
+	protected Object getDefaultValue() {
+		return this.editor.getDefaultValue();
+	}
+
+	public DynField getDynField() {
+		return this.field.getDynField();
+	}
+
+	/**
+	 * Gets the current JSpinner component
+	 * 
+	 * @return the spinner component
+	 */
+	private JSpinner getJSpinner() {
+		return this.editor.getSpinner();
+	}
+
+	/**
+	 * Gets the current JTextField component
+	 * 
+	 * @return the JTextField component
+	 */
+	private JTextField getJTextField() {
+		if (textField != null) {
+			return textField;
+		}
+
+		textField = new JTextField();
+
+		textField.addFocusListener(new FocusListener() {
+
+			public void focusGained(FocusEvent e) {
+				setValue(editor.getDefaultValue());
+			}
+
+			public void focusLost(FocusEvent e) {
+				setValue(editor.getTextFieldValue());
+				fireValueChangedEvent();
+			}
+		});
+		return textField;
+	}
+
+	public Object getTextFieldValue() {
+		return this.editor.getTextFieldValue();
+	}
+
+	/**
+	 * Gets the current value of this component. This value can be null.
+	 * 
+	 * @return
+	 */
+	public Object getValue() {
+		return this.getTextFieldValue();
+	}
+
+	/**
+	 * Sets the appropiate components properties for when the value is not null.
+	 */
+	private void setNonEmptyValue(Object value) {
+
+		this.editor.setTextFieldValue(value);
+		getJSpinner().setValue(this.editor.getTextFieldValue());
+		getJSpinner().requestFocus();
+		getJSpinner().setVisible(true);
+
+		fireValueChangedEvent();
+
+	}
+
+	/**
+	 * Inits the main graphic user interface
+	 */
+	private void initUI() {
+		this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
+		this.editor = ToolsSwingLocator.getUsabilitySwingManager()
+				.createNullSpinnerEditor(this, this.field.getDynField(),
+						this.getLocale());
+		this.editor.getTextField().addKeyListener(this);
+
+		// Adding components
+		this.add(getJSpinner());
+		this.add(getJTextField());
+		this.add(Box.createHorizontalStrut(3));
+		this.add(getBtnEmpty());
+		this.add(Box.createHorizontalStrut(4));
+	}
+
+	/**
+	 * Determines if this field is readonly or not.
+	 * 
+	 * @return true if it is only readable, false otherwise.
+	 */
+	private boolean isReadOnly() {
+		return this.isReadOnly;
+	}
+
+	public void keyPressed(KeyEvent e) {
+	}
+
+	public void keyReleased(KeyEvent e) {
+
+	}
+
+	public void keyTyped(KeyEvent e) {
+		this.fireValueChangedEvent();
+	}
+
+	public void setEditable(boolean isEditable) {
+		this.textField.setEditable(isEditable);
+		getJSpinner().setEnabled(isEditable);
+	}
+
+	/**
+	 * Sets the appropiate components properties for when the value is null.
+	 */
+	private void setEmptyValue() {
+		// this.value = null;
+
+		this.editor.setTextFieldValue(null);
+	}
+
+	/**
+	 * Sets a value if it is not readonly.
+	 * 
+	 * @param value
+	 */
+	public void setValue(Object value) {
+		if (isReadOnly()) {
+			value = this.getDefaultValue();
+		}
+
+		if (value == null) {
+			setEmptyValue();
+		} else {
+			setNonEmptyValue(value);
+		}
+
+		boolean hasValue = (this.getValue() != null);
+		this.textField.setVisible(!hasValue);
+		getJSpinner().setVisible(hasValue);
+
+		fireValueChangedEvent();
+	}
+
+	public JNullValueMuttableTextFieldComponent getModel() {
+		return this;
+	}
+
+	public Object getDefaultFieldValue() {
+		return field.getDefaultFieldValue();
+	}
+
+	public Object getFieldValue() {
+		return field.getFieldValue();
+	}
+
+	public void setFieldValue(Object value) {
+		field.setFieldValue(value);
+
+	}
+
+	public void focusGained(FocusEvent arg0) {
+		Object value = getValue();
+		if (value == null) {
+			this.setValue(null);
+		}
+	}
+
+	public void focusLost(FocusEvent arg0) {
+		setValue(getValue());
+		fireValueChangedEvent();
+	}
+
+	public DynField getParentDynField() {
+		return field.getDynField();
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateCalendarPicker.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateCalendarPicker.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateCalendarPicker.java	(revision 1235)
@@ -0,0 +1,259 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field.component.date;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+
+import org.freixas.jcalendar.DateEvent;
+import org.freixas.jcalendar.DateListener;
+import org.freixas.jcalendar.JCalendar;
+
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+
+public class DateCalendarPicker extends JPanel implements DateListener,
+    ActionListener {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -4084206317377526029L;
+
+	private static final String LABEL_OK = "Ok";
+
+	private static final String LABEL_CANCEL = "Cancel";
+
+    private JCalendar jCal = null;
+    boolean okPressed = false;
+    private Calendar calendar;
+    private JLabel dateLabel;
+    private DateFormat formatter;
+    private JButton buttonOK;
+    private JButton buttonCancel;
+    private Date iniDate;
+	private UsabilitySwingManager usabilityManager;
+
+    public DateCalendarPicker(Date date) {
+        this(date, Locale.getDefault());
+    }
+
+    public DateCalendarPicker(Date date, Locale loc) {
+        super();
+
+        if (date == null) {
+            date = new Date();
+        }
+
+		this.usabilityManager = ToolsSwingLocator.getUsabilitySwingManager();
+        this.iniDate = date;
+        this.setLocale(loc);
+        beforeUI(date);
+        initUI();
+        addButtonsActionListener(this);
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        JButton button = (JButton) e.getSource();
+        if (button.getActionCommand().equals("BUTTON_OK")) {
+            this.okPressed = true;
+        } else {
+            this.okPressed = false;
+        }
+        this.setVisible(false);
+    }
+
+    public void addButtonsActionListener(ActionListener listener) {
+        this.getButtonCancel().addActionListener(listener);
+        this.getButtonOK().addActionListener(listener);
+    }
+
+    public void addDateListener(DateListener listener) {
+		this.getUICalendar().addDateListener(listener);
+    }
+
+    private void beforeUI(Date date) {
+        // DateFormat
+        formatter =
+            DateFormat.getDateInstance(DateFormat.FULL, this.getLocale());
+        // Calendar settings
+        JCalendar cal = getUICalendar();
+		cal.addDateListener(this);
+        cal.setDate(date);
+
+        // Setting fonts
+        // Set fonts rather than using defaults
+        cal.setTitleFont(new Font("SansSerif", Font.BOLD, 22));
+        cal.setDayOfWeekFont(new Font("SansSerif", Font.ITALIC, 12));
+        cal.setDayFont(new Font("SansSerif", Font.BOLD, 14));
+        cal.setTimeFont(new Font("DialogInput", Font.PLAIN, 10));
+        cal.setTodayFont(new Font("Dialog", Font.PLAIN, 14));
+    }
+
+    private Border createCompoundBorder() {
+        // Create a border for all calendars
+        Border etchedBorder = BorderFactory.createEtchedBorder();
+        Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
+        return BorderFactory.createCompoundBorder(etchedBorder, emptyBorder);
+    }
+
+    public void dateChanged(DateEvent dateEvent) {
+        this.calendar = dateEvent.getSelectedDate();
+        refreshLbl();
+    }
+
+    private JButton getButtonCancel() {
+		if (buttonCancel == null) {
+			buttonCancel = this.usabilityManager
+					.createJToolButton(LABEL_CANCEL);
+            buttonCancel.setActionCommand("BTN_CANCEL");
+			// buttonCancel.setSize(90, 23);
+        }
+        return buttonCancel;
+    }
+
+    private JButton getButtonOK() {
+        if (buttonOK == null) {
+			buttonOK = this.usabilityManager.createJToolButton(LABEL_OK);
+            buttonOK.setActionCommand("BTN_OK");
+			// buttonOK.setSize(90, 23);
+        }
+        return buttonOK;
+    }
+
+    private Calendar getDateCalendar() {
+        if (this.calendar == null) {
+            this.calendar = Calendar.getInstance(this.getLocale());
+            this.calendar.setTime(this.iniDate);
+        }
+        return this.calendar;
+    }
+
+    public String getDateString() {
+        return getLblText(getSelectedDate());
+    }
+
+    public JLabel getLbl() {
+        if (this.dateLabel == null) {
+            this.dateLabel = new JLabel(getDateString());
+            // Label settings
+            this.dateLabel.setBorder(BorderFactory
+                .createEmptyBorder(8, 8, 5, 8));
+            this.dateLabel.setHorizontalAlignment(SwingConstants.CENTER);
+            this.dateLabel.setBackground(Color.BLUE.brighter());
+            this.dateLabel.setForeground(Color.BLUE.brighter());
+            this.dateLabel.setFont(new Font("SansSerif", Font.BOLD, 18));
+        }
+        return this.dateLabel;
+    }
+
+    public String getLblText(Date date) {
+        return formatter.format(this.getSelectedDate());
+    }
+
+    public Date getSelectedDate() {
+        return getDateCalendar().getTime();
+    }
+
+    private JCalendar getUICalendar() {
+        if (jCal == null) {
+            jCal = new JCalendar();
+            jCal.setSize(300, 300);
+            jCal.addDateListener(this);
+            jCal.setLocale(this.getLocale());
+            jCal.setDate(this.getDateCalendar().getTime());
+        }
+        return jCal;
+    }
+
+    private void initUI() {
+        // Setting border
+        Border compoundBorder = createCompoundBorder();
+        this.setBorder(compoundBorder);
+
+        JPanel datePanel = new JPanel(new GridBagLayout());
+        GridBagConstraints c = new GridBagConstraints();
+        c.insets = new Insets(2, 2, 4, 2);
+        c.fill = GridBagConstraints.NONE;
+        c.gridx = 0;
+        datePanel.add(this.getUICalendar(), c);
+
+        JPanel buttonsPanel = new JPanel(new GridBagLayout());
+        c = new GridBagConstraints();
+        c.insets = new Insets(2, 2, 4, 2);
+        c.fill = GridBagConstraints.NONE;
+        buttonsPanel.add(getButtonOK(), c);
+        c.insets = new Insets(2, 4, 2, 2);
+        c.fill = GridBagConstraints.NONE;
+        buttonsPanel.add(getButtonCancel(), c);
+
+        JPanel headerPanel = new JPanel(new GridBagLayout());
+        headerPanel.add(getLbl());
+        headerPanel.add(new JSeparator());
+        headerPanel.setBackground(new Color(0, 0, 255, 20));
+
+        // this.add(getLbl(), BorderLayout.PAGE_START);
+        this.add(headerPanel, BorderLayout.PAGE_START);
+        this.add(datePanel, BorderLayout.CENTER);
+        this.add(buttonsPanel, BorderLayout.PAGE_END);
+
+
+    }
+
+    public boolean isOkPressed() {
+        return this.okPressed;
+    }
+
+    private void refreshLbl() {
+        this.getLbl().setText("");
+        this.getLbl().setText(getDateString());
+    }
+
+    public void setSelectedDate(Date date) {
+        if (date == null) {
+            date = new Date();
+        }
+        this.getDateCalendar().setTime(date);
+        this.getUICalendar().setDate(date);
+        refreshLbl();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/NullValueMuttableModel.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/NullValueMuttableModel.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/NullValueMuttableModel.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field.component.date;
+
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+
+public interface NullValueMuttableModel  extends ValueField{
+
+    public Object getTextFieldValue();
+
+    public void requestFocus();
+
+    public Object getValue();
+
+    public void setEnabled(boolean enabled);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateChangeListener.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateChangeListener.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/date/DateChangeListener.java	(revision 1235)
@@ -0,0 +1,39 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field.component.date;
+
+import java.util.Date;
+
+import javax.swing.event.ChangeListener;
+
+public interface DateChangeListener extends ChangeListener {
+
+    public Date getCurrentDate();
+
+    public Date getNextDate();
+
+    public Date getPreviousDate();
+
+    public void stateChanged(DateChangeListener listener);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileExtensionList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileExtensionList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileExtensionList.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.component.file;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public interface JFileExtensionList {
+
+    public JFileExtensionList add(String extension);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileChooser.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileChooser.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/file/JFileChooser.java	(revision 1235)
@@ -0,0 +1,207 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.component.file;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.ImageIcon;
+import javax.swing.filechooser.FileFilter;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.swing.api.ComponentService;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.serv.field.ToolsSwingDefaultFieldImplLibrary;
+
+/**
+ * 
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class JFileChooser implements JFileExtensionList {
+
+    private class JFileFilter extends FileFilter {
+
+        public JFileFilter(String[] extensions) {
+            this.seExtensiontList(extensions);
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
+         */
+        @Override
+        public boolean accept(File f) {
+            // int type =fc.getFileSelectionMode();
+            //
+            // if ((type==DIRECTORIES_ONLY)||(type==FILES_AND_DIRECTORIES))
+            // if (f.isDirectory())
+            // return true;
+            if (f.isDirectory()) {
+                return true;
+            }
+
+            String extension = this.getExtension(f);
+            if ((extension != null) && (!extensions.isEmpty())) {
+                for (String ext : extensions) {
+                    if (extension.equals(ext)) {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.swing.filechooser.FileFilter#getDescription()
+         */
+        @Override
+        public String getDescription() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        /*
+         * Get the extension of a file.
+         */
+        private String getExtension(File f) {
+            String ext = null;
+            String s = f.getName();
+            int i = s.lastIndexOf('.');
+
+            if ((i > 0) && (i < s.length() - 1)) {
+                ext = s.substring(i + 1).toLowerCase();
+            }
+            return ext;
+        }
+
+        private void seExtensiontList(String[] extensions) {
+            if (extensions == null) {
+                return;
+            }
+            for (String extension : extensions) {
+                JFileChooser.this.getExtensions().add(extension);
+            }
+        }
+    }
+
+    public static final int DIRECTORIES_ONLY =
+        javax.swing.JFileChooser.DIRECTORIES_ONLY;
+    public static final int FILES_AND_DIRECTORIES =
+        javax.swing.JFileChooser.FILES_AND_DIRECTORIES;
+
+    private static final String ACCEPT_BUTTON = null;
+
+    /** Returns an ImageIcon, or null if the path was invalid. */
+    protected static ImageIcon createImageIcon(String path) {
+        java.net.URL imgURL =
+            ToolsSwingDefaultFieldImplLibrary.class.getResource(path);
+        if (imgURL != null) {
+            return new ImageIcon(imgURL);
+        } else {
+            System.err.println("Couldn't find file: " + path);
+            return null;
+        }
+    }
+
+    // Create a file chooser
+    private javax.swing.JFileChooser fc = null;
+    private javax.swing.JComponent panel = null;
+
+    protected List<String> extensions;
+    private JDynFieldComponent component;
+
+    public JFileChooser(JDynFieldComponent component) {
+        this(component, null);
+    }
+
+    public JFileChooser(JDynFieldComponent theComponent,
+        String[] extensionsFilter) {
+        fc = new javax.swing.JFileChooser();
+        component = theComponent;
+        extensions = new ArrayList<String>();
+        // By default FILES_ONLY.
+        if (component.getDynField().getType() == DataTypes.FOLDER) {
+            fc.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY);
+            // else
+            // fc.setFileSelectionMode(javax.swing.JFileChooser.FILES_AND_DIRECTORIES);
+        }
+
+        if (extensionsFilter != null) {
+            fc.addChoosableFileFilter(new JFileFilter(extensionsFilter));
+        }
+    }
+
+    public JFileExtensionList add(String extension) {
+        if (extension != null) {
+            extensions.add(extension);
+        }
+        return this;
+    }
+
+    public void alignToField(ComponentService comp) {
+        panel = comp.asJComponent();
+    }
+
+    /**
+     * @return
+     */
+    public List<String> getExtensions() {
+        return extensions;
+    }
+
+    public void setApproveButtonText() {
+        fc.setApproveButtonText(ACCEPT_BUTTON);
+    }
+
+    public void showDialog() {
+        int returnVal = fc.showOpenDialog(panel);
+        if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
+            File file = fc.getSelectedFile();
+            component.setValue(file);
+        }
+        fc.setVisible(false);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDefaultDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDefaultDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDefaultDynFieldComponent.java	(revision 1235)
@@ -0,0 +1,154 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+/**
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class JDefaultDynFieldComponent extends AbstractJDynFieldComponent
+    implements JDynFieldComponent {
+
+    protected JLabel label;
+
+    /**
+     * @param dynField
+     * @param dynObject
+     * @throws ServiceException
+     */
+	public JDefaultDynFieldComponent(DynField definition, ValueField parent, boolean writable)
+			throws ServiceException {
+		super(definition, parent, writable);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#afterUI()
+     */
+    @Override
+    protected void afterUI() {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+     */
+    public JComponent asJComponent() {
+        return label;
+    }
+
+    private String getLabel() {
+        Object value = this.getInitialValue();
+        return (value == null) ? "" : value.toString();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#initData()
+     */
+    @Override
+    protected void initData() {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#initUI()
+     */
+    @Override
+    protected void initUI() {
+        label = new JLabel(this.getLabel());
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return this.getDynField().isMandatory();
+    }
+
+    public void requestFocus() {
+        label.requestFocus();
+    }
+
+    public void setEnabled(boolean isEnabled) {
+        label.setEnabled(isEnabled);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.spi.AbstractJDynFieldComponent#
+     * setJDynFieldComponentListeners()
+     */
+    @Override
+    protected void setJDynFieldComponentListeners() {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    protected void setNonNullValue(Object value) {
+        label.setText(value.toString());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setValue
+     * (java.lang.Object)
+     */
+    @Override
+    protected void setNullValue() {
+        label.setText("\n   \n   ");
+    }
+  
+
+    protected void setReadOnly() {
+        // Do nothing. Label is already ReadOnly
+    }
+    
+    @Override
+    public Object getValue() {
+        return label.getText();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDateCalendarDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDateCalendarDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JDateCalendarDynFieldComponent.java	(revision 1235)
@@ -0,0 +1,247 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.gvsig.tools.swing.serv.field.component.date.DateCalendarPicker;
+import org.gvsig.tools.swing.serv.field.component.date.JNullValueMuttableTextFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+public class JDateCalendarDynFieldComponent extends AbstractJDynFieldComponent
+		implements JDynFieldComponent, FocusListener, ChangeListener,
+		ValueChangedListener, ActionListener {
+
+	private static final String BTN_EMPTY_IMG_PATH = "editdelete.png";
+	private static final String DATEPICKER_TITLE = "Choose a date:";
+
+	private JButton jBtnChangeDate;
+	private JNullValueMuttableTextFieldComponent dateFieldPanel;
+	private Object oldTxt;
+
+	// private Component dlg;
+	private WindowManager windowManager;
+	private DateCalendarPicker datePicker;
+	private UsabilitySwingManager usabilityManager;
+
+	public JDateCalendarDynFieldComponent(DynField definition,
+			ValueField valueField, boolean writable) throws ServiceException {
+		super(definition, valueField, writable);
+		windowManager = ToolsSwingLocator.getWindowManager();
+		if (getDynField().getType() != DataTypes.DATE) {
+			this.getJBtnChangeDate().setVisible(false);
+		}
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		JButton btn = (JButton) e.getSource();
+		if (btn.getActionCommand().equals("BTN_OK")) {
+			setValue(getDatePicker().getSelectedDate());
+			this.fireValueChangedEvent();
+		}
+		close();
+	}
+
+	@Override
+	protected void afterUI() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public JComponent asJComponent() {
+		return getModel();
+	}
+
+	protected void close() {
+		if (datePicker.isVisible()) {
+			datePicker.setVisible(false);
+		}
+	}
+
+	protected DateCalendarPicker createCalendarPicker(Date date, Locale loc) {
+		DateCalendarPicker datePicker = new DateCalendarPicker(this.getDate(),
+				loc);
+		datePicker.setPreferredSize(new java.awt.Dimension(450, 410));
+		return datePicker;
+	}
+
+	public void focusGained(FocusEvent e) {
+		oldTxt = getValue();
+		if (oldTxt == null) {
+			oldTxt = getDefaultValue();
+		}
+		setValue(oldTxt);
+	}
+
+	public void focusLost(FocusEvent e) {
+		Object txt = getValue();
+		if (txt == null) {
+			setValue(null);
+		} else {
+			oldTxt = txt;
+			setValue(txt);
+		}
+	}
+
+	protected ImageIcon getBtnEmptyImageIcon() {
+		return new ImageIcon(
+				org.gvsig.tools.swing.serv.field.component.JNumberDynFieldComponent.class
+						.getResource(BTN_EMPTY_IMG_PATH));
+	}
+
+	private Date getDate() {
+		return (Date) getValue();
+	}
+
+	/**
+	 * This method initializes jButton
+	 * 
+	 * @return javax.swing.JButton
+	 */
+	public JButton getJBtnChangeDate() {
+		if (jBtnChangeDate == null) { 
+			jBtnChangeDate = new JButton();
+			jBtnChangeDate.setText("...");
+			jBtnChangeDate.setPreferredSize(new java.awt.Dimension(26, 26));
+			jBtnChangeDate.addActionListener(new ActionListener() {
+
+				public void actionPerformed(ActionEvent event) {
+					showDialog(getDatePicker());
+				}
+
+			});
+		}
+		return jBtnChangeDate;
+	}
+
+	private JNullValueMuttableTextFieldComponent getModel() {
+		return dateFieldPanel;
+	}
+
+	@Override
+	public Object getValue() {
+		return this.getModel().getTextFieldValue();
+	}
+
+	public void handleValueChanged(JDynFieldComponent jDynFieldComponent) {
+		this.fireValueChangedEvent();
+	}
+
+	public DateCalendarPicker getDatePicker() {
+		if (datePicker == null) {
+			datePicker = createCalendarPicker(this.getDate(), getLocale());
+			datePicker.addButtonsActionListener(this);
+		}
+		return datePicker;
+	}
+
+	@Override
+	protected void initData() {
+		usabilityManager = ToolsSwingLocator.getUsabilitySwingManager();
+	}
+
+	@Override
+	protected void initUI() {
+		this.dateFieldPanel = new JNullValueMuttableTextFieldComponent(this,
+				this.getInitialValue(), Locale.getDefault(),
+				getBtnEmptyImageIcon());
+		this.dateFieldPanel.add(this.getJBtnChangeDate());
+		this.dateFieldPanel.addValueChangedListener(this);
+	}
+
+	private Locale getLocale() {
+		return getModel().getLocale();
+	}
+
+	@Override
+	public boolean isValid() {
+		Date date = getDate();
+		if ((date == null) && (this.getDynField().isMandatory())) {
+			return false;
+		}
+		return true;
+
+	}
+
+	public void requestFocus() {
+		this.getModel().requestFocus();
+		this.fireValueChangedEvent();
+	}
+
+	public void setEnabled(boolean isEnabled) {
+		getModel().setEnabled(isEnabled);
+	}
+
+	@Override
+	protected void setJDynFieldComponentListeners() {
+	}
+
+	@Override
+	protected void setNonNullValue(Object value) {
+		this.getModel().setValue(value);
+	}
+
+	@Override
+	protected void setNullValue() {
+		this.getModel().setValue(null);
+	}
+
+	@Override
+	protected void setReadOnly() {
+		this.getModel().setEditable(false);
+		this.getJBtnChangeDate().setVisible(false);
+	}
+
+	protected void showDialog(DateCalendarPicker datePicker) {
+		ToolsSwingLocator.getTaskStatusSwingManager();
+		datePicker.setVisible(true);
+		datePicker.setSelectedDate(this.getDate());
+		windowManager.showWindow(datePicker, translate(DATEPICKER_TITLE),
+				WindowManager.MODE.WINDOW);
+	}
+
+	public void stateChanged(ChangeEvent e) {
+		this.fireValueChangedEvent();
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JNumberDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JNumberDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JNumberDynFieldComponent.java	(revision 1235)
@@ -0,0 +1,219 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import java.util.Locale;
+
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.date.JNullValueMuttableTextFieldComponent;
+import org.gvsig.tools.swing.serv.field.component.date.NullValueMuttableModel;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+/**
+ * Component for numeric {@link DynObject} fields.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class JNumberDynFieldComponent extends AbstractJDynFieldComponent
+    implements JDynFieldComponent, ValueChangedListener {
+
+    private static final long serialVersionUID = -8120715001446683582L;
+
+    private static Object NULL_VALUE = null;
+	private static final String BTN_EMPTY_IMG_PATH = "editdelete.png";
+
+    private JNullValueMuttableTextFieldComponent pane;
+
+    /**
+     * @param definition 
+     * @param parent
+     * @param writable 
+     * @throws ServiceException
+     * @see JDynFieldComponent#JDynFieldComponent(DynField, DynObject).
+     */
+	public JNumberDynFieldComponent(DynField definition, ValueField parent, boolean writable)
+			throws ServiceException {
+		super(definition, parent, writable);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#afterUI()
+     */
+    @Override
+    protected void afterUI() {
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+     */
+    public JComponent asJComponent() {
+        return this.pane;
+    }
+
+    protected ImageIcon getBtnEmptyImageIcon() {
+		return new ImageIcon(org.gvsig.tools.swing.serv.field.component.JNumberDynFieldComponent.class.getResource(BTN_EMPTY_IMG_PATH));
+    }
+
+   
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#getValue
+     * ()
+     */
+    @Override
+    public Object getValue() {
+        return getModel().getTextFieldValue();
+    }
+
+    private NullValueMuttableModel getModel() {
+        return this.pane.getModel();
+    }
+
+    public void handleValueChanged(JDynFieldComponent field) {
+        this.fireValueChangedEvent();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#initData()
+     */
+    @Override
+    protected void initData() {
+    }
+
+    /**
+     * Creates the component ui.
+     */
+    @Override
+    protected void initUI() {
+        this.pane =
+            new JNullValueMuttableTextFieldComponent(this, this
+                .getInitialValue(), Locale.getDefault(), getBtnEmptyImageIcon());
+        this.pane.addValueChangedListener(this);
+    }
+
+    @Override
+    public boolean isValid() {
+        Number num = (Number) getValue();
+        if ((num == null) && (this.getDynField().isMandatory())) {
+            return false;
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * 
+     * 
+     * 
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#requestFocus
+     * ()
+     */
+    public void requestFocus() {
+        getModel().requestFocus();
+    }
+
+    @Override
+    public void saveStatus() {
+        if (getModel() != null) {
+			this.setFieldValue(getModel().getValue());
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * 
+     * 
+     * 
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setEnabled
+     * (boolean)
+     */
+    public void setEnabled(boolean isEnabled) {
+        getModel().setEnabled(true);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.spi.AbstractJDynFieldComponent#
+     * setJDynFieldComponentListeners()
+     */
+    @Override
+    protected void setJDynFieldComponentListeners() {
+        // getModel().addEmptyButtonActionListener(this);
+    }
+
+    @Override
+    protected void setNonNullValue(Object value) {
+        getModel().setValue(value);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setValue
+     * (java.lang.Object)
+     */
+    @Override
+    protected void setNullValue() {
+        getModel().setValue(NULL_VALUE);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.spi.AbstractJDynFieldComponent#setReadOnly()
+     */
+    @Override
+    protected void setReadOnly() {
+		// do nothing
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JTextFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JTextFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JTextFieldComponent.java	(revision 1235)
@@ -0,0 +1,303 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.component;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.text.JTextComponent;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class JTextFieldComponent extends AbstractJDynFieldComponent implements
+		JDynFieldComponent, KeyListener {
+
+	protected JLabel label;
+
+	private JTextComponent jtext;
+
+	private JComponent pane;
+	
+	private static DataTypesManager dataTypesManager = null;
+
+	/**
+	 * @param writable
+	 * @param field
+	 * @param writable
+	 * @param dynField
+	 * @param dynObject
+	 * @throws ServiceException
+	 */
+	public JTextFieldComponent(DynField field, ValueField parent,
+			boolean writable) throws ServiceException {
+		super(field, parent, writable);
+	}
+
+	@Override
+	protected void afterUI() {
+		// TODO Auto-generated method stub
+		JComponent comp = asJComponent();
+		comp.setBorder(BorderFactory.createTitledBorder(""));
+		if (isReadOnly()) {
+			comp.setOpaque(false);
+		} else {
+			comp.setFont(comp.getFont().deriveFont(12f));
+		}
+
+	}
+
+	public JComponent asJComponent() {
+
+		if (isReadOnly()) {
+			return this.label;
+		}
+		// JPanel pane = new JPanel(new GridBagLayout());
+		// GridBagConstraints constr = new GridBagConstraints();
+		// constr.anchor = GridBagConstraints.PAGE_START;
+		// constr.insets = new Insets(5, 5, 5, 5);
+		// constr.fill = GridBagConstraints.BOTH;
+		// pane.add(jtext, constr);
+		return jtext;
+
+	}
+
+	private JTextArea createTextArea(String text) {
+		JTextArea ta = ToolsSwingLocator.getUsabilitySwingManager()
+				.createJTextArea(text, -1);
+		ta.setEditable(!isReadOnly());
+		return ta;
+	}
+
+	private JComponent createPane(JComponent comp) {
+		JPanel pane = new JPanel(new GridBagLayout());
+		GridBagConstraints constr = new GridBagConstraints();
+		constr.insets = new Insets(3, 3, 3, 3);
+		constr.gridx = 0;
+		constr.gridy = 0;
+
+		constr.fill = GridBagConstraints.HORIZONTAL;
+
+		pane.add(comp, constr);
+
+		constr.gridx = 1;
+		constr.gridy = 0;
+		constr.fill = GridBagConstraints.NONE;
+		pane.add(new JLabel(""));
+		// JTextField tff = new JTextField();
+		// tff.setEditable(false);
+		// tff.add(tf);
+		// tf.setVisible(false);
+		return pane;
+	}
+
+	private String getLabel() {
+		Object value = this.getInitialValue();
+		try {
+			Object obj = getDataTypesManager().coerce(DataTypes.STRING, value);
+			return (value == null) ? "" : ((String)obj).trim();
+		} catch (CoercionException e) {
+			return (value == null) ? "" : value.toString().trim();
+		}
+	}
+
+	private DataTypesManager getDataTypesManager(){
+		if (dataTypesManager==null){
+			dataTypesManager = ToolsLocator.getDataTypesManager();
+		}
+		return dataTypesManager;
+	}
+	
+	public Object getValue() {
+		String text = null;
+
+		if (label != null) {
+			text = label.getText();
+		} else if (jtext != null) {
+			text = jtext.getText();
+		}
+		if (text != null) {
+			text = text.trim();
+		}
+		if (text.equals("")) {
+			// if (this.getDynField().isMandatory()){
+			// text = (String)this.getDynField().getDefaultValue();
+			// } else {
+			// text = null;
+			// }
+			return null;
+		}
+
+		return text;
+	}
+
+	@Override
+	protected void initData() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * Creates the component ui.
+	 */
+	@Override
+	protected void initUI() {
+		// DynField field = this.getDynField();
+		// if (field.isReadOnly()) {
+		// label = new JLabel(this.getLabel());
+		// // label.setBorder(BorderFactory.createEmptyBorder(2, 10, 4, 4));
+		// } else {
+		// // this.panel = new JPanel(new BorderLayout());
+		// JTextArea textArea = new JTextArea(this.getLabel());
+		// textArea.setFont(textArea.getFont().deriveFont(12f));
+		// textArea.setWrapStyleWord(true);
+		// textArea.setLineWrap(true);
+		// // textArea.setBorder(BorderFactory.createEmptyBorder(4, 10, 4, 4));
+		// jtext = textArea;
+		// // jtext.setBorder(BorderFactory.createLineBorder(Color.GRAY));
+		// }
+
+		// Component not initialized yet
+
+		if (isReadOnly()) {
+			if (this.label == null) {
+				this.label = new JLabel(getLabel());
+				// this.pane = createPane(label);
+			}
+		} else if (jtext == null) {
+			this.jtext = createTextArea(getLabel());
+			// this.pane = createPane(jtext);
+		}
+
+		// return pane;
+	}
+
+	@Override
+	public boolean isMandatory() {
+		return this.getDynField().isMandatory();
+	}
+
+	public void keyPressed(KeyEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void keyReleased(KeyEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void keyTyped(KeyEvent e) {
+		this.fireValueChangedEvent();
+	}
+
+	public void requestFocus() {
+		if (label != null) {
+			label.requestFocus();
+		} else {
+			jtext.requestFocus();
+		}
+	}
+
+	public void setEnabled(boolean isEnabled) {
+		if (label != null) {
+			label.setEnabled(isEnabled);
+		} else if (jtext != null) {
+			jtext.setEnabled(isEnabled);
+		} else {
+			jtext.setEnabled(true);
+		}
+	}
+
+	@Override
+	protected void setJDynFieldComponentListeners() {
+		if (label != null) {
+			label.addKeyListener(this);
+		} else if (jtext != null) {
+			jtext.addKeyListener(this);
+		}
+	}
+
+	@Override
+	protected void setReadOnly() {
+		if (jtext != null) {
+			jtext.setEditable(false);
+		}
+	}
+
+	protected void setNullValue() {
+		setNonNullValue("");
+	}
+
+	protected void setNonNullValue(Object value) {
+		String text = "";
+		if (value!=null){
+			try {
+				Object obj = getDataTypesManager().coerce(DataTypes.STRING, value);
+				text = ((String)obj).trim();
+			} catch (CoercionException e) {
+				text = value.toString().trim();
+			}
+		}
+		if (label != null) {
+			label.setText(text);
+		} else {
+			if (jtext != null) {
+				jtext.setText(text);
+			}
+		}
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JBooleanDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JBooleanDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JBooleanDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.JBooleanDynFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * 
+ * Swing Factory for the DynField of type boolean.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a>  - gvSIG Team
+ * @version $Id$
+ *
+ */
+public class JBooleanDynFieldComponentFactory extends
+    AbstractJDynFieldComponentFactory implements JDynFieldComponentFactory {
+
+    private static final String FACTORY_DESCRIPTION = "";
+
+	public JDynFieldComponent createJDynFieldComponent(DynField definition, ValueField parent,
+			boolean writable) throws ServiceException {
+		// TODO: take into account the writable flag
+		return new JBooleanDynFieldComponent(definition, parent, writable);
+	}
+
+    @Override
+    public String getFactoryDescription() {
+        return FACTORY_DESCRIPTION;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#
+     * getFactorySubType()
+     */
+    @Override
+    public String getFactorySubType() {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#
+     * getFactoryType()
+     */
+    @Override
+    public Integer getFactoryType() {
+        return DataTypes.BOOLEAN;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JFileDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JFileDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JFileDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,93 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.JFileDynfieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * 
+ * Swing Factory for the DynField of type File or Folder.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a>  - gvSIG Team
+ * @version $Id$
+ *
+ */
+public class JFileDynFieldComponentFactory extends
+    AbstractJDynFieldComponentFactory implements JDynFieldComponentFactory {
+
+    private static final String FACTORY_DESCRIPTION = "";
+
+    private final Integer dataType;
+
+    /**
+     * @param dataType
+     */
+    public JFileDynFieldComponentFactory(Integer dataType) {
+        this.dataType = dataType;
+    }
+
+	public JDynFieldComponent createJDynFieldComponent(DynField field, ValueField parent,
+			boolean writable) throws ServiceException {
+		// TODO: take into account the writable flag
+		return new JFileDynfieldComponent(field, parent, writable);
+    }
+
+    @Override
+    public String getFactoryDescription() {
+        return FACTORY_DESCRIPTION;
+    }
+
+    @Override
+    public String getFactorySubType() {
+        return null;
+    }
+
+    @Override
+    public Integer getFactoryType() {
+        if (dataType != null) {
+            return dataType;
+        }
+        return DataTypes.FILE;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/DynFieldKeyListener.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/DynFieldKeyListener.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/DynFieldKeyListener.java	(revision 1235)
@@ -0,0 +1,95 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.listener;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class DynFieldKeyListener implements KeyListener {
+
+    private final JDynFieldComponent component;
+    private final ValueChangedListener listener;
+
+    /**
+     * @param jDefaultDynFieldComponent
+     * @param listener
+     */
+    public DynFieldKeyListener(JDynObjectComponent jParentComponent,
+        JDynFieldComponent jComponent, ValueChangedListener listener) {
+        component = jComponent;
+        this.listener = listener;
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
+     */
+    public void keyPressed(KeyEvent e) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
+     */
+    public void keyReleased(KeyEvent e) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
+     */
+    public void keyTyped(KeyEvent e) {
+        // TODO Auto-generated method stub
+
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/JDynObjectListener.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/JDynObjectListener.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/JDynObjectListener.java	(revision 1235)
@@ -0,0 +1,49 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.listener;
+
+import org.gvsig.tools.dynobject.DynField;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public interface JDynObjectListener {
+
+    public void onActionListenerJDynFieldComponentResult(DynField field,
+        Object result);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/AddItem.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/AddItem.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/listener/AddItem.java	(revision 1235)
@@ -0,0 +1,45 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.serv.field.listener;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public interface AddItem {
+
+    public AddItem add(String extension);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDefaultDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDefaultDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JDefaultDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,78 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.JTextFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * 
+ * Swing Factory for the DynField of an unregistered type.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a>  - gvSIG Team
+ * @version $Id$
+ *
+ */
+public class JDefaultDynFieldComponentFactory extends
+    AbstractJDynFieldComponentFactory implements JDynFieldComponentFactory {
+
+    private static final String FACTORY_DESCRIPTION = "";
+
+	public JDynFieldComponent createJDynFieldComponent(DynField field, ValueField parent,
+			boolean writable) throws ServiceException {
+		// TODO: take into account the writable flag
+		return new JTextFieldComponent(field, parent, writable);
+    }
+
+    @Override
+    public String getFactoryDescription() {
+        return FACTORY_DESCRIPTION;
+    }
+
+    @Override
+    public String getFactorySubType() {
+        return null;
+    }
+
+    @Override
+    public Integer getFactoryType() {
+        return DataTypes.STRING;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/ToolsSwingDefaultFieldImplLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/ToolsSwingDefaultFieldImplLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/ToolsSwingDefaultFieldImplLibrary.java	(revision 1235)
@@ -0,0 +1,85 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.ToolsSwingLibrary;
+import org.gvsig.tools.swing.spi.ToolsSwingServiceLocator;
+
+/**
+ * {@link Library} for the default tools swing implementation.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class ToolsSwingDefaultFieldImplLibrary extends AbstractLibrary {
+	
+	@Override
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsServiceOf(ToolsSwingLibrary.class);
+	}
+	
+    @Override
+    protected void doInitialize() throws LibraryException {
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+        ServiceManager dsManager = ToolsSwingServiceLocator.getServiceManager();
+
+        dsManager.addServiceFactory(new JDefaultDynFieldComponentFactory());
+        dsManager.addServiceFactory(new JNumberDynFieldComponentFactory(
+            DataTypes.INT));
+        dsManager.addServiceFactory(new JNumberDynFieldComponentFactory(
+            DataTypes.LONG));
+        dsManager.addServiceFactory(new JNumberDynFieldComponentFactory(
+            DataTypes.FLOAT));
+        dsManager.addServiceFactory(new JNumberDynFieldComponentFactory(
+            DataTypes.DOUBLE));
+        dsManager.addServiceFactory(new JNumberDynFieldComponentFactory(
+            DataTypes.BYTE));
+        dsManager.addServiceFactory(new JFileDynFieldComponentFactory(
+            DataTypes.FILE));
+        dsManager.addServiceFactory(new JFileDynFieldComponentFactory(
+            DataTypes.FOLDER));
+        dsManager.addServiceFactory(new JBooleanDynFieldComponentFactory());
+
+        // Date and time
+        dsManager.addServiceFactory(new JDateDynFieldComponentFactory());
+        // Only date
+        dsManager.addServiceFactory(new JDateDynFieldComponentFactory(
+            DataTypes.DATE));
+        // Only time
+        dsManager.addServiceFactory(new JDateDynFieldComponentFactory(
+            DataTypes.TIME));
+        // Only timestamp
+        dsManager.addServiceFactory(new JDateDynFieldComponentFactory(
+            DataTypes.TIMESTAMP));
+
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JNumberDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JNumberDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/JNumberDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,88 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.serv.field;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.serv.field.component.JNumberDynFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * Factory to create {@link AbstractJDynFieldComponent} objects to render
+ * {@link DynObject} attribute values of byte, short, int or long types.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class JNumberDynFieldComponentFactory extends
+    AbstractJDynFieldComponentFactory implements JDynFieldComponentFactory {
+
+    private static final String FACTORY_DESCRIPTION = "";
+
+    private final Integer dataType;
+
+    /**
+     * Constructor.
+     * 
+     * @param dataType
+     *          the current data Type
+     */
+    public JNumberDynFieldComponentFactory(Integer dataType) {
+        this.dataType = dataType;
+    }
+
+	public JDynFieldComponent createJDynFieldComponent(DynField field, ValueField parent,
+			boolean writable) throws ServiceException {
+		// TODO: take into account the writable flag
+		return new JNumberDynFieldComponent(field, parent, writable);
+    }
+
+    @Override
+    public String getFactoryDescription() {
+        return FACTORY_DESCRIPTION;
+    }
+
+    @Override
+    public String getFactorySubType() {
+        return null;
+    }
+
+    @Override
+    public Integer getFactoryType() {
+        if (dataType != null) {
+            return dataType;
+        }
+        return DataTypes.INT;
+    }
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing
___________________________________________________________________
Added: svn:ignore
   + Example1.java
Example2.java
Example3.java
Example4.java


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/resources/org/gvsig/tools/swing/serv/field/component/editdelete.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/resources/org/gvsig/tools/swing/serv/field/component/editdelete.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.swing.serv.field.ToolsSwingDefaultFieldImplLibrary
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field
___________________________________________________________________
Added: svn:ignore
   + bin
.settings
target
.classpath
.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/pom.xml	(revision 1235)
@@ -0,0 +1,28 @@
+<?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.tools.swing.serv</artifactId>
+    <packaging>pom</packaging>
+    <name>org.gvsig.tools.swing.serv</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing</artifactId>
+        <version>3.0.34-SNAPSHOT</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.spi</artifactId>
+        </dependency>
+    </dependencies>
+    <modules>
+        <module>org.gvsig.tools.swing.serv.jform</module>
+        <module>org.gvsig.tools.swing.serv.jlist</module>
+        <module>org.gvsig.tools.swing.serv.field</module>
+    </modules>
+</project>
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.swing.api.ToolsSwingLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist/pom.xml	(revision 1235)
@@ -0,0 +1,11 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.serv.jlist</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.serv.jlist</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing.serv</artifactId>
+        <version>3.0.34-SNAPSHOT</version>
+    </parent>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.jlist
___________________________________________________________________
Added: svn:ignore
   + .settings
bin
target
.classpath
.project



Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.serv
___________________________________________________________________
Added: svn:ignore
   + target
.settings
.project


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java	(revision 1235)
@@ -0,0 +1,58 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest extends TestCase {
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(AppTest.class);
+    }
+
+    /**
+     * Create the test case
+     * 
+     * @param testName
+     *            name of the test case
+     */
+    public AppTest(String testName) {
+        super(testName);
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp() {
+        assertTrue(true);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/threadsafedialogs/DefaultThreadSafeDialogsManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/threadsafedialogs/DefaultThreadSafeDialogsManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/threadsafedialogs/DefaultThreadSafeDialogsManager.java	(revision 1235)
@@ -0,0 +1,285 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.threadsafedialogs;
+
+import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager;
+import java.awt.Component;
+import java.io.File;
+import java.lang.reflect.Constructor;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.i18n.I18nManager;
+
+import org.gvsig.tools.task.RunnableWithParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Thread safe functions for showing dialogs
+ * 
+ * @author jjdelcerro
+ * 
+ */
+public class DefaultThreadSafeDialogsManager implements ThreadSafeDialogsManager {
+
+	private static Logger logger = LoggerFactory
+			.getLogger(DefaultThreadSafeDialogsManager.class);
+	private Component rootComponent;
+
+        public DefaultThreadSafeDialogsManager() {
+		this.rootComponent = null;
+	}
+
+	public DefaultThreadSafeDialogsManager(Component rootComponent) {
+		this.rootComponent = rootComponent;
+	}
+
+	protected Component getRootComponent() {
+		return this.rootComponent;
+	}
+
+	private String translate(String message) {
+            I18nManager i18nManager = ToolsLocator.getI18nManager();
+            return i18nManager.getTranslation(message);
+	}
+
+	private String translate(String message, String[] args) {
+            I18nManager i18nManager = ToolsLocator.getI18nManager();
+            return i18nManager.getTranslation(message, args);
+	}
+
+	public int confirmDialog(final String message, final String title, final int optionType,
+			final int messageType) {
+		RunnableWithParameters runnable = new RunnableWithParameters() {
+			public void run() {
+				this.returnValue = JOptionPane.showConfirmDialog(
+						getRootComponent(), message,title, optionType, messageType);
+			}
+		};
+		if (SwingUtilities.isEventDispatchThread()) {
+			runnable.run();
+		} else {
+			try {
+				SwingUtilities.invokeAndWait(runnable);
+			} catch (Exception e) {
+				logger.info("Can't show input dialog '" + message + "'.", e);
+			}
+		}
+		return (Integer) runnable.getReturnValue();
+	}
+
+	public String inputDialog(final String message, final String title, final int messageType,
+			final String initialValue) {
+		// inputDialog dlg = new inputDialog();
+		// return dlg.show(translate(message), translate(title), messageType,
+		// initialValue);
+		//
+		RunnableWithParameters runnable = new RunnableWithParameters() {
+			public void run() {
+				this.returnValue = JOptionPane.showInputDialog(
+						getRootComponent(), translate(message),
+						translate(title),
+						messageType, null, null,
+						initialValue);
+			}
+		};
+		if (SwingUtilities.isEventDispatchThread()) {
+			runnable.run();
+		} else {
+			try {
+				SwingUtilities.invokeAndWait(runnable);
+			} catch (Exception e) {
+				logger.info("Can't show input dialog '" + message + "'.", e);
+			}
+		}
+		return (String) runnable.getReturnValue();
+	}
+
+	public String inputDialog(final String message, final String title) {
+		RunnableWithParameters runnable = new RunnableWithParameters() {
+			public void run() {
+				this.returnValue = JOptionPane.showInputDialog(
+						getRootComponent(), (String) translate(message),
+						translate(title),
+						JOptionPane.QUESTION_MESSAGE, null, null, null);
+			}
+		};
+		if (SwingUtilities.isEventDispatchThread()) {
+			runnable.run();
+		} else {
+			try {
+				SwingUtilities.invokeAndWait(runnable);
+			} catch (Exception e) {
+				logger.info("Can't show input dialog '" + message + "'.", e);
+			}
+		}
+		return (String) runnable.getReturnValue();
+	}
+
+	public void messageDialog(String message, String title, int messageType) {
+		messageDialog(message, null, title, messageType);
+	}
+
+	public void messageDialog(final String message, final String messageArgs[],
+			final String title, final int messageType) {
+		if (!SwingUtilities.isEventDispatchThread()) {
+			try {
+				SwingUtilities.invokeAndWait(new Runnable() {
+					public void run() {
+						messageDialog(message, messageArgs, title, messageType);
+					}
+				});
+			} catch (Exception e) {
+				logger.info("Can't show message dialog '" + message, e);
+			}
+			return;
+		}
+
+		if (message == null) {
+			logger.info("message if null, message dialog not show.");
+			return;
+		}
+		JOptionPane.showMessageDialog(getRootComponent(),
+				translate(message, messageArgs), translate(title), messageType);
+	}
+
+
+	public Component createComponent(final Class<? extends Component> theClass,
+			final Object... parameters) {
+		return createComponentWithParams(theClass, parameters);
+	}
+
+	public Component createComponentWithParams(
+			final Class<? extends Component> theClass, final Object[] parameters) {
+		final Class<?>[] parameterTypes = new Class<?>[parameters.length];
+		for (int i = 0; i < parameters.length; i++) {
+			parameterTypes[i] = parameters[i].getClass();
+		}
+		final Component component;
+		final Constructor<?> constructor;
+		try {
+			constructor = theClass.getConstructor(parameterTypes);
+		} catch (Exception e) {
+			throw new IllegalArgumentException(e);
+		}
+		if (SwingUtilities.isEventDispatchThread()) {
+			try {
+				component = (Component) constructor.newInstance(parameters);
+			} catch (Exception e) {
+				throw new IllegalArgumentException(e);
+			}
+		} else {
+			try {
+				RunnableWithParameters runnable = new RunnableWithParameters(parameters) {
+					public void run() {
+						Constructor<?> cons = constructor;
+						try {
+							this.returnValue = cons.newInstance(parameters.toArray());
+						} catch (Exception e) {
+							String msg ="Can't create instance of components, constructor="+cons.toString()+", parameters="+this.parameters.toString()+"."; 
+							logger.info(msg,e);
+							throw new IllegalArgumentException(e);
+						}
+					}
+				};
+				SwingUtilities.invokeAndWait(runnable);
+				component = (Component) runnable.getReturnValue();
+			} catch (Exception e) {
+				throw new IllegalArgumentException(e);
+			}
+		}
+		return component;
+	}
+
+	public File[] showChooserDialog(
+			final String title,
+			final int type, // SAVE_DIALOG / OPEN_DIALOG
+			final int selectionMode, //    JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES
+			final boolean multiselection, 
+			final File initialPath,
+			final FileFilter filter,
+			final boolean fileHidingEnabled
+			) {
+		RunnableWithParameters runnable = new RunnableWithParameters() {
+			public void run() {
+				JFileChooser fc = new JFileChooser();
+				fc.setDialogTitle(title);
+				fc.setDialogType(type);
+				fc.setFileSelectionMode(selectionMode);
+				fc.setMultiSelectionEnabled(multiselection);
+				fc.setCurrentDirectory(initialPath);
+				fc.setFileFilter(filter);
+				fc.setFileHidingEnabled(fileHidingEnabled);
+				int r = JFileChooser.CANCEL_OPTION;
+				switch(type) {
+				case JFileChooser.SAVE_DIALOG:
+					r = fc.showSaveDialog(getRootComponent());
+					break;
+				case JFileChooser.OPEN_DIALOG:
+				default:
+					r = fc.showOpenDialog(getRootComponent());
+					break;
+				}
+				if( r != JFileChooser.APPROVE_OPTION ) {
+					this.returnValue = null;
+					return;
+				}
+				if( fc.isMultiSelectionEnabled() ) {
+					this.returnValue = fc.getSelectedFiles();
+				} else {
+					this.returnValue = new File[] { fc.getSelectedFile() };
+				}
+			}
+		};
+		if (SwingUtilities.isEventDispatchThread()) {
+			runnable.run();
+		} else {
+			try {
+				SwingUtilities.invokeAndWait(runnable);
+			} catch (Exception e) {
+				logger.info("Can't show chooser dialog '" + title + "'.", e);
+			}
+		}
+		return (File[]) runnable.getReturnValue();
+	}
+	
+	public File[] showOpenDirectoryDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY, false, initialPath, null, false);
+	}
+
+	
+	public File[] showOpenFileDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false);
+	}
+
+	
+	public File[] showSaveFileDialog(String title, File initialPath) {
+		return showChooserDialog(title, JFileChooser.SAVE_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false);
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/DefaultIconThemeManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/DefaultIconThemeManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/DefaultIconThemeManager.java	(revision 1235)
@@ -0,0 +1,155 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.icontheme;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.observer.ComplexObserver;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.swing.icontheme.IconTheme;
+import org.gvsig.tools.swing.icontheme.IconThemeManager;
+import org.gvsig.tools.util.FolderSet;
+import org.gvsig.tools.util.impl.DefaultFolderSet;
+
+public class DefaultIconThemeManager implements IconThemeManager , ComplexObserver{
+	private static IconThemeManager iconThemeManager = null;
+
+	private IconTheme defaultTheme = null;
+	private IconTheme currentTheme = null;
+	private Map<String, IconTheme> themesByName = null;
+	private List<IconTheme> themes = null; 
+	private FolderSet repository = null;
+
+	public static IconThemeManager getIconThemeManager(){
+		if (iconThemeManager == null){
+			iconThemeManager = new DefaultIconThemeManager();
+		}
+		return iconThemeManager;
+	}
+
+	public DefaultIconThemeManager() {
+		this.defaultTheme = new BaseIconTheme();
+		this.currentTheme = this.defaultTheme;
+		this.themesByName = null;
+		this.repository = new DefaultFolderSet();
+		this.repository.addObserver(this);
+	}
+	
+	public IconTheme getDefault() {
+		return this.defaultTheme;
+	}
+
+	public int getCount() {
+		return this.getThemes().size();
+	}
+	
+	public void setCurrent(IconTheme iconTheme) {
+		this.defaultTheme = iconTheme;
+	}
+
+	public IconTheme getCurrent() {
+		return this.currentTheme;
+	}
+
+	public IconTheme get(String themeID) {
+		return this.getThemes().get(themeID);
+	}
+
+	public IconTheme get(int index) {
+		return this.getListOfThemes().get(index);
+	}
+
+	public Iterator<IconTheme> iterator() {
+		return this.getThemes().values().iterator();
+	}
+
+	public boolean contains(IconTheme theme) {
+		return this.getThemes().containsValue(theme);
+	}
+
+	public boolean add(IconTheme theme) {
+		this.getThemes().put(theme.getID(), theme);
+		return true; 
+	}
+
+	public boolean remove(IconTheme theme) {
+		return this.getThemes().remove(theme)==null ? false: true;
+	}
+
+	public void clear() {
+		this.themesByName = null;
+		this.themes = null;
+	}
+
+	public FolderSet getRepository() {
+		return this.repository;
+	}
+
+	public void update(Observable observable, Object notification) {
+		if( observable != this.repository ) {
+			return;
+		}
+		this.clear();
+	}
+
+	private void buildThemes() {
+		Map<String, IconTheme> themesByName = new HashMap<String, IconTheme>();
+		File[] folders = this.repository.listFiles();
+		for( int i=0; i<folders.length; i++ ) {
+			if( folders[i].isDirectory() ) {
+				FolderIconTheme theme = new FolderIconTheme(this.getDefault());
+				try {
+					theme.load(folders[i]);
+					themesByName.put(theme.getID(), theme);
+					
+				} catch( IllegalArgumentException ex) {
+					// Do nothing
+				}
+			}
+		}
+		List<IconTheme> themes = new ArrayList<IconTheme>();
+		themes.addAll(themesByName.values());
+		this.themes = themes;
+		this.themesByName = themesByName;
+	}
+
+	private List<IconTheme> getListOfThemes() {
+		if( this.themes == null ) {
+			this.buildThemes();
+		}
+		return this.themes;
+	}
+	
+	private Map<String, IconTheme> getThemes() {
+		if( this.themesByName == null ) {
+			this.buildThemes();
+		}
+		return this.themesByName;
+	}
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/DefaultIconThemeManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/IconThemeZip.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/IconThemeZip.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/IconThemeZip.java	(revision 1235)
@@ -0,0 +1,144 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.icontheme;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.gvsig.installer.lib.api.PackageInfo;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.tools.swing.icontheme.IconTheme;
+
+/**
+ * Extends BaseIconTheme to add support for themes stored in zip files.
+ * 
+ * TODO: This class is under construction.
+ */
+public class IconThemeZip extends BaseIconTheme{
+
+	protected File resource = null; 
+	protected PackageInfo packageInfo = null;
+
+	public IconThemeZip(IconTheme def) {
+		super(def);
+	}
+
+	public void load(Object resource) {
+		if( !(resource instanceof File) ) {
+			throw new IllegalArgumentException();
+		}
+		File res = (File) resource;
+		if( !res.isDirectory() ) {
+			throw new IllegalArgumentException();
+		}
+		this.resource = res;
+		this.iconList = null;
+
+		this.loadPackageInfo();
+		this.setName(this.packageInfo .getName());
+		this.setDescription(this.packageInfo.getDescription());
+	}
+
+	private void loadPackageInfo() {
+		PackageManager manager = ToolsLocator.getPackageManager(); 
+		ZipFile zipFile = null;
+		try {
+			zipFile = new ZipFile(resource);
+			InputStream pkgstream = zipFile.getInputStream( zipFile.getEntry("packages.zip") );
+			this.packageInfo = manager.createPackageInfo(pkgstream);
+		} catch (Exception e) {
+			throw new IllegalArgumentException(e);
+		}
+	}
+
+	protected void deferredLoad() {
+		if (this.iconList != null) {
+			return;
+		}
+		iconList = new HashMap<String, IconTheme.Icon>();
+
+		ZipFile zipFile = null;
+		try {
+			zipFile = new ZipFile(resource);
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		Enumeration<?> entries = zipFile.entries();
+		while (entries.hasMoreElements()) {
+			ZipEntry entry = (ZipEntry) entries.nextElement();
+			if (!entry.isDirectory()) {
+				try {
+					if (isImage(entry.getName())) {
+						String name = getNameOfEntry(entry);
+						String group = getGroupOfEntry(entry);
+						URL resource = getURLOfEntry(this.resource, entry);
+						this.register(null, group, name, null, resource);
+					}
+				} catch (Exception e) {
+					logger.info("Can't register icon. Entry = " +entry.toString(), e);
+				}
+			}
+		}
+
+	}
+
+	private URL getURLOfEntry(File zip, ZipEntry entry) throws MalformedURLException, URISyntaxException {
+		String s = "jar:" + zip.toString() + "!" + entry.getName();
+		return new URI(s).toURL();
+	}
+
+	private String getGroupOfEntry(ZipEntry entry) {
+		// FIXME:
+		return "";
+	}
+
+	private String getNameOfEntry(ZipEntry entry) {
+		// FIXME: 
+		return entry.getName();
+	}
+
+	private boolean isImage(String fileName) {
+		String extension = "";
+		int pointPos = fileName.lastIndexOf(".");
+		if (pointPos>0 && pointPos < (fileName.length()-1) )
+			extension = fileName.substring(pointPos+1).toLowerCase();
+		if ( extension.equals("jpg") || extension.equals("jpeg")
+				|| extension.equals("png")
+				|| extension.equals("gif"))
+			return true;
+		else
+			return false;
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/IconThemeZip.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/BaseIconTheme.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/BaseIconTheme.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/BaseIconTheme.java	(revision 1235)
@@ -0,0 +1,536 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.icontheme;
+
+
+import java.awt.Image;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.ImageIcon;
+
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.swing.icontheme.IconTheme;
+
+
+/**
+ * <p>This class represents an icon theme, which is basically a mapping of
+ * symbolic icon names, and real icons (or icon paths). This is useful to
+ * change an application's icons in an easy way. An icon theme
+ * is usually read from disk on start up, but can also be created or
+ * modified on a later time.</p>
+ *
+ */
+public class BaseIconTheme implements IconTheme {
+	protected static Logger logger = LoggerFactory.getLogger(BaseIconTheme.class);
+
+	protected String id = null;
+	protected String name=null;
+	protected String description=null;
+	protected Map<String, Icon> iconList = null;
+	protected IconTheme defaultTheme = null;
+	protected String defaultIconName = null;
+
+	class DefaultIcon implements Icon {
+		private ImageIcon image;
+		private URL resource;
+		private String name;
+		private String group;
+		private String provider;
+		
+		DefaultIcon(String provider,  String group, String name, ImageIcon image,URL resource) {
+			this.image = image;
+			this.resource = resource;
+			this.group = group;
+			this.name = name;
+			this.provider = provider;
+		}
+		
+		public boolean existsIcon() {
+		    if (image != null) {
+		        return true;
+		    }
+		    
+		    InputStream ist = null;
+		    boolean resp = false;
+		    
+		    try {
+		        ist = resource.openStream();
+		        resp = true;
+		    } catch (Exception ex) {
+		        resp = false;
+		    }
+            try {
+                ist.close();
+            } catch (Exception ex) {
+            }
+		    return resp;
+		}
+		
+		public ImageIcon getImageIcon() {
+			if (this.image != null){
+				return this.image;
+			}
+			try {
+				this.image = new ImageIcon((URL)this.resource);
+			} catch(Exception ex) {
+				return null;
+			}
+			return this.image;
+		}
+		
+		public Image getImage() {
+			ImageIcon icon = this.getImageIcon();
+			if( icon == null ) {
+				return null;
+			}
+			return icon.getImage();
+		}
+		
+		public String getName() {
+			return name;
+		}
+		
+		public String getGroup() {
+			return group;
+		}
+		
+		public Object getResource() {
+			return resource;
+		}
+
+		public URL getURL() {
+			if( resource instanceof URL ) {
+				return (URL) this.resource;
+			}
+			return null;
+		}
+
+		public String getLabel() {
+			if( resource != null ) {
+				return resource.toString();
+			}
+			if( image != null ) {
+				return image.toString();
+			}
+			return "";
+		}
+		
+		public int compareTo(Icon other) {
+			String this_id = this.getProviderName() + "/" + this.getGroup() + "/" + this.getName();
+			String other_id = other.getProviderName() + "/" + other.getGroup() + "/" + other.getName();
+			return this_id.compareTo(other_id);
+		}
+
+		public String getProviderName() {
+			return provider;
+		}
+
+	}
+	
+	public BaseIconTheme() {
+		this(null);
+	}	
+	
+	public BaseIconTheme(IconTheme defaultIconTheme) {
+		this.setDefault(defaultIconTheme);
+		this.id = "default"; // El id no traducirlo
+		this.name = "default";
+		this.description = "Default icon theme";
+		this.iconList = new HashMap<String, Icon>();
+	}
+	
+	/**
+	 * Load the icons of the theme
+	 */
+	public void load(Object resource) {
+		// Do nothing.
+	}
+	
+	/**
+	 * Override this to load icons on demand instead of 
+	 * load on the creation of the theme.
+	 */
+	protected void deferredLoad() {
+		// Do nothing
+	}
+	
+
+	
+	private void logstack(String msg) {
+		try {
+			throw new IllegalArgumentException();
+		} catch (IllegalArgumentException e) {
+			logger.debug(msg,e);
+		}
+	}
+
+	private boolean isEmptyString(String s) {
+		if( s==null ) {
+			return true;
+		}
+		if( s.trim().length() == 0 ) {
+			return true;
+		}
+		return false;
+	}
+
+	public void setDefault(IconTheme def){
+    	if( def == this ) {
+    		defaultTheme = null;
+    	} else {
+    		defaultTheme = def;
+    	}
+    }
+
+    public IconTheme getDefault(){
+    	return defaultTheme;
+    }
+
+	public boolean exists(String iconName) {
+		if( isEmptyString(iconName) ) {
+			return false;
+		}
+		deferredLoad();
+		
+		if (iconList.containsKey(iconName)) {
+			return true;
+		}
+		if (defaultTheme !=null && defaultTheme.exists(iconName)){
+			return true;
+		}
+		return false;
+	}
+
+	public Iterator<String> iterator() {
+		Set<String> names = new HashSet<String>();
+		
+		deferredLoad();
+
+		if( defaultTheme !=null ) {
+			Iterator<String> it = defaultTheme.iterator();
+			while( it.hasNext() ) {
+				names.add(it.next());
+			}
+		}
+		Iterator<String> it = iconList.keySet().iterator();
+		while( it.hasNext() ) {
+			names.add(it.next());
+		}
+		List<String> names2 = new ArrayList<String>(names);
+		Collections.sort(names2);
+		return names2.iterator();
+	}
+	
+	public Iterator<Icon> getThemeIcons() {
+		Set<Icon> themeIcons = new HashSet<Icon>();
+		
+		deferredLoad();
+		if( defaultTheme !=null ) {
+			Iterator<Icon> it = defaultTheme.getThemeIcons();
+			while( it.hasNext() ) {
+				themeIcons.add(it.next());
+			}
+		}
+		Iterator<Icon> it = iconList.values().iterator();
+		while( it.hasNext() ) {
+			themeIcons.add(it.next());
+		}
+		List<Icon> themeIcons2 = new ArrayList<Icon>(themeIcons);
+		Collections.sort(themeIcons2);
+		return themeIcons2.iterator();
+	}
+	
+	public Icon getThemeIcon(String name) {
+		if( isEmptyString(name) ) {
+			return null;
+		}
+		deferredLoad();
+		Icon themeIcon = (Icon) iconList.get(name);
+		if( themeIcon!=null ) {
+			return themeIcon;
+		}
+		if( defaultTheme!=null && defaultTheme.exists(name)) {
+			return  defaultTheme.getThemeIcon(name);
+		}
+		return null;
+	}
+
+	public ImageIcon get(String name) {
+		ImageIcon icon = null;
+		
+		if( ! isEmptyString(name) ) {
+			deferredLoad();
+			Icon themeIcon = (Icon) iconList.get(name);
+			if( themeIcon != null ) {
+				icon = themeIcon.getImageIcon();
+				if( icon != null ) {
+					return icon;
+				}
+			}
+			if( defaultTheme!=null && defaultTheme.exists(name)) {
+				return  defaultTheme.get(name);
+			}
+		}
+		logger.info("get('"+name+"') icon not found");
+		logstack("get('"+name+"') icon not found");
+		return getNoIcon();
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String themeName) {
+		name = themeName;
+	}
+
+	public String getID() {
+		return this.id;
+	}
+	
+	public void setID(String id) {
+		this.id = id;
+	}
+	
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	/**
+	 * Returns the name of the icon theme
+	 */
+	public String toString() {
+		String s = this.getName();
+		if( isEmptyString(s) ) {
+			s = this.getID();
+		}
+		if( isEmptyString(this.getDescription()) ) {
+			return s;
+		}
+		return s + " - " + this.getDescription();
+	}
+
+	public ImageIcon getDefaultIcon() {
+		ImageIcon imageIcon = null;
+		Icon icon = null;
+		
+		icon = this.getThemeIcon(defaultIconName);
+		if( icon != null ) {
+			imageIcon = icon.getImageIcon();
+			if( imageIcon != null ) {
+				return imageIcon;
+			}
+		}
+		icon = this.getThemeIcon(NO_ICON_NAME);
+		if( icon != null ) {
+			imageIcon = icon.getImageIcon();
+			if( imageIcon != null ) {
+				return imageIcon;
+			}
+		}
+		return new ImageIcon();
+	}
+
+	public void setDefaultIcon(ImageIcon icon) {
+		this.defaultIconName = null;
+		this.register(null, null, NO_ICON_NAME, icon, null);
+	}
+
+	public void setDefaultIcon(URL resource) {
+		this.defaultIconName = null;
+		this.register(null, null, NO_ICON_NAME, null, resource);
+	}
+	
+	public void setDefaultIcon(String name) {
+		this.defaultIconName = name;
+	}
+
+	public void register(String provider, String group, String name,
+			ImageIcon icon, URL resource) {
+		if( isEmptyString(name) ) {
+			throw new IllegalArgumentException("name is empty");
+		}
+		deferredLoad();
+		if( icon == null && resource == null ) {
+			Icon themeIcon = new DefaultIcon(provider, group, name, null, null);
+			iconList.put(name, themeIcon);
+			throw new IllegalArgumentException("icon and resource for '"+getIconIdentifier(provider,group, name)+"' are null");
+		}
+		DefaultIcon themeIcon = new DefaultIcon(provider, group, name, icon, resource);
+		
+		iconList.put(name, themeIcon);
+		if (!themeIcon.existsIcon()) {
+            throw new IllegalArgumentException("Resource not found for icon '"+getIconIdentifier(provider,group, name) + "'");
+		}
+	}
+
+	private String getIconIdentifier(String provider, String group, String name) {
+		deferredLoad();
+		String identifier = null;
+		if( !isEmptyString(provider) ) {
+			identifier = provider ;
+		}
+		if( group!= null ) {
+			identifier = identifier + "/" + group;
+		}
+		if( name == null ) {
+			identifier = identifier + "/unknow";
+		} else {
+			identifier = identifier + "/" + name;
+		}
+		return identifier; 
+	}
+
+	public void registerDefault(String provider, String group,
+			String name, ImageIcon icon, URL resource) {
+		deferredLoad();
+		if (defaultTheme!=null){
+			if( !defaultTheme.exists(name)) {
+				defaultTheme.register(provider, group, name, icon, resource);
+			}
+		} else {
+			this.register(provider, group, name, icon, resource);
+		}
+	}
+
+
+	public void export(File folder) {
+		if( !folder.exists() ) {
+			folder.mkdir();
+		}
+		folder = new File(folder, this.getID());
+		if( !folder.exists() ) {
+			folder.mkdir();
+		}
+		URL url_no_icon = this.getThemeIcon(NO_ICON_NAME).getURL();
+		
+		Iterator<Icon> themeIcons = this.getThemeIcons();
+		while (themeIcons.hasNext()) {
+			Icon themeIcon = themeIcons.next();
+			URL url_src = themeIcon.getURL();
+			if( url_src == null ) {
+				url_src = url_no_icon;
+			}
+			File target;
+			if( themeIcon.getGroup()!=null ) {
+				target = new File(folder, themeIcon.getGroup());
+				target.mkdir();
+			} else {
+				target = new File(folder.getAbsolutePath());
+			}
+			target = new File(target,themeIcon.getName()+".png");
+			try {
+				FileUtils.copyURLToFile(url_src,target);
+			} catch (IOException e) {
+				// TODO 
+			}  
+		}
+	}
+	
+	// ===================================================================
+	
+	/**
+	 * @deprecated use getDefaultIcon
+	 */
+	public ImageIcon getNoIcon() {
+		return this.getDefaultIcon();
+	}
+
+	
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void registerDefault(String name, ImageIcon image) {
+		logstack("registerDefault('"+name+"'), deprecated method.");
+		try {
+			registerDefault(null, null, name, image, null);
+		} catch(IllegalArgumentException e) {
+			logger.info(e.getLocalizedMessage(), e);
+		}
+	}
+
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void registerDefault(String name, Object resource) {
+		logstack("registerDefault('"+name+"'), deprecated method.");
+		try {
+			registerDefault(null, null, name, null, (URL)resource);
+		} catch(IllegalArgumentException e) {
+			logger.info(e.getLocalizedMessage(), e);
+		}
+	}
+
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void register(String name, ImageIcon image) {
+		logstack("register('"+name+"'), deprecated method.");
+		try {
+			register(null, null, name, image, null);
+		} catch(IllegalArgumentException e) {
+			logger.info(e.getLocalizedMessage(), e);
+		}
+	}
+	
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void register(String name, Object resource) {
+		logstack("register('"+name+"'), deprecated method.");
+		try {
+			register(null, null, name, null, (URL)resource);
+		} catch(IllegalArgumentException e) {
+			logger.info(e.getLocalizedMessage(), e);
+		}
+	}
+	
+	/**
+	 * @deprecated use get(String iconName) instead.
+	 */
+	public ImageIcon get(String iconName, ClassLoader loader) {
+		logstack("get('"+iconName+"', loader), deprecated method.");
+		return this.get(iconName);
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/BaseIconTheme.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/FolderIconTheme.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/FolderIconTheme.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/FolderIconTheme.java	(revision 1235)
@@ -0,0 +1,149 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.icontheme;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+
+import org.gvsig.installer.lib.api.PackageInfo;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.packageutils.PackageManager;
+import org.gvsig.tools.swing.icontheme.IconTheme;
+
+
+/**
+ * This class extends AbstractIconTheme and implements the abstract methods of this
+ * class. This methods are <code>loadIcon</code> and <code>load</code>. This methods
+ * allows load one icon or all icons in the resource.
+ */
+public class FolderIconTheme extends BaseIconTheme{
+
+	protected File resource = null; 
+	protected PackageInfo packageInfo = null;
+	
+	/**
+	 * Constructor.Constructs an Icon Theme with a default one.
+	 * @param def. The default icon theme
+	 */
+	public FolderIconTheme(IconTheme def) {
+		super(def);
+	}
+
+	public void load(Object resource) throws IllegalArgumentException {
+		if( !(resource instanceof File) ) {
+			throw new IllegalArgumentException();
+		}
+		File res = (File) resource;
+		if( !res.isDirectory() ) {
+			throw new IllegalArgumentException();
+		}
+		this.resource = res;
+		this.iconList = null;
+
+		this.loadPackageInfo();
+		this.setID(this.packageInfo.getID());
+		this.setName(this.packageInfo.getName());
+		this.setDescription(this.packageInfo.getDescription());
+	}
+	
+	private void loadPackageInfo() {
+		File pkgfile = new File(this.resource,"package.info"); 
+		PackageManager manager = ToolsLocator.getPackageManager(); 
+		try {
+			this.packageInfo = manager.createPackageInfo(pkgfile.toURI().toURL().openStream());
+		} catch (Exception e) {
+			throw new IllegalArgumentException(e);
+		}
+		
+	}
+
+	protected void deferredLoad() {
+		if( this.iconList != null ) {
+			return;
+		}
+		iconList = new HashMap<String, IconTheme.Icon>();
+		
+		load(resource, "");
+		
+		File[] files = resource.listFiles();
+		for (int i=files.length-1; i>=0; i--) {
+			if( files[i].isDirectory() ) {
+				load(files[i],files[i].getName());
+			}
+		}
+	}
+
+	private void load(File folder, String group) {
+		File[] imagefiles = folder.listFiles(new ImageFileFilter());
+		String name;
+		for (int i=imagefiles.length-1; i>=0; i--) {
+			name = computeKey(imagefiles[i].getName());
+			try {
+				this.register(null, group, name, null, imagefiles[i].toURI().toURL());
+			} catch (MalformedURLException e) {
+				logger.info("Can't load icon", e);
+			}
+		}
+	}
+
+	
+	
+	/**
+	 * This class allows filter the images in the directory. Allows to load the images
+	 * with a apropiate extension.
+	 */
+	private class ImageFileFilter implements FilenameFilter {
+		public boolean accept(File dir, String fileName) {
+			String extension = "";
+			int pointPos = fileName.lastIndexOf(".");
+			if (pointPos>0 && pointPos < (fileName.length()-1) )
+				extension = fileName.substring(pointPos+1).toLowerCase();
+			if ( extension.equals("jpg") || extension.equals("jpeg")
+					|| extension.equals("png")
+					|| extension.equals("gif")
+
+					)
+				return true;
+			else
+				return false;
+		}
+	}
+
+	/**
+	 * Returns the key of the image without extension
+	 * @param fileName
+	 * @return string
+	 */
+	private String computeKey(String fileName) {
+		int pointPos = fileName.lastIndexOf(".");
+		if (pointPos!=-1)
+			return fileName.substring(0, pointPos);
+		else
+			return fileName;
+	}
+
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/icontheme/FolderIconTheme.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultEvaluatorPanel.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultEvaluatorPanel.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultEvaluatorPanel.java	(revision 1235)
@@ -0,0 +1,661 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.component;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+
+import javax.swing.AbstractButton;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextPane;
+import javax.swing.ListSelectionModel;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyledDocument;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
+import org.gvsig.tools.evaluator.EvaluatorWithDescriptions.Description;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.swing.api.evaluator.EvaluatorPanel;
+//import org.gvsig.tools.swing.impl.dynobject.dynfield.DynFieldListItem;
+
+
+/**
+ * 
+ * @author jldominguez
+ *
+ */
+public class DefaultEvaluatorPanel extends EvaluatorPanel
+implements ListSelectionListener, MouseListener, ActionListener {
+
+    private DynClass dynclass = null;
+    private EvaluatorWithDescriptions eval_wdesc = null;
+    
+    private JTextArea expressionArea = null;
+    private JList fieldList = null;
+    private JList opfuList = null;
+    private JPanel categRadioPanel = null;
+    
+    private JTextArea fieldExplainLabel = null;
+    private JTextArea opfuDescLabel = null;
+    
+    private JRadioButton num_CategRB = null;
+    private JRadioButton str_CategRB = null;
+    private JRadioButton dat_CategRB = null;
+    private JRadioButton geo_CategRB = null;
+    private JRadioButton boo_CategRB = null;
+    private JRadioButton all_CategRB = null;
+    
+    private JPanel opfuDescPanel = null;
+    private JScrollPane opfuDescScroll = null;
+    private JPanel opfuPanel = null;
+    private JPanel fieldsPanel = null;
+    
+    private JPanel topPanel = null;
+    private JPanel expressionPanel = null;
+    
+    private JButton clearButton = null;
+    private JButton validateButton = null;
+    
+    private static I18nManager im = ToolsLocator.getI18nManager();
+    
+    public DefaultEvaluatorPanel(
+        DynClass dcla, EvaluatorWithDescriptions evaluator) {
+        initialize(dcla, evaluator);
+    }
+
+    public String getExpression() {
+        return getExpressionArea().getText();
+    }
+    
+    public void initialize(DynClass dcla, EvaluatorWithDescriptions evaluator) {
+        dynclass = dcla;
+        eval_wdesc = evaluator;
+        initComponents();
+    }
+    
+    /**
+     * 
+     */
+    private void initComponents() {
+        
+        this.setLayout(new GridBagLayout());
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.fill = GridBagConstraints.BOTH;
+        gbc.weightx = 1;
+        gbc.weighty = 0.8;
+        gbc.gridheight = 2;
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        this.add(getTopPanel(), gbc);
+        gbc.weightx = 1;
+        gbc.weighty = 0.2;
+        gbc.gridheight = 1;
+        gbc.gridy = 2;
+        gbc.insets = new Insets(5, 0, 0, 0);
+        this.add(getExpressionPanel(), gbc);
+        
+    }
+
+    
+    private JTextArea getExpressionArea() {
+        if (expressionArea == null) {
+            expressionArea = new JTextArea();
+            expressionArea.setLineWrap(true);
+            expressionArea.setWrapStyleWord(true);
+            if (eval_wdesc != null) {
+                expressionArea.setText(eval_wdesc.getSQL());
+            }
+        }
+        return expressionArea;
+    }
+    
+    private JPanel getExpressionPanel() {
+        
+        if (expressionPanel == null) {
+            expressionPanel = new JPanel();
+            expressionPanel.setLayout(new BorderLayout());
+            expressionPanel.setBorder(BorderFactory.createTitledBorder(
+                im.getTranslation("_User_expression")));
+            
+            JScrollPane scroll = new JScrollPane(getExpressionArea());
+            scroll.setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+            scroll.setVerticalScrollBarPolicy(
+                ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+            expressionPanel.add(scroll, BorderLayout.CENTER);
+            
+            JPanel buttonsp = new JPanel();
+            buttonsp.setLayout(new GridLayout(1, 1));
+            // ========================
+            // JPanel aux = new JPanel();
+            // aux.add(getValidateButton());
+            // buttonsp.add(aux);
+            // =====================
+            JPanel aux = new JPanel();
+            aux.add(getClearButton());
+            buttonsp.add(aux);
+            // ===========================
+            expressionPanel.add(buttonsp, BorderLayout.EAST);
+        }
+        return expressionPanel;
+        
+    }
+
+    
+    /**
+     * @return
+     */
+    private Component getClearButton() {
+        if (clearButton == null) {
+            clearButton = new JButton(im.getTranslation("_Clear"));
+            clearButton.addActionListener(this);
+        }
+        return clearButton;
+    }
+
+    /**
+     * @return
+     */
+    private JButton getValidateButton() {
+        if (validateButton == null) {
+            validateButton = new JButton(im.getTranslation("_Validate"));
+            validateButton.addActionListener(this);
+        }
+        return validateButton;
+    }
+
+    private JList getFieldList() {
+        if (fieldList == null) {
+            fieldList = new JList();
+            if (dynclass != null) {
+                
+                fieldList.addListSelectionListener(this);
+                DynField[] ff = dynclass.getDynFields();
+                DefaultListModel resultList = new DefaultListModel();
+                for (int i=0; i<ff.length; i++) {
+                    resultList.addElement(ff[i].getName());
+                }
+                fieldList.setModel(resultList);
+                fieldList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+                fieldList.addMouseListener(this);
+            }
+        }
+        return fieldList;
+    }
+
+    
+    private JList getOpfuList() {
+        if (opfuList == null) {
+            opfuList = new JList();
+            reloadOpfuList(opfuList);
+            opfuList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+            opfuList.addListSelectionListener(this);
+            opfuList.addMouseListener(this);
+        }
+        return opfuList;
+    }
+
+
+    private void reloadOpfuList(JList list) {
+        
+        DefaultListModel dlm = new DefaultListModel();
+        if (this.eval_wdesc != null) {
+            Description[] descs = getCurrentDescriptions(eval_wdesc);
+            for (int i=0; i<descs.length; i++) {
+                dlm.addElement(new DescriptionListItem(descs[i]));
+            }
+        }
+        list.setModel(dlm);
+
+    }
+
+    private Description[] getCurrentDescriptions(
+        EvaluatorWithDescriptions eval) {
+        
+        int goodbits = 0;
+        if (getAllCategRB().isSelected()) {
+            goodbits =
+                EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_ALL;
+        } else {
+            if (getNumCategRB().isSelected()) {
+                goodbits = EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_NUMBER;
+            } else {
+                if (getStrCategRB().isSelected()) {
+                    goodbits = EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_STRING;
+                } else {
+                    if (getDatCategRB().isSelected()) {
+                        goodbits = EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_DATETIME;
+                    } else {
+                        if (getGeoCategRB().isSelected()) {
+                            goodbits = EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_GEOMETRY;
+                        } else {
+                            if (getBooCategRB().isSelected()) {
+                                goodbits = EvaluatorWithDescriptions.Description.DATATYPE_CATEGORY_BOOLEAN;
+                            } else {
+                                
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        ArrayList list = new ArrayList();
+        Description[] dd = eval.getAvailableOperators();
+        int andop = 0;
+        for (int i=0; i<dd.length; i++) {
+            andop = (dd[i].getDataTypeCategories() & goodbits);
+            if (goodbits == 0 /* all */ || andop != 0) {
+                list.add(dd[i]);
+            }
+        }
+        dd = eval.getAvailableFunctions();
+        for (int i=0; i<dd.length; i++) {
+            andop = (dd[i].getDataTypeCategories() & goodbits);
+            if (goodbits == 0 /* all */ || andop != 0) {
+                list.add(dd[i]);
+            }
+        }
+        
+        return (Description[]) list.toArray(new Description[0]);
+    }
+
+    private JRadioButton getAllCategRB() {
+        if (all_CategRB == null) {
+            this.all_CategRB = new JRadioButton(im.getTranslation("_All"));
+            this.all_CategRB.addActionListener(this);
+        }
+        return all_CategRB;
+    }
+
+
+    private JRadioButton getNumCategRB() {
+        if (num_CategRB == null) {
+            this.num_CategRB = new JRadioButton(im.getTranslation("_Numeric"));
+            this.num_CategRB.addActionListener(this);
+        }
+        return num_CategRB;
+    }
+
+
+    private JRadioButton getStrCategRB() {
+        if (str_CategRB == null) {
+            this.str_CategRB = new JRadioButton(im.getTranslation("_String"));
+            this.str_CategRB.addActionListener(this);
+        }
+        return str_CategRB;
+    }
+
+
+    private JRadioButton getDatCategRB() {
+        if (dat_CategRB == null) {
+            this.dat_CategRB = new JRadioButton(
+                im.getTranslation("_Date_or_time"));
+            this.dat_CategRB.addActionListener(this);
+        }
+        return dat_CategRB;
+    }
+
+
+    private JRadioButton getGeoCategRB() {
+        if (geo_CategRB == null) {
+            this.geo_CategRB = new JRadioButton(im.getTranslation("_Geometry"));
+            this.geo_CategRB.addActionListener(this);
+        }
+        return geo_CategRB;
+    }
+
+    
+    private JPanel getCategRadioPanel() {
+        if (categRadioPanel == null) {
+            categRadioPanel = new JPanel();
+            ButtonGroup bg = new ButtonGroup();
+            bg.add(getAllCategRB());
+            bg.add(getNumCategRB());
+            bg.add(getStrCategRB());
+            bg.add(getDatCategRB());
+            bg.add(getBooCategRB());
+            bg.add(getGeoCategRB());
+            getAllCategRB().setSelected(true);
+            categRadioPanel.setLayout(new GridBagLayout());
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.anchor = GridBagConstraints.NORTHWEST;
+            gbc.fill = GridBagConstraints.BOTH;
+            gbc.weightx = 0.5;
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            categRadioPanel.add(getAllCategRB(), gbc);
+            gbc.gridy = 1;
+            categRadioPanel.add(getNumCategRB(), gbc);
+            gbc.gridy = 2;
+            categRadioPanel.add(getStrCategRB(), gbc);
+            gbc.gridy = 3;
+            categRadioPanel.add(getDatCategRB(), gbc);
+            gbc.gridy = 4;
+            categRadioPanel.add(getBooCategRB(), gbc);
+            gbc.gridy = 5;
+            categRadioPanel.add(getGeoCategRB(), gbc);
+            gbc.gridy = 6;
+            gbc.weighty = 1;
+            categRadioPanel.add(new JPanel(), gbc);
+        }
+        return categRadioPanel;
+    }
+
+    
+    /**
+     * @return
+     */
+    private JRadioButton getBooCategRB() {
+        if (boo_CategRB == null) {
+            this.boo_CategRB = new JRadioButton(im.getTranslation("_Boolean"));
+            this.boo_CategRB.addActionListener(this);
+        }
+        return boo_CategRB;
+    }
+
+    private JTextArea getOpfuDescLabel(Color bgcolor) {
+        if (opfuDescLabel == null) {
+            opfuDescLabel = new JTextArea();
+            opfuDescLabel.setEditable(false);
+            opfuDescLabel.setBorder(new EmptyBorder(2,2,2,2));
+            if (bgcolor != null) {
+                opfuDescLabel.setBackground(bgcolor);
+            }
+            opfuDescLabel.setWrapStyleWord(true);
+            opfuDescLabel.setLineWrap(true);
+            opfuDescLabel.setFont(new JLabel().getFont());
+            opfuDescLabel.setText(" \n \n \n ");
+        }
+        return opfuDescLabel;
+    }
+    
+    private JPanel getOpfuListCategPanel() {
+        
+        if (opfuDescPanel == null) {
+            opfuDescPanel = new JPanel();
+            opfuDescPanel.setLayout(new GridBagLayout());
+            
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.fill = GridBagConstraints.BOTH;
+            gbc.anchor = GridBagConstraints.NORTHWEST;
+            gbc.weightx = 0.5;
+            gbc.weighty = 1;
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            
+            JScrollPane scroll = new JScrollPane(getOpfuList());
+            scroll.setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+            scroll.setVerticalScrollBarPolicy(
+                ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+            // scroll.setMinimumSize(new Dimension(100, 100));
+            opfuDescPanel.add(scroll, gbc);
+            
+            gbc.weightx = 0.5;
+            gbc.weighty = 1;
+            gbc.gridx = 1;
+            gbc.insets = new Insets(0, 5, 0, 0);
+            opfuDescPanel.add(getCategRadioPanel(), gbc);
+        }
+        return opfuDescPanel;
+    }
+    
+    private JPanel getOpfuPanel() {
+        if (opfuPanel == null) {
+            opfuPanel = new JPanel();
+            opfuPanel.setLayout(new GridBagLayout());
+            
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.anchor = GridBagConstraints.NORTHWEST;
+            gbc.fill = GridBagConstraints.BOTH;
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            gbc.gridheight = 2;
+            gbc.weightx = 1;
+            gbc.weighty = 0.5;
+            
+            opfuPanel.add(getOpfuListCategPanel(), gbc);
+            
+            gbc.gridx = 0;
+            gbc.gridy = 2;
+            gbc.weightx = 1;
+            gbc.weighty = 0.5;
+            gbc.gridheight = 1;
+            gbc.insets = new Insets(5, 0, 0, 0);
+            
+            opfuPanel.add(
+                getOpfuDescScroll(opfuPanel.getBackground()), gbc);
+            // ==================
+            opfuPanel.setBorder(BorderFactory.createTitledBorder(
+                im.getTranslation("_Available_functions_and_operators")));
+            // ==================
+            ActionEvent aev = new ActionEvent(getAllCategRB(), 0, "");
+            this.actionPerformed(aev);
+            
+        }
+        return opfuPanel;
+    }
+    
+    private JScrollPane getOpfuDescScroll(Color bg) {
+        
+        if (opfuDescScroll == null) {
+            opfuDescScroll = new JScrollPane(getOpfuDescLabel(bg));
+            opfuDescScroll.setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+            opfuDescScroll.setVerticalScrollBarPolicy(
+                ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+            opfuDescScroll.setBorder(new EmptyBorder(0, 0, 0, 0));
+            
+        }
+        return opfuDescScroll;
+    }
+    
+    private JTextArea getFieldExplainLabel(Color bgcolor) {
+        if (fieldExplainLabel == null) {
+            fieldExplainLabel = new JTextArea();
+            fieldExplainLabel.setEditable(false);
+            fieldExplainLabel.setBorder(new EmptyBorder(2,2,2,2));
+            fieldExplainLabel.setBackground(bgcolor);
+            fieldExplainLabel.setLineWrap(true);
+            fieldExplainLabel.setWrapStyleWord(true);
+            fieldExplainLabel.setFont(new JLabel().getFont());
+            fieldExplainLabel.setText(
+                im.getTranslation("_Double-click_to_paste_into_expression_box"));
+        }
+        return fieldExplainLabel;
+    }
+    
+    private JPanel getFieldsPanel() {
+        if (fieldsPanel == null) {
+            fieldsPanel = new JPanel();
+            fieldsPanel.setLayout(new GridLayout(1, 2, 12, 0));
+            
+            /*
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.fill = GridBagConstraints.BOTH;
+            gbc.anchor = GridBagConstraints.NORTHWEST;
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            gbc.weightx = 1;
+            gbc.weighty = 1;
+            */
+            
+            JScrollPane scroll = new JScrollPane(getFieldList());
+            scroll.setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+            scroll.setVerticalScrollBarPolicy(
+                ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+            scroll.setMinimumSize(new Dimension(100, 100));
+            fieldsPanel.add(scroll); // , gbc);
+            
+            /*
+            gbc.gridx = 1;
+            gbc.insets = new Insets(0, 5, 0, 0);
+            */
+            fieldsPanel.add(
+                getFieldExplainLabel(fieldsPanel.getBackground()));
+                // , gbc);
+            
+            // ================
+            fieldsPanel.setBorder(BorderFactory.createTitledBorder(
+                im.getTranslation("_Available_fields")));
+        }
+        return fieldsPanel;
+    }
+    
+    private JPanel getTopPanel() {
+        if (topPanel == null) {
+            topPanel = new JPanel();
+            topPanel.setLayout(new GridLayout(1, 2, 12, 0));
+            topPanel.add(getFieldsPanel());
+            topPanel.add(getOpfuPanel());
+        }
+        
+        return topPanel;
+    }
+    
+
+    public void valueChanged(ListSelectionEvent e) {
+        
+        if (e.getSource() == this.getOpfuList()) {
+            Object sel = this.getOpfuList().getSelectedValue();
+            if (sel instanceof DescriptionListItem) {
+                DescriptionListItem item = (DescriptionListItem) sel;
+                String txt = item.getDescription().getTemplate() + " : "
+                    + item.getDescription().getDescription();
+                this.getOpfuDescLabel(null).setText(txt);
+                this.getOpfuDescLabel(null).scrollRectToVisible(
+                    new Rectangle(0, 0, 10, 10));
+                
+                // =============
+                this.getOpfuDescLabel(null).setCaretPosition(0);
+                
+            } else {
+                this.getOpfuDescLabel(null).setText(" \n \n \n ");
+            }
+            return;
+        }
+    }
+
+
+    public void mousePressed(MouseEvent e) {
+        
+        Object src = e.getSource();
+        
+        if (src == this.getFieldList() && e.getClickCount() == 2) {
+            // paste field in text area
+            Object sel = this.getFieldList().getSelectedValue();
+            if (sel instanceof String) {
+                int pos = this.getExpressionArea().getCaretPosition();
+                this.getExpressionArea().insert((String) sel, pos);
+            }
+            return;
+        }
+
+        if (src == this.getOpfuList() && e.getClickCount() == 2) {
+            // paste function/operator in text area
+            Object sel = this.getOpfuList().getSelectedValue();
+            if (sel instanceof DescriptionListItem) {
+                DescriptionListItem item = (DescriptionListItem) sel;
+                int pos = this.getExpressionArea().getCaretPosition();
+                this.getExpressionArea().insert(
+                    item.getDescription().getTemplate(), pos);
+            }
+            return;
+        }
+
+    }
+    public void mouseReleased(MouseEvent e) { }
+    public void mouseEntered(MouseEvent e) { }
+    public void mouseExited(MouseEvent e) { }
+    public void mouseClicked(MouseEvent e) { }
+    
+    private class DescriptionListItem {
+        
+        private Description desc = null;
+        
+        public DescriptionListItem(Description d) {
+            desc = d;
+        }
+        
+        public String toString() {
+            return desc.getName();
+        }
+        
+        public Description getDescription() {
+            return desc;
+        }
+        
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        
+        if (e.getSource() instanceof JRadioButton) {
+            this.reloadOpfuList(this.getOpfuList());
+        }
+        
+        if (e.getSource() == this.getClearButton()) {
+            this.getExpressionArea().setText("");
+        }
+
+        if (e.getSource() == this.getValidateButton()) {
+            // this.getExpressionArea().setText("");
+        }
+
+    }
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultComponentSwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultComponentSwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/component/DefaultComponentSwingManager.java	(revision 1235)
@@ -0,0 +1,51 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.component;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
+import org.gvsig.tools.swing.api.ToolsSwingLibrary;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.evaluator.ComponentSwingManager;
+import org.gvsig.tools.swing.api.evaluator.EvaluatorPanel;
+
+
+/**
+ * Default implementation of (@link ComponentSwingManager)
+ * Registered in {@link ToolsSwingLibrary}
+ * 
+ * @author jldominguez
+ *
+ */
+public class DefaultComponentSwingManager
+implements ComponentSwingManager {
+
+    public EvaluatorPanel getEvaluatorPanel(
+        DynClass dclass,
+        EvaluatorWithDescriptions evaluator) {
+
+        return new DefaultEvaluatorPanel(dclass, evaluator);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultTaskStatusSwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultTaskStatusSwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultTaskStatusSwingManager.java	(revision 1235)
@@ -0,0 +1,64 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.task;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.swing.api.task.JTaskStatus;
+import org.gvsig.tools.swing.api.task.JTasksStatus;
+import org.gvsig.tools.swing.api.task.JTasksStatusList;
+import org.gvsig.tools.swing.api.task.TaskStatusSwingManager;
+import org.gvsig.tools.task.TaskStatusManager;
+
+/**
+ * Default implementation of the {@link TaskStatusSwingManager}.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultTaskStatusSwingManager implements TaskStatusSwingManager {
+
+    public JTasksStatus createJTasksStatus() {
+        return new DefaultJTasksStatus();
+    }
+
+    public JTasksStatus createJTasksStatus(TaskStatusManager manager) {
+        return new DefaultJTasksStatus(manager);
+    }
+
+    public JTasksStatusList createJTasksStatusList() {
+        return new DefaultJTasksStatusList(this.getManager());
+    }
+
+    public JTasksStatusList createJTasksStatusList(TaskStatusManager manager) {
+        return new DefaultJTasksStatusList(manager);
+    }
+
+    public JTaskStatus createJTaskStatus() {
+        return new DefaultJTaskStatus();
+    }
+
+    private TaskStatusManager getManager() {
+        return ToolsLocator.getTaskStatusManager();
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultTaskStatusSwingManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatusList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatusList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatusList.java	(revision 1235)
@@ -0,0 +1,134 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.task;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.BoxLayout;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.task.JTaskStatus;
+import org.gvsig.tools.swing.api.task.JTasksStatusList;
+import org.gvsig.tools.swing.api.task.TaskStatusSwingManager;
+import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.TaskStatusManager;
+
+/**
+ * Default implementation of the {@link JTasksStatusList}.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultJTasksStatusList extends JTasksStatusList implements
+    Observer {
+
+    private static final long serialVersionUID = 7740032506050392725L;
+
+    TaskStatusManager manager;
+    Map<String, JTaskStatus> taskControls;
+    JPanel listPanel;
+
+    public DefaultJTasksStatusList(TaskStatusManager manager) {
+        this.manager = manager;
+        this.taskControls = new HashMap<String, JTaskStatus>();
+        this.makeUI();
+        this.manager.addObserver(this);
+    }
+
+    public TaskStatusManager getManager() {
+        return this.manager;
+    }
+
+    private void makeUI() {
+        this.setLayout(new BorderLayout());
+
+        listPanel = new JPanel();
+        listPanel.setLayout(new BoxLayout(listPanel, BoxLayout.Y_AXIS));
+        List<JTaskStatus> controlsToAdd = this.getControlsToAdd();
+        for (JTaskStatus taskStatus : controlsToAdd) {
+            listPanel.add(taskStatus);
+        }
+
+        JScrollPane scroller = new JScrollPane(listPanel);
+        scroller.setPreferredSize(new Dimension(300, 150));
+        this.add(scroller, BorderLayout.CENTER);
+    }
+
+    private List<JTaskStatus> getControlsToAdd() {
+        List<JTaskStatus> controlsToAdd = new ArrayList<JTaskStatus>();
+        TaskStatusSwingManager manager =
+            ToolsSwingLocator.getTaskStatusSwingManager();
+
+        @SuppressWarnings("unchecked")
+        Map<String, TaskStatus> tasksStatus = this.manager.getAll();
+
+        Iterator<Entry<String, TaskStatus>> taskStatusIterator =
+            tasksStatus.entrySet().iterator();
+        while (taskStatusIterator.hasNext()) {
+            Entry<String, TaskStatus> entry = taskStatusIterator.next();
+            if (this.taskControls.get(entry.getKey()) == null) {
+                JTaskStatus control = manager.createJTaskStatus();
+                control.bind(entry.getValue());
+                controlsToAdd.add(control);
+                this.taskControls.put(entry.getKey(), control);
+            }
+        }
+        return controlsToAdd;
+    }
+
+    public void update(Observable observable, Object notification) {
+        if (!(observable instanceof TaskStatusManager)) {
+            return;
+        }
+        if (notification == null) {
+            // remove task
+            Iterator<Entry<String, JTaskStatus>> taskStatusIterator =
+                this.taskControls.entrySet().iterator();
+            while (taskStatusIterator.hasNext()) {
+                Entry<String, JTaskStatus> entry = taskStatusIterator.next();
+                if (this.manager.get(entry.getKey()) == null) {
+                    listPanel.remove(entry.getValue());
+                }
+            }
+            listPanel.validate();
+            return;
+        }
+        List<JTaskStatus> controlsToAdd = this.getControlsToAdd();
+        for (JTaskStatus taskStatus : controlsToAdd) {
+            listPanel.add(taskStatus);
+        }
+
+    }
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatusList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTaskStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTaskStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTaskStatus.java	(revision 1235)
@@ -0,0 +1,248 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.task;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.swing.api.task.JTaskStatus;
+import org.gvsig.tools.task.SimpleTaskStatus;
+import org.gvsig.tools.task.TaskStatus;
+
+/**
+ * Default implementation of the {@link JTaskStatus}.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultJTaskStatus extends JTaskStatus implements Observer {
+
+	private static final long serialVersionUID = -1908456747637477552L;
+
+	private JLabel titlelabel = null;
+	private JLabel messagelabel = null;
+	private JProgressBar progressBar = null;
+	private JButton cancelRequestButton = null;
+	private JButton removeTaskButton; 
+
+	private boolean showCancelButton;
+	private boolean showRemoveTaskButton;
+
+	private TaskStatus taskStatus;
+
+	public DefaultJTaskStatus() {
+		this.taskStatus = null;
+		this.showCancelButton = true;
+		this.createComponents();
+	}
+	
+	public DefaultJTaskStatus(TaskStatus taskStatus) {
+		this();
+		this.bind(taskStatus);
+	}
+	
+	public boolean getShowCancelButton() {
+		return this.showCancelButton;
+	}
+	
+	public void setShowCancelButton(boolean showCancelButton) {
+		this.showCancelButton = showCancelButton;
+		if( this.cancelRequestButton != null ) {
+    		this.cancelRequestButton.setVisible(this.showCancelButton);
+    	}
+	}
+	
+	public boolean getShowRemoveTaskButton() {
+		return this.showRemoveTaskButton;
+	}
+	
+	public void setShowRemoveTaskButton(boolean showRemoveTaskButton) {
+		this.showRemoveTaskButton = showRemoveTaskButton;
+		if( this.removeTaskButton != null ) {
+    		this.removeTaskButton.setVisible(this.showRemoveTaskButton);
+    	}
+	}
+	
+	public JComponent asJComponent() {
+		return this;
+	}
+
+	public void bind(TaskStatus taskStatus) {
+		if( this.taskStatus!=null ) {
+			this.taskStatus.deleteObserver(this);
+		}
+		this.taskStatus = taskStatus;
+		if( this.taskStatus!=null ) {
+			this.taskStatus.addObserver(this);
+		}
+	}
+
+	private void createComponents() {
+		this.titlelabel = new JLabel();
+		
+		this.progressBar = new JProgressBar(1,100);
+        this.progressBar.setPreferredSize(new Dimension(200, 10));
+		this.progressBar.setIndeterminate(false);
+		this.progressBar.setBorderPainted(true);
+		
+		this.cancelRequestButton = new JButton();
+		this.cancelRequestButton.setPreferredSize( new Dimension(16, 16));
+		this.cancelRequestButton.setBorderPainted(false);
+    	this.cancelRequestButton.setIcon( getIcon("cancelRequestButton.png"));
+    	this.cancelRequestButton.setDisabledIcon( getIcon("disabledCancelRequestButton.png") );
+    	if( !this.showCancelButton ) {
+    		this.cancelRequestButton.setVisible(this.showCancelButton);
+    	}
+    	this.cancelRequestButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				cancelRequestButton.setEnabled(false);
+				taskStatus.cancelRequest();
+			}
+		});
+		this.removeTaskButton = new JButton();
+		this.removeTaskButton.setPreferredSize( new Dimension(16, 16));
+		this.removeTaskButton.setBorderPainted(false);
+    	this.removeTaskButton.setIcon( getIcon("removeTaskButton.png"));
+    	this.removeTaskButton.setDisabledIcon( getIcon("disabledRemoveTaskButton.png") );
+    	this.removeTaskButton.setEnabled(false);
+    	this.removeTaskButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				if( !taskStatus.isRunning() ) {
+					taskStatus.getManager().remove(taskStatus);
+				}
+			}
+		});
+    	
+		this.messagelabel = new JLabel();
+
+		this.setLayout(new GridBagLayout());
+		
+		this.add(this.titlelabel, 0, 0, GridBagConstraints.HORIZONTAL, 0.98, 0);
+		this.add(this.progressBar, 0, 1, GridBagConstraints.HORIZONTAL, 0.98, 0);
+		this.add(this.messagelabel, 0, 2, GridBagConstraints.HORIZONTAL, 0.98, 0);
+		this.add(this.cancelRequestButton, 1, 1, GridBagConstraints.NONE, 0.01, 0);
+		this.add(this.removeTaskButton, 2, 1, GridBagConstraints.NONE, 0.01, 0);
+	}
+
+	private ImageIcon getIcon(String name) {
+		URL iconurl = this.getClass().getResource(name);
+		if( iconurl == null ) {
+			return new ImageIcon();
+		}
+		return new ImageIcon(iconurl);
+	}
+	
+	private void add(Component comp, int gridx, int gridy, int fill, double weightx, double weighty) {
+		GridBagConstraints c = new GridBagConstraints();
+		c.fill = fill;
+		c.gridx = gridx;
+		c.gridy = gridy;
+		c.weightx = weightx;
+		c.weighty = weighty;
+		this.add(comp, c);
+	}
+
+	
+	public void update(final Observable observable, final Object notification) {
+
+		if(observable != null && !(observable instanceof TaskStatus) ) {
+			return;
+		}
+		if( !SwingUtilities.isEventDispatchThread()) {
+			SwingUtilities.invokeLater( new Runnable() {
+				public void run() {
+					update(observable, notification);
+				}
+			});
+			return;
+		}
+		TaskStatus taskStatus = (TaskStatus) observable;
+		if( taskStatus == null || !taskStatus.isRunning() ) {
+			this.messagelabel.setText(taskStatus.getLabel());
+			
+			this.progressBar.setIndeterminate(false);
+			this.progressBar.setValue(100);
+			this.cancelRequestButton.setEnabled(false);
+			this.removeTaskButton.setEnabled(true);
+			return;
+		}
+		
+        if (taskStatus.getTitle() == null) {
+            this.titlelabel.setText("Unknown");
+        } else {
+            this.titlelabel.setText(taskStatus.getTitle());
+        }
+        this.messagelabel.setText(taskStatus.getLabel());
+        this.progressBar.setIndeterminate( taskStatus.isIndeterminate() );
+        this.progressBar.setValue( taskStatus.getCompleted() );
+		
+		if( !this.cancelRequestButton.isEnabled() ) {
+			this.cancelRequestButton.setEnabled(true);
+		}
+		
+	}
+
+	public TaskStatus getTaskStatus() {
+		return this.taskStatus;
+	}
+
+	public void setTittle(String tittle) {
+        setTitle(tittle);
+    }
+
+    @Override
+    public void setTitle(String title) {
+        if (this.taskStatus instanceof SimpleTaskStatus) {
+            ((SimpleTaskStatus) this.taskStatus).setTitle(title);
+        }
+	}
+
+	public void message(String message) {
+		if( this.taskStatus instanceof SimpleTaskStatus ) {
+			((SimpleTaskStatus)this.taskStatus).message(message);
+		}
+	}
+
+	public void setCurValue(long value) {
+		if( this.taskStatus instanceof SimpleTaskStatus ) {
+			((SimpleTaskStatus)this.taskStatus).setCurValue(value);
+		}
+	}
+
+	
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTaskStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatus.java	(revision 1235)
@@ -0,0 +1,203 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.task;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.task.JTasksStatus;
+import org.gvsig.tools.swing.api.task.JTasksStatusList;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.gvsig.tools.task.TaskStatus;
+import org.gvsig.tools.task.TaskStatusManager;
+
+/**
+ * Default implementation of the {@link JTasksStatus}.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DefaultJTasksStatus extends JTasksStatus implements Observer {
+
+	private static final long serialVersionUID = 245436792193991920L;
+
+	private TaskStatusManager manager = null;
+	private JLabel label = null;
+	private JProgressBar progressBar = null;
+	private JButton showAllTaskStatusButton = null;
+	
+	public DefaultJTasksStatus() {
+		this(ToolsLocator.getTaskStatusManager());
+	}
+	
+	public DefaultJTasksStatus(TaskStatusManager manager) {
+		this.bind(manager);
+		this.createComponents();
+	}
+	
+	public JComponent asJComponent() {
+		return this;
+	}
+	
+	public void bind(TaskStatusManager manager) {
+		if( this.manager!=null ) {
+			this.manager.deleteObserver(this);
+		}
+		this.manager = manager;
+		if( this.manager!= null ) {
+			this.manager.addObserver(this);
+		}
+	}
+
+	public Dimension getPreferredSize() {
+		Dimension d = super.getPreferredSize();
+		return new Dimension( 270, d.height);
+	}
+	
+	private void createComponents() {
+		this.label = new JLabel();
+		
+		this.progressBar = new JProgressBar(1,100);
+        this.progressBar.setPreferredSize(new Dimension(40, 10));
+		this.progressBar.setIndeterminate(true);
+		this.progressBar.setBorderPainted(true);
+		this.progressBar.setVisible(false);
+		
+		this.showAllTaskStatusButton = new JButton();
+		this.showAllTaskStatusButton.setPreferredSize( new Dimension(16, 16));
+		this.showAllTaskStatusButton.setBorderPainted(false);
+		this.showAllTaskStatusButton.setIcon( this.getIcon("showAllTaskStatusButton.png"));
+		this.showAllTaskStatusButton.setVisible(false);
+		this.showAllTaskStatusButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				JTasksStatusList dialog = ToolsSwingLocator.getTaskStatusSwingManager().createJTasksStatusList(manager);
+				WindowManager wm = ToolsSwingLocator.getWindowManager();
+				wm.showWindow(dialog, "Tasks",WindowManager.MODE.TOOL);
+			}
+		});
+		
+        LayoutManager layout = new GridBagLayout();
+		this.setLayout(layout);
+        GridBagConstraints c = new GridBagConstraints();
+
+        c.gridx = 0;
+        c.fill = GridBagConstraints.VERTICAL;
+        c.weightx = 0.0d;
+        c.ipadx = 1;
+        this.add(this.label, c);
+
+        c.gridx = 1;
+        c.fill = GridBagConstraints.BOTH;
+        c.weightx = 1.0d;
+        this.add(this.progressBar, c);
+		
+        c.gridx = 2;
+        c.fill = GridBagConstraints.VERTICAL;
+        c.weightx = 0.0d;
+        this.add(this.showAllTaskStatusButton);
+	}
+	
+	private ImageIcon getIcon(String name) {
+		URL iconurl = this.getClass().getResource(name);
+		if( iconurl == null ) {
+			return new ImageIcon();
+		}
+		return new ImageIcon(iconurl);
+	}
+	public void update(final Observable observable, final Object notification) {
+
+		if(notification != null && !(notification instanceof TaskStatus) ) {
+			return;
+		}
+		if( !SwingUtilities.isEventDispatchThread()) {
+			SwingUtilities.invokeLater( new Runnable() {
+				public void run() {
+					update(observable, notification);
+				}
+			});
+			return;
+		}
+		TaskStatus taskStatus = (TaskStatus) notification;
+		if( taskStatus == null ) {
+			taskStatus = this.manager.getRunningTaskStatusMostRecent();
+			if( taskStatus == null ) {
+				this.label.setText("");
+				this.progressBar.setVisible(false);
+				this.showAllTaskStatusButton.setVisible(false);
+				return;
+			}
+		}
+		if( !taskStatus.isRunning() ) {
+			TaskStatus taskStatus2 = this.manager.getRunningTaskStatusMostRecent();
+			if( taskStatus2 == null ) {
+				// Not running task
+				this.label.setText("");
+				this.progressBar.setVisible(false);
+				this.showAllTaskStatusButton.setVisible(false);
+				return;
+			} else {
+				taskStatus = taskStatus2;
+			}
+ 		}
+ 		String label = taskStatus.getLabel();
+ 		String title = taskStatus.getTitle();  		
+ 	
+ 		if (title == null) {
+ 			title = "Progress";
+ 		}
+		if( label == null || label.trim().equals("") ) {
+			label = title;
+		} else {
+			label = title + ": " + label;
+		}
+		
+		this.label.setText( label );
+		this.progressBar.setIndeterminate( taskStatus.isIndeterminate() );
+		this.progressBar.setValue( taskStatus.getCompleted() );
+		if( !this.progressBar.isVisible() ) {
+			this.progressBar.setVisible(true);
+		}
+		if( !this.showAllTaskStatusButton.isVisible() ) {
+			this.showAllTaskStatusButton.setVisible(true);
+		}
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTasksStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/windowmanager/DefaultWindowManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/windowmanager/DefaultWindowManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/windowmanager/DefaultWindowManager.java	(revision 1235)
@@ -0,0 +1,128 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.windowmanager;
+
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+
+public class DefaultWindowManager implements WindowManager {
+
+	public void showWindow(JComponent component, String title, MODE mode) {
+		switch (mode) {
+		case TOOL:
+		case WINDOW:
+		    MyFrame frame = new MyFrame(title);
+			//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+			frame.setContentPane(component);
+			component.addComponentListener(frame);
+			
+			frame.pack();
+			frame.setVisible(true);
+			break;
+		case DIALOG:
+            MyJDialog dialog = new MyJDialog(title, true);
+
+		    dialog.setContentPane(component);
+			component.addComponentListener(dialog);
+
+			dialog.pack();
+			dialog.setLocationRelativeTo(null);
+			dialog.setVisible(true);
+			break;
+			
+		}
+
+	}
+	
+	public class MyFrame extends JFrame implements ComponentListener{
+
+	    public MyFrame(String title){
+	        super(title);
+	    }
+	    
+        public void componentHidden(ComponentEvent arg0) {
+           this.setVisible(false);
+           this.dispose();
+        }
+
+        public void setComponentPane(Component component){
+            
+        }
+        
+        public void componentMoved(ComponentEvent arg0) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void componentResized(ComponentEvent arg0) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void componentShown(ComponentEvent arg0) {
+            // TODO Auto-generated method stub
+            
+        }
+	    
+	    
+	}
+	
+	public class MyJDialog extends JDialog implements ComponentListener {
+
+        public MyJDialog(String title, boolean modal) {
+            super((Frame) null, title, modal);
+		}
+
+		public void componentHidden(ComponentEvent arg0) {
+	           this.setVisible(false);
+	           this.dispose();
+	    }
+
+		public void componentMoved(ComponentEvent arg0) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void componentResized(ComponentEvent arg0) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void componentShown(ComponentEvent arg0) {
+			// TODO Auto-generated method stub
+			
+		}
+		
+	}
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/windowmanager/DefaultWindowManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java	(revision 1235)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.Library;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.ToolsSwingLibrary;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.impl.component.DefaultComponentSwingManager;
+import org.gvsig.tools.swing.impl.icontheme.DefaultIconThemeManager;
+import org.gvsig.tools.swing.impl.task.DefaultTaskStatusSwingManager;
+import org.gvsig.tools.swing.impl.threadsafedialogs.DefaultThreadSafeDialogsManager;
+import org.gvsig.tools.swing.impl.usability.DefaultUsabilitySwingManager;
+import org.gvsig.tools.swing.impl.windowmanager.DefaultWindowManager;
+
+
+/**
+ * {@link Library} for the default tools swing implementation.
+ *
+ * @author gvSIG team
+ */
+public class ToolsSwingDefaultImplLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        super.doRegistration();
+        registerAsImplementationOf(ToolsSwingLibrary.class);
+    }
+
+    @Override
+    protected void doInitialize() throws LibraryException {
+        ToolsSwingLocator
+                .registerUsabilitySwingManager(DefaultUsabilitySwingManager.class);
+        ToolsSwingLocator
+                .registerTaskStatusSwingManager(DefaultTaskStatusSwingManager.class);
+        ToolsSwingLocator
+                .registerWindowManager(DefaultWindowManager.class);
+        ToolsSwingLocator.registerIconThemeManager(DefaultIconThemeManager.class);
+
+        ToolsSwingLocator.registerComponentSwingManager(
+                DefaultComponentSwingManager.class);
+        
+        ToolsSwingLocator.registerThreadSafeDialogsManager(DefaultThreadSafeDialogsManager.class);
+
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/NullSpinnerHandler.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/NullSpinnerHandler.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/NullSpinnerHandler.java	(revision 1235)
@@ -0,0 +1,406 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.model;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.swing.AbstractSpinnerModel;
+import javax.swing.JFormattedTextField;
+import javax.swing.SpinnerDateModel;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.impl.usability.spinner.editor.DynFieldFormatter;
+
+/**
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class NullSpinnerHandler {
+
+    public class NullSpinnerDateModel extends SpinnerDateModel {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -400734052278449520L;
+        private NullSpinnerHandler model;
+
+        public NullSpinnerDateModel(NullSpinnerHandler theModel,
+            Comparable start, Comparable end) {
+            super(new Date(), start, end, getDynFieldFormatter()
+                .getCalendarField());
+            model = theModel;
+            this.setValue(null);
+        }
+
+        public Object format(Object value) {
+            return model.getFormatter().format(value);
+        }
+
+        @Override
+        public int getCalendarField() {
+            return super.getCalendarField();
+        }
+
+        /**
+         * @return
+         */
+        public SimpleDateFormat getFormat() {
+            return getFormatter().getDateFormatter();
+        }
+
+        @Override
+        public Object getNextValue() {
+            Object next = model.getNextValue();
+            // fireStateChanged();
+            return next;
+        }
+
+        @Override
+        public Object getPreviousValue() {
+            Object prev = model.getPreviousValue();
+            // fireStateChanged();
+            return prev;
+        }
+
+        @Override
+        public Object getValue() {
+            return model.getValue();
+        }
+
+        @Override
+        public void setCalendarField(int calendarField) {
+            try {
+                super.setCalendarField(calendarField);
+            } catch (IllegalArgumentException e) {
+                if (getValue() != null) {
+                    throw new IllegalArgumentException(e);
+                }
+                this.fireStateChanged();
+            }
+            model.getFormatter().setCalendarField(getCalendarField());
+        }
+
+        @Override
+        public void setValue(Object value) {
+            Object oldValue = getValue();
+            model.setValue(value);
+            if (value != null) {
+                super.setValue(value);
+            } else
+                if (oldValue == null) {
+                    if (value != null) {
+                        fireStateChanged();
+                    }
+                } else
+                    if (!oldValue.equals(value)) {
+                        fireStateChanged();
+                    }
+        }
+    }
+
+    public class NullSpinnerNumberModel extends javax.swing.SpinnerNumberModel {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -3645717385964526394L;
+        private NullSpinnerHandler model;
+
+        public NullSpinnerNumberModel(NullSpinnerHandler theModel,
+            Comparable minimum, Comparable maximum) {
+            super(0, minimum, maximum, 1);
+            model = theModel;
+            this.setValue(null);
+        }
+
+        /**
+         * @param value
+         * @return
+         */
+        public Object format(Object value) {
+            return model.getFormatter().format(value);
+        }
+
+        /**
+         * @return
+         */
+        public NumberFormat getFormat() {
+            return getFormatter().getNumberFormatter();
+        }
+
+        @Override
+        public Object getNextValue() {
+            return model.getNextValue();
+        }
+
+        @Override
+        public Object getPreviousValue() {
+            // TODO Auto-generated method stub
+            return model.getPreviousValue();
+        }
+
+        @Override
+        public Object getValue() {
+            return model.getValue();
+        }
+
+        @Override
+        public void setValue(Object value) {
+            model.setValue(value);
+            if (isFirstTime()) {
+                this.fireStateChanged();
+            }
+            if (value != null) {
+                super.setValue(value);
+            }
+        }
+    }
+
+    /**
+     * @return
+     */
+    private static int getInitialCalendarField(DynField dynField, Locale loc) {
+        DynFieldFormatter formatter =
+            DynFieldFormatter.getInstance(dynField, loc);
+        return formatter.getCalendarField();
+    }
+
+    private DynFieldFormatter formatter = null;
+    private DynField dynField = null;
+    private Locale loc = null;
+    private Object iniValue = null;
+    private Object curValue = null;
+    private Comparable start = null;
+    private Comparable end = null;
+
+    private AbstractSpinnerModel model = null;
+
+    private boolean isNotFirstTime;
+
+    private boolean valid = true;
+
+    /**
+     * @param field
+     * @param value
+     */
+    public NullSpinnerHandler(DynField field) {
+        this(field, Locale.getDefault());
+    }
+
+    /**
+     * @param field
+     * @param value
+     */
+    public NullSpinnerHandler(DynField dynField, Locale loc) {
+        super();
+        init(dynField, loc, (Comparable) dynField.getMinValue(),
+            (Comparable) dynField.getMaxValue());
+    }
+
+    public Date getDate() {
+        if (formatter.isDate()) {
+            return (Date) getValue();
+        }
+        return null;
+    }
+
+    /**
+     * @return
+     */
+    public NullSpinnerDateModel getDateModel() {
+        if (model == null) {
+            this.model = new NullSpinnerDateModel(this, this.start, this.end);
+        }
+        return (NullSpinnerDateModel) model;
+    }
+
+    public DynFieldFormatter getDynFieldFormatter() {
+        return this.formatter;
+    }
+
+    /**
+     * @return
+     */
+    private Comparable getEnd() {
+        return this.end;
+    }
+
+    /**
+     * @return
+     */
+    public DynFieldFormatter getFormatter() {
+        return this.formatter;
+    }
+
+    public AbstractSpinnerModel getModel() {
+        if (model == null) {
+            initDefaultModel();
+            if (formatter.isNumber()) {
+                return new javax.swing.SpinnerNumberModel();
+            }
+            return this.model;
+        }
+        return this.model;
+    }
+
+    public Object getNextValue() {
+        Object next = formatter.getNextValue(getValue());
+        return ((this.getEnd() == null) || (this.getEnd().compareTo(next) >= 0))
+            ? next : null;
+    }
+
+    /**
+     * @return
+     */
+    public NullSpinnerNumberModel getNumberModel() {
+        if (model == null) {
+            this.model = new NullSpinnerNumberModel(this, this.start, this.end);
+        }
+        return (NullSpinnerNumberModel) model;
+    }
+
+    public Object getPreviousValue() {
+        Object prev = formatter.getPreviousValue(getValue());
+        return ((this.getStart() == null) || (this.getStart().compareTo(prev) <= 0))
+            ? prev : null;
+
+    }
+
+    /**
+     * @return
+     */
+    private Comparable getStart() {
+        return start;
+    }
+
+    public Object getValue() {
+        if ((isFirstTime()) && (this.curValue == null)) {
+            if (formatter.isDate()) {
+                return new Date();
+            } else
+                if (isNumber()) {
+                    return 0;
+                }
+            return null;
+        }
+        return this.curValue;
+    }
+
+    /**
+     * @param textField
+     * @return
+     */
+    public Object getValueFromTexField(JFormattedTextField textField) {
+        String txt = textField.getText();
+        return parseOrNull(txt);
+    }
+
+    /**
+     * @param dynField
+     * @param loc
+     * @param value
+     */
+    protected void init(DynField dynField, Locale loc, Comparable start,
+        Comparable end) {
+        this.dynField = dynField;
+        this.loc = loc;
+        this.start = start;
+        this.end = end;
+        this.formatter = DynFieldFormatter.getInstance(dynField, loc);
+        initDefaultModel();
+    }
+
+    /**
+	 * 
+	 */
+    private void initDefaultModel() {
+        if (formatter.isDate()) {
+            this.model = new NullSpinnerDateModel(this, this.start, this.end);
+        } else {
+            this.model = new NullSpinnerNumberModel(this, this.start, this.end);
+        }
+    }
+
+    /**
+     * @return
+     */
+    public boolean isDate() {
+        return formatter.isDate();
+    }
+
+    private boolean isFirstTime() {
+        return !isNotFirstTime;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isNumber() {
+        return this.formatter.isNumber();
+    }
+
+    /**
+     * @param txt
+     * @return
+     */
+    public Object parseOrNull(String txt) {
+        try {
+            return formatter.parse(txt);
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    public void setDefaultValueOn(boolean isSet) {
+        this.isNotFirstTime = !isSet;
+    }
+
+    public void setValue(Object value) {
+        if ((this.isFirstTime()) || (value == null) || (value.equals(""))) {
+            this.curValue = null;
+        } else
+            if (!formatter.isValidType(value)) {
+                throw new IllegalArgumentException(value.toString());
+            } else {
+                this.curValue = value;
+            }
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/JNullSpinner.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/JNullSpinner.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/model/JNullSpinner.java	(revision 1235)
@@ -0,0 +1,214 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.model;
+
+import java.awt.Color;
+import java.util.Date;
+
+import javax.swing.BorderFactory;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerModel;
+import javax.swing.border.Border;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.api.ComponentService;
+import org.gvsig.tools.swing.impl.usability.spinner.editor.NullDateEditor;
+import org.gvsig.tools.swing.impl.usability.spinner.editor.NullNumberEditor;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class JNullSpinner extends JSpinner {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -3139951166497954315L;
+    private static final String DEFAULT_FORMAT = "dd/MM/yyyy hh:mm:ss Z";
+    // private DynField field;
+    private SpinnerModel model;
+    private Object value;
+    private NullSpinnerHandler spinnerHandler;
+
+    //
+    // public DateSpinner(Date date, String format){
+    // this(date,TYPE_SHOW_DATE_ONLY);
+    // }
+
+    // public DateSpinner(Date date, String format, int dateField){
+    // this(new DateElement(date), format, dateField);
+    // }
+    //
+    //
+    // public JNullSpinner() {
+    // super();
+    //
+    // // this.setBackground(null);
+    // this.setForeground(Color.BLUE);
+    // }
+
+    public JNullSpinner(DynField dynField) {
+        super();
+        this.setForeground(Color.BLUE);
+        this.setDynFieldModel(dynField);
+    }
+
+    public void alignToField(ComponentService arg0) {
+
+    }
+
+    private Border createCompoundBorder() {
+        // Create a border for all calendars
+        Border etchedBorder = BorderFactory.createEtchedBorder();
+        Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
+        return BorderFactory.createCompoundBorder(etchedBorder, emptyBorder);
+    }
+
+    // private Object getValueFromTextField(){
+    // return nullModel.getValueFromTexField(getTextField());
+    //		
+    // }
+    //	
+    // private JFormattedTextField getTextField(){
+    // if (nullModel.isDate()) {
+    // ((DateEditor) this.getEditor()).getTextField();
+    // } else if (nullModel.isNumber()) {
+    // ((NumberEditor) this.getEditor()).getTextField();
+    // }
+    // return new JFormattedTextField();
+    // }
+    //
+    // private void setToTextField(Object value){
+    // if ((value == null)||(value.equals(""))){
+    // value = null;
+    // }
+    // nullModel.getFormatter().setFormattedValue(getTextField(), value);
+    // }
+    //	
+    // /**
+    // *
+    // */
+    // private void refresh() {
+    // this.setValue(this.getValue());
+    // }
+
+    public Date getCurDate(Date date) {
+        return (Date) this.getValue();
+    }
+
+    /**
+     * @param time
+     */
+    public void setDate(Date date) {
+        this.setValue(date);
+    }
+
+    public void setDynFieldModel(DynField dynField) {
+
+        this.spinnerHandler =
+            new NullSpinnerHandler(dynField, this.getLocale());
+        this.model = spinnerHandler.getModel();
+        this.setModel(this.model);
+        // this.model.addChangeListener(this);
+        //		
+        if (spinnerHandler.isDate()) {
+            this.setEditor(new NullDateEditor(this, dynField, spinnerHandler
+                .getFormatter()));
+        } else
+            if (spinnerHandler.isNumber()) {
+                this.setEditor(new NullNumberEditor(this, dynField,
+                    spinnerHandler.getFormatter()));
+            }
+        this.spinnerHandler.setDefaultValueOn(false);
+
+        // refresh();
+
+    }
+
+    /**
+     * @param b
+     */
+    public void setEditable(boolean isEditable) {
+        this.setEnabled(this.isEnabled());
+    }
+
+    // public void addDateChangeListener(ChangeListener listener) {
+    // this.getModel().addChangeListener(listener);
+    // }
+
+    // @Override
+    // public SpinnerModel getModel() {
+    // if (this.model == null)
+    // return new SpinnerNumberModel();
+    // return this.model;
+    //
+    // }
+
+    // @Override
+    // public void setValue(Object value) {
+    // this.getModel().setValue(value);
+    // setToTextField(value);
+    // }
+
+    // @Override
+    // public Object getNextValue() {
+    // return this.getModel().getNextValue();
+    // }
+    //
+    // @Override
+    // public Object getPreviousValue() {
+    // return this.getModel().getPreviousValue();
+    // }
+
+    // @Override
+    // public Object getValue() {
+    // Object value = this.getModel().getValue();
+    // // if (value==null)
+    // // return 0 ;
+    // return value;
+    // }
+    //
+    // @Override
+    // public void setModel(SpinnerModel model) {
+    // this.model = model;
+    // }
+    //
+    // public void stateChanged(ChangeEvent e) {
+    // // SpinnerModel model = (SpinnerModel) e.getSource();
+    // // this.setToTextField(model.getValue());
+    // }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DefaultDynFieldEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DefaultDynFieldEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DefaultDynFieldEditor.java	(revision 1235)
@@ -0,0 +1,167 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.awt.event.FocusListener;
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.MessageFormat;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JFormattedTextField.AbstractFormatter;
+import javax.swing.JSpinner;
+import javax.swing.text.DateFormatter;
+import javax.swing.text.DefaultFormatterFactory;
+import javax.swing.text.NumberFormatter;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.usability.DynFieldEditor;
+
+public class DefaultDynFieldEditor implements DynFieldEditor{
+
+    private DynField dynField;
+    private DynFieldFormatter formatter;
+    private JSpinner spinner;
+    private JFormattedTextField tf;
+
+    public DefaultDynFieldEditor(FocusListener listener, DynField field, Locale locale) {
+        this.dynField = field;
+        this.formatter = DynFieldFormatter.getInstance(dynField, locale);
+        this.spinner = createSpinner();
+        this.spinner.setLocale(locale);
+        this.tf =
+            ((JSpinner.DefaultEditor) this.spinner.getEditor()).getTextField();
+
+        this.tf.addFocusListener(listener);
+
+        setDynFieldFormat();
+    }
+   
+    private JSpinner createSpinner() {
+        return ToolsSwingLocator.getUsabilitySwingManager().createJNullSpinner(this.dynField.getType(), this.getDefaultValue(), -1);
+    }
+    
+    public Object getDefaultValue() {
+        switch (this.dynField.getType()) {
+        case DataTypes.DATE:
+            return new Date();
+        case DataTypes.TIME:
+            return new Date();
+        case DataTypes.TIMESTAMP:
+            return new Date();
+        case DataTypes.DOUBLE:
+            return 0.0f;
+        case DataTypes.FLOAT:
+            return 0.0f;
+        default:
+            return 0;
+        }
+    }
+
+    private DynFieldFormatter getFormat() {
+        return this.formatter;
+    }
+
+    public JSpinner getSpinner() {
+        return this.spinner;
+    }
+
+    public JFormattedTextField getTextField() {
+        return this.tf;
+    }
+
+    private void setDynFieldFormat() {
+        DefaultFormatterFactory factory =
+            (DefaultFormatterFactory) getTextField().getFormatterFactory();
+        AbstractFormatter formatter = factory.getDefaultFormatter();
+
+        if (this.formatter.isDate()) {
+			// Changes the date format
+            ((DateFormatter) formatter).setFormat(this.formatter.toFormat());
+		} else {
+            if (this.formatter.isNumber()) {
+				// Changes the date format
+                ((NumberFormatter) formatter).setFormat(this.formatter
+                    .toFormat());
+            }
+		}
+    }
+
+
+    public Object parse(String text) throws ParseException {
+        return getFormat().parse(text);
+    }
+
+	public Object getTextFieldValue() {
+		try {
+			return parse(getTextField().getText());
+		} catch (ParseException e) {
+			return null;
+		}
+	}
+
+	private static Format numberFormat = new DecimalFormat();
+	
+	public void setTextFieldValue(Object object) {
+		if (object == null) {
+			this.getTextField().setText("");
+			this.getTextField().updateUI();
+			return;
+		}
+		Object value = null;
+		
+		Class obj_class = object.getClass();
+		
+		if (obj_class == Double.class || obj_class == Float.class
+		    || obj_class == Integer.class || obj_class == Long.class) {
+		    
+		    String str = numberFormat.format(object);
+		    this.getTextField().setText(str);
+		    this.getTextField().updateUI();
+		    return;
+		}
+		
+		// Else...
+		
+		try {
+			value = parse(object.toString());
+		} catch (ParseException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		if (value == null) {
+			this.getTextField().setText("");
+			this.getSpinner().updateUI();
+			this.getTextField().updateUI();
+			return;
+		}
+		this.getTextField().setText(value.toString());
+		this.getTextField().updateUI();
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatterFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatterFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatterFactory.java	(revision 1235)
@@ -0,0 +1,43 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JFormattedTextField.AbstractFormatter;
+import javax.swing.JFormattedTextField.AbstractFormatterFactory;
+
+public class DynFieldFormatterFactory extends AbstractFormatterFactory {
+
+    private DynFieldFormatter formatter;
+
+    public DynFieldFormatterFactory(DynFieldFormatter formatter) {
+        this.formatter = formatter;
+    }
+
+    @Override
+    public AbstractFormatter getFormatter(JFormattedTextField tf) {
+        return new DynFieldTextFieldFormatter(formatter);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullNumberEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullNumberEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullNumberEditor.java	(revision 1235)
@@ -0,0 +1,90 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.text.DecimalFormat;
+
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.event.ChangeEvent;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.impl.usability.spinner.date.NullSpinnerHandler.NullSpinnerNumberModel;
+import org.gvsig.tools.swing.impl.usability.spinner.model.JNullSpinner;
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class NullNumberEditor extends JSpinner.NumberEditor {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 7161866919028446542L;
+    private DynField dynField;
+    private NullSpinnerNumberModel model;
+
+    /**
+     * @param dynFieldFormatter
+     * @param nullSpinnerNumberModel
+     * @param arg0
+     */
+    public NullNumberEditor(JNullSpinner spinner, DynField field,
+        DynFieldFormatter formatter) {
+        super(spinner);
+        this.model = (NullSpinnerNumberModel) spinner.getModel();
+        this.dynField = field;
+        this.getTextField().setFormatterFactory(
+            new DynFieldFormatterFactory(formatter));
+    }
+
+    @Override
+    public DecimalFormat getFormat() {
+        return (DecimalFormat) this.model.getFormat();
+    }
+
+    @Override
+    public SpinnerNumberModel getModel() {
+        return model;
+    }
+
+    @Override
+    public void stateChanged(ChangeEvent e) {
+        JNullSpinner spinner = (JNullSpinner) (e.getSource());
+        Object value = spinner.getValue();
+        getTextField().setValue(value);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldTextFieldFormatter.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldTextFieldFormatter.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldTextFieldFormatter.java	(revision 1235)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.text.ParseException;
+
+import javax.swing.JFormattedTextField.AbstractFormatter;
+
+public class DynFieldTextFieldFormatter extends AbstractFormatter {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -8170586566278761455L;
+    private DynFieldFormatter formatter;
+
+    public DynFieldTextFieldFormatter(DynFieldFormatter formatter) {
+        super();
+        this.formatter = formatter;
+    }
+
+    @Override
+    public Object stringToValue(String text) throws ParseException {
+        if ((text == null) || (text.equals(""))) {
+            return null;
+        }
+        return formatter.parse(text);
+    }
+
+    @Override
+    public String valueToString(Object value) throws ParseException {
+        if ((value == null) || (value.equals(""))) {
+            return "";
+        }
+        return formatter.format(value);
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullDateEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullDateEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullDateEditor.java	(revision 1235)
@@ -0,0 +1,134 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.awt.Component;
+import java.text.SimpleDateFormat;
+
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import javax.swing.event.ChangeEvent;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.impl.usability.spinner.date.NullSpinnerHandler.NullSpinnerDateModel;
+import org.gvsig.tools.swing.impl.usability.spinner.model.JNullSpinner;
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class NullDateEditor extends JSpinner.DateEditor {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -8215795896530639400L;
+    private DynField dynField;
+    private NullSpinnerDateModel model;
+
+    /**
+     * @param spinner
+     * @param dynFieldFormatter
+     * @param dynField2
+     */
+    public NullDateEditor(JNullSpinner spinner, DynField dynField,
+        DynFieldFormatter formatter) {
+        super(spinner);
+        this.model = (NullSpinnerDateModel) spinner.getModel();
+        this.dynField = dynField;
+        this.setLocale(spinner.getLocale());
+        this.getTextField().setAlignmentX(Component.RIGHT_ALIGNMENT);
+        this.getTextField().setAlignmentY(Component.CENTER_ALIGNMENT);
+        this.getTextField().setFormatterFactory(
+            new DynFieldFormatterFactory(formatter));
+    }
+
+    @Override
+    public SimpleDateFormat getFormat() {
+        return model.getFormat();
+    }
+
+    @Override
+    public SpinnerDateModel getModel() {
+        return this.model;
+    }
+
+    @Override
+    public void stateChanged(ChangeEvent e) {
+        JNullSpinner spinner = (JNullSpinner) (e.getSource());
+        Object value = spinner.getValue();
+        getTextField().setValue(value);
+    }
+
+    // private void setFormatPattern(int type, Locale loc) {
+    // // to do: locale settings
+    // String strPattern = null;
+    // switch (type){
+    // }
+    // }
+
+    // public void stateChanged(ChangeEvent e) {
+    //    	
+    // Date date = (Date) ((DateSpinner) e.getSource()).getModel().getValue();
+    // String str = "";
+    // if (date != null) {
+    // str = date.toString();
+    // }
+    // if (!getTextField().getText().equals(str)){
+    // getTextField().setText(str);
+    // super.stateChanged(e);
+    // }
+    // }
+
+    // public void format(Date date){
+    // ((NullableDateSpinnerModel) this.getModel()).format(date);
+    // }
+    //	
+    // Object value = getSpinner().getValue();
+    // String text = "";
+    // // String text = "(Add a value)";
+    // if (value != null) {
+    // // text = getFormat().format((Number) value);
+    // super.stateChanged(e);
+    // }else{
+    // //
+    // // text = getFormat().format((Date) value);
+    // // SpinnerModel model = getSpinner().getModel();
+    // // model.setValue(0);
+    // getTextField().setText(text);
+    // getTextField().repaint();
+    // }
+    // }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DataTypesFormatter.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DataTypesFormatter.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DataTypesFormatter.java	(revision 1235)
@@ -0,0 +1,523 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+
+public class DataTypesFormatter {
+
+    public class DateFormatter extends SimpleDateFormat {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -1744865595768091192L;
+        private DataTypesFormatter df;
+
+        public DateFormatter(DataTypesFormatter df) {
+            this.df = df;
+        }
+
+        public String formatDate(Object obj) throws ParseException {
+            return df.format(obj);
+        }
+
+        @Override
+        public Date parse(String value) {
+            try {
+                return parseDate(value);
+            } catch (ParseException e) {
+                return null;
+            }
+        }
+
+        public Date parseDate(String time) throws ParseException {
+            return (Date) df.parse(time);
+        }
+    }
+
+    public static DataTypesFormatter getInstance(int dataType, String subType,
+        Locale loc) {
+        return new DataTypesFormatter(dataType, subType, loc);
+    }
+
+    private Locale loc;
+    private int calendarField = Calendar.DAY_OF_MONTH;
+    private SimpleDateFormat df;
+    private boolean isDate = false;
+
+    private boolean isNumber = false;
+
+    private DecimalFormat f;
+    private int dataType;
+    private String subType;
+
+    private DataTypesFormatter(int dataType, String subType, Locale loc) {
+        super();
+        this.loc = loc;
+        this.dataType = dataType;
+        this.subType = subType;
+        if (this.subType == null) {
+            this.subType = "";
+        }
+        refresh();
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public String format(Object value) {
+        System.out.println(value);
+        refresh();
+        if ((value == null) || (value.equals(""))) {
+            return "";
+        }
+
+        if (isDate()) {
+            if (value instanceof Date) {
+                return this.df.format(value);
+            } else {
+                return "0";
+            }
+
+        }
+        if (isNumber()) {
+            if (value instanceof Number) {
+                return this.f.format(value);
+            }
+        }
+        return "";
+    }
+
+    public Date formatDate(Date date) {
+        return this.getCalendar(date).getTime();
+    }
+
+    /**
+     * Output example for FULL date format
+     * For the United States: Thursday, September 23, 2010
+     * For France: jeudi 23 septembre 2010
+     * For Spain: jueves 23 de septiembre de 2010
+     */
+    public String formatDateFull(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.FULL, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for LONG date format
+     * For the United Kingdom: 23 September 2010
+     * For France: 23 septembre 2010
+     * For Spain: 23 de septiembre de 2010
+     */
+    public String formatDateLong(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.LONG, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for MEDIUM date format
+     * For Korea: 2010. 9. 23
+     * For Spain: 23-sep-2010
+     */
+    public String formatDateMedium(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for SHORT date format
+     * For Japan: 10/09/23 (YY/MM/DD)
+     * For Spain: 23/09/10 (DD/MM/YY)
+     */
+    public String formatDateShort(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.SHORT, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * @param i
+     * @return
+     */
+    private Number formatNumber(Number value) {
+        try {
+            return this.f.parse(f.format(value));
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    public Calendar getCalendar() {
+        return this.getDateFormatter().getCalendar();
+    }
+
+    public Calendar getCalendar(Date date) {
+        if (date == null) {
+            date = new Date();
+        }
+        getCalendar().setTime(date);
+        return getCalendar();
+    }
+
+    public int getCalendarField() {
+        return this.calendarField;
+    }
+
+    public DateFormatter getDateFormatter() {
+        if (this.df == null) {
+            this.df =
+                (SimpleDateFormat) DateFormat.getDateInstance(
+                    DateFormat.MEDIUM, getLocale());
+        }
+        return new DateFormatter(this);
+    }
+
+    public Locale getLocale() {
+        if (this.loc == null) {
+            this.loc = Locale.getDefault();
+        }
+        return this.loc;
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public Object getNextValue(Object value) {
+        if (isDate()) {
+            if (value == null) {
+                value = new Date();
+            }
+            Calendar cal = getCalendar();
+            cal.setTime((Date) value);
+            cal.add(getCalendarField(), 1);
+            return cal.getTime();
+        }
+        if (isNumber()) {
+            if (value != null) {
+                String strValue = value.toString();
+                switch (getType()) {
+                case DataTypes.DOUBLE:
+                    return formatNumber(Double.valueOf(strValue) + 1);
+                case DataTypes.FLOAT:
+                    return formatNumber(Float.valueOf(strValue) + 1);
+                case DataTypes.LONG:
+                    return formatNumber(Long.valueOf(strValue) + 1);
+                case DataTypes.INT:
+                    return formatNumber(Integer.valueOf(strValue) + 1);
+                case DataTypes.BYTE:
+                    return formatNumber(Byte.valueOf(strValue) + 1);
+                }
+            }
+            return 0;
+        }
+        return null;
+    }
+
+    public NumberFormat getNumberFormatter() {
+        if (this.f == null) {
+            if (this.df == null) {
+                this.f =
+                    (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            } else {
+                return this.df.getNumberFormat();
+            }
+        }
+        return this.f;
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public Object getPreviousValue(Object value) {
+        if (isDate()) {
+            if (value != null) {
+                Calendar cal = getCalendar();
+                cal.setTime((Date) value);
+                cal.add(getCalendarField(), -1);
+                return cal.getTime();
+            }
+            return null;
+        }
+        if (isNumber()) {
+            if (value != null) {
+                String strValue = value.toString();
+                switch (getType()) {
+                case DataTypes.DOUBLE:
+                    return formatNumber(Double.valueOf(strValue) - 1);
+                case DataTypes.FLOAT:
+                    return formatNumber(Float.valueOf(strValue) - 1);
+                case DataTypes.LONG:
+                    return formatNumber(Long.valueOf(strValue) - 1);
+                case DataTypes.INT:
+                    return formatNumber(Integer.valueOf(strValue) - 1);
+                case DataTypes.BYTE:
+                    return formatNumber(Byte.valueOf(strValue) - 1);
+                }
+            }
+            return null;
+        }
+        return null;
+    }
+
+    private String getSubType() {
+        return subType;
+    }
+
+    private int getType() {
+        return dataType;
+    }
+
+    public boolean isDate() {
+        return this.isDate;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isNumber() {
+        return this.isNumber;
+    }
+
+    /**
+     * @param value
+     */
+    public boolean isValidType(Object value) {
+        if (value == null) {
+            return true;
+        }
+        if ((isDate()) && (!(value instanceof Date))) {
+            return false;
+        }
+        if ((isNumber()) && (!(value instanceof Number))) {
+            try {
+                this.parse(value.toString());
+                return true;
+            } catch (ParseException e) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    //
+    // public String formatByType(int dynType, Date date) {
+    // return setDynTypeFormatParametters(dynType).format(date);
+    // }
+    //
+    // public String formatByType(int dynType, Date date, int style) {
+    // this.setDynTypeFormatParametters(dynType);
+    // this.getDateFormatter().getCalendar();
+    // return format(date);
+    // }
+
+    /**
+     * @param obj
+     * @return
+     * @throws ParseException
+     */
+    public Object parse(String value) throws ParseException {
+        if ((value == null)||(value.equals(""))){
+            return null;
+        }
+        
+        if (isDate()) {
+            return this.df.parse(value);
+        }
+        if (isNumber()) {
+
+         
+            return this.f.parse(value);
+        }
+        return value;
+    }
+
+    public Object parse(Object value) {
+        try {
+            if (value == null) {
+                return parse("");
+            }
+            if ((isDate())&&(value instanceof Date)){
+                return value;
+            }
+            return parse(value.toString());
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    public Date parseDate(String date) throws ParseException {
+        return this.getDateFormatter().parse(date);
+    }
+
+    /**
+	 * 
+	 */
+    private void refresh() {
+        this.isDate = false;
+        this.isNumber = false;
+
+        switch (getType()) {
+        case DataTypes.TIME:
+            this.isDate = true;
+            this.calendarField = Calendar.MINUTE;
+            this.df =
+                (SimpleDateFormat) DateFormat.getTimeInstance(
+                    DateFormat.MEDIUM, getLocale());
+            break;
+        case DataTypes.TIMESTAMP:
+            this.isDate = true;
+            this.calendarField = Calendar.SECOND;
+            this.df =
+                (SimpleDateFormat) DateFormat.getTimeInstance(
+                    DateFormat.MEDIUM, getLocale());
+            break;
+        case DataTypes.DATE:
+            this.isDate = true;
+            this.calendarField = Calendar.DAY_OF_MONTH;
+            if (!getSubType().equals(DataTypes.SUBTYPE_DATE)) {
+                this.df =
+                    (SimpleDateFormat) DateFormat.getDateTimeInstance(
+                        DateFormat.FULL, DateFormat.FULL, getLocale());
+            } else {
+                this.df =
+                    (SimpleDateFormat) DateFormat.getDateInstance(
+                        DateFormat.LONG, getLocale());
+            }
+            break;
+        case DataTypes.DOUBLE:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            f.setMaximumFractionDigits(2);
+            f.setMinimumFractionDigits(2);
+            break;
+        case DataTypes.FLOAT:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            f.setMaximumFractionDigits(2);
+            f.setMinimumFractionDigits(2);
+            break;
+        case DataTypes.LONG:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            break;
+        case DataTypes.INT:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getIntegerInstance(getLocale());
+            break;
+        case DataTypes.BYTE:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getIntegerInstance(getLocale());
+            break;
+        }
+    }
+
+    public void setCalendarField(int calendarField) {
+        this.calendarField = calendarField;
+    }
+
+    public void setLocale(Locale loc) {
+        this.loc = loc;
+        refresh();
+    }
+
+    private SimpleDateFormat toDateFormat() {
+        return df;
+    }
+
+    public Format toFormat() {
+        if (isDate()) {
+            return df;
+        } else
+            if (isNumber()) {
+                return f;
+            }
+        return null;
+    }
+
+    public String toLocalizedPattern() {
+        if (isDate()) {
+            return this.df.toLocalizedPattern();
+        } else {
+            return this.f.toLocalizedPattern();
+        }
+    }
+
+    // /**
+    // * @param textField
+    // * @param value
+    // * @return
+    // */
+    // public void setFormattedValue(JFormattedTextField textField, Object
+    // value) {
+    // String text = null;
+    // if (textField == null) return;
+    // if ((value==null)||value.equals("")){
+    // text = "";
+    // }else if (isDate()){
+    // text = df.format(value);
+    // }else if(isNumber()){
+    // text = f.format(value);
+    // }
+    // textField.setText(text);
+    // textField.validate();
+    //
+    // }
+
+    // /**
+    // * @param time
+    // * @return
+    // */
+    // private Date parseDate(String time) {
+    // try {
+    // return this.df.parse(this.df.format(time));
+    // } catch (ParseException e) {
+    // return null;
+    // }
+    // }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatter.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatter.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/DynFieldFormatter.java	(revision 1235)
@@ -0,0 +1,509 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.sql.Timestamp;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+
+public class DynFieldFormatter {
+
+    public class DateFormatter extends SimpleDateFormat {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -1744865595768091192L;
+        private DynFieldFormatter df;
+
+        public DateFormatter(DynFieldFormatter df) {
+            this.df = df;
+        }
+
+        public String formatDate(Object obj) throws ParseException {
+            return df.format(obj);
+        }
+
+        @Override
+        public Date parse(String value) {
+            try {
+                return parseDate(value);
+            } catch (ParseException e) {
+                return null;
+            }
+        }
+
+        public Date parseDate(String time) throws ParseException {
+            return (Date) df.parse(time);
+        }
+    }
+
+    public static DynFieldFormatter getInstance(DynField field, Locale loc) {
+        return new DynFieldFormatter(field, loc);
+    }
+
+    private Locale loc;
+    private int calendarField = Calendar.DAY_OF_MONTH;
+    private SimpleDateFormat df;
+    private DynField dynField;
+    private boolean isDate = false;
+
+    private boolean isNumber = false;
+
+    private DecimalFormat f;
+
+    private DynFieldFormatter(DynField field, Locale loc) {
+        super();
+        this.loc = loc;
+        this.dynField = field;
+        refresh();
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public String format(Object value) {
+        System.out.println(value);
+        refresh();
+        if ((value == null) || (value.equals(""))) {
+            return "";
+        }
+
+        if (isDate()) {
+            if (value instanceof Date) {
+                return this.df.format(value);
+            } else {
+                return "0";
+            }
+
+        }
+        if (isNumber()) {
+            if (value instanceof Number) {
+                return this.f.format(value);
+            }
+        }
+        return "";
+    }
+
+    public Date formatDate(Date date) {
+        return this.getCalendar(date).getTime();
+    }
+
+    /**
+     * Output example for FULL date format
+     * For the United States: Thursday, September 23, 2010
+     * For France: jeudi 23 septembre 2010
+     * For Spain: jueves 23 de septiembre de 2010
+     */
+    public String formatDateFull(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.FULL, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for LONG date format
+     * For the United Kingdom: 23 September 2010
+     * For France: 23 septembre 2010
+     * For Spain: 23 de septiembre de 2010
+     */
+    public String formatDateLong(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.LONG, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for MEDIUM date format
+     * For Korea: 2010. 9. 23
+     * For Spain: 23-sep-2010
+     */
+    public String formatDateMedium(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * Output example for SHORT date format
+     * For Japan: 10/09/23 (YY/MM/DD)
+     * For Spain: 23/09/10 (DD/MM/YY)
+     */
+    public String formatDateShort(Date date) {
+        DateFormat df =
+            DateFormat.getDateInstance(DateFormat.SHORT, getLocale());
+        return df.format(date);
+    }
+
+    /**
+     * @param i
+     * @return
+     */
+    private Number formatNumber(Number value) {
+        try {
+            return this.f.parse(f.format(value));
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    public Calendar getCalendar() {
+        return this.getDateFormatter().getCalendar();
+    }
+
+    public Calendar getCalendar(Date date) {
+        if (date == null) {
+            date = new Date();
+        }
+        getCalendar().setTime(date);
+        return getCalendar();
+    }
+
+    public int getCalendarField() {
+        return this.calendarField;
+    }
+
+    public DateFormatter getDateFormatter() {
+        if (this.df == null) {
+            this.df =
+                (SimpleDateFormat) DateFormat.getDateInstance(
+                    DateFormat.MEDIUM, getLocale());
+        }
+        return new DateFormatter(this);
+    }
+
+    public Locale getLocale() {
+        if (this.loc == null) {
+            this.loc = Locale.getDefault();
+        }
+        return this.loc;
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public Object getNextValue(Object value) {
+        if (isDate()) {
+            if (value == null) {
+                value = new Date();
+            }
+            Calendar cal = getCalendar();
+            cal.setTime((Date) value);
+            cal.add(getCalendarField(), 1);
+            return cal.getTime();
+        }
+        if (isNumber()) {
+            if (value != null) {
+                String strValue = value.toString();
+                switch (getType()) {
+                case DataTypes.DOUBLE:
+                    return formatNumber(Double.valueOf(strValue) + 1);
+                case DataTypes.FLOAT:
+                    return formatNumber(Float.valueOf(strValue) + 1);
+                case DataTypes.LONG:
+                    return formatNumber(Long.valueOf(strValue) + 1);
+                case DataTypes.INT:
+                    return formatNumber(Integer.valueOf(strValue) + 1);
+                case DataTypes.BYTE:
+                    return formatNumber(Byte.valueOf(strValue) + 1);
+                }
+            }
+            return 0;
+        }
+        return null;
+    }
+
+    public NumberFormat getNumberFormatter() {
+        if (this.f == null) {
+            if (this.df == null) {
+                this.f =
+                    (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            } else {
+                return this.df.getNumberFormat();
+            }
+        }
+        return this.f;
+    }
+
+    /**
+     * @param value
+     * @return
+     */
+    public Object getPreviousValue(Object value) {
+        if (isDate()) {
+            if (value != null) {
+                Calendar cal = getCalendar();
+                cal.setTime((Date) value);
+                cal.add(getCalendarField(), -1);
+                return cal.getTime();
+            }
+            return null;
+        }
+        if (isNumber()) {
+            if (value != null) {
+                String strValue = value.toString();
+                switch (getType()) {
+                case DataTypes.DOUBLE:
+                    return formatNumber(Double.valueOf(strValue) - 1);
+                case DataTypes.FLOAT:
+                    return formatNumber(Float.valueOf(strValue) - 1);
+                case DataTypes.LONG:
+                    return formatNumber(Long.valueOf(strValue) - 1);
+                case DataTypes.INT:
+                    return formatNumber(Integer.valueOf(strValue) - 1);
+                case DataTypes.BYTE:
+                    return formatNumber(Byte.valueOf(strValue) - 1);
+                }
+            }
+            return null;
+        }
+        return null;
+    }
+
+    private String getSubType() {
+        String str = dynField.getSubtype();
+        if (str == null) {
+            return "";
+        }
+        return str;
+    }
+
+    private int getType() {
+        return dynField.getType();
+    }
+
+    public boolean isDate() {
+        return this.isDate;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isNumber() {
+        return this.isNumber;
+    }
+
+    /**
+     * @param value
+     */
+    public boolean isValidType(Object value) {
+        if (value == null) {
+            return true;
+        }
+        if ((isDate()) && (!(value instanceof Date))) {
+            return false;
+        }
+        if ((isNumber()) && (!(value instanceof Number))) {
+            if (value instanceof String) {
+                try {
+                    Number n = NumberFormat.getInstance().parse((String) value);
+                } catch (ParseException e) {
+                    return false;
+                }
+            }
+            return false;
+        }
+        return true;
+    }
+
+    //
+    // public String formatByType(int dynType, Date date) {
+    // return setDynTypeFormatParametters(dynType).format(date);
+    // }
+    //
+    // public String formatByType(int dynType, Date date, int style) {
+    // this.setDynTypeFormatParametters(dynType);
+    // this.getDateFormatter().getCalendar();
+    // return format(date);
+    // }
+
+    /**
+     * @param obj
+     * @return
+     * @throws ParseException
+     */
+    public Object parse(String value) throws ParseException {
+		if ((value == null) || (value.equals(""))) {
+			return null;
+		}
+
+		if (isDate()) {
+		    if (getType() == DataTypes.TIMESTAMP) {
+		        /*
+		         * Parse as timestamp
+		         */
+		        return Timestamp.valueOf(value);
+
+		    } else {
+		        return this.df.parse(value);
+		    }
+        }
+        if (isNumber()) {
+            return this.f.parse(value);
+        }
+        return null;
+    }
+
+    public Date parseDate(String date) throws ParseException {
+        return this.getDateFormatter().parse(date);
+    }
+
+    /**
+	 * 
+	 */
+    private void refresh() {
+        switch (getType()) {
+        case DataTypes.TIME:
+            this.isDate = true;
+            this.calendarField = Calendar.MINUTE;
+            this.df =
+                (SimpleDateFormat) DateFormat.getTimeInstance(
+                    DateFormat.MEDIUM, getLocale());
+            break;
+        case DataTypes.TIMESTAMP:
+            this.isDate = true;
+            this.calendarField = Calendar.SECOND;
+            /*
+             * This 'df' will not be used because Timestamp
+             * is parsed in another way
+             */
+            this.df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            
+            break;
+        case DataTypes.DATE:
+            this.isDate = true;
+            this.calendarField = Calendar.DAY_OF_MONTH;
+            if (!getSubType().equals(DataTypes.SUBTYPE_DATE)) {
+                this.df =
+                    (SimpleDateFormat) DateFormat.getDateTimeInstance(
+                        DateFormat.FULL, DateFormat.FULL, getLocale());
+            } else {
+                this.df =
+                    (SimpleDateFormat) DateFormat.getDateInstance(
+                        DateFormat.LONG, getLocale());
+            }
+            break;
+        case DataTypes.DOUBLE:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            f.setMaximumFractionDigits(2);
+            f.setMinimumFractionDigits(2);
+            break;
+        case DataTypes.FLOAT:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            f.setMaximumFractionDigits(2);
+            f.setMinimumFractionDigits(2);
+            break;
+        case DataTypes.LONG:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getNumberInstance(getLocale());
+            break;
+        case DataTypes.INT:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getIntegerInstance(getLocale());
+            break;
+        case DataTypes.BYTE:
+            isNumber = true;
+            f = (DecimalFormat) NumberFormat.getIntegerInstance(getLocale());
+            break;
+        }
+    }
+
+    public void setCalendarField(int calendarField) {
+        this.calendarField = calendarField;
+    }
+
+    public void setLocale(Locale loc) {
+        this.loc = loc;
+        refresh();
+    }
+
+    private SimpleDateFormat toDateFormat() {
+        return df;
+    }
+
+    public Format toFormat() {
+        if (isDate()) {
+            return df;
+        } else
+            if (isNumber()) {
+                return f;
+            }
+        return null;
+    }
+
+    public String toLocalizedPattern() {
+        if (isDate()) {
+            return this.df.toLocalizedPattern();
+        } else {
+            return this.f.toLocalizedPattern();
+        }
+    }
+
+    // /**
+    // * @param textField
+    // * @param value
+    // * @return
+    // */
+    // public void setFormattedValue(JFormattedTextField textField, Object
+    // value) {
+    // String text = null;
+    // if (textField == null) return;
+    // if ((value==null)||value.equals("")){
+    // text = "";
+    // }else if (isDate()){
+    // text = df.format(value);
+    // }else if(isNumber()){
+    // text = f.format(value);
+    // }
+    // textField.setText(text);
+    // textField.validate();
+    //		
+    // }
+
+    // /**
+    // * @param time
+    // * @return
+    // */
+    // private Date parseDate(String time) {
+    // try {
+    // return this.df.parse(this.df.format(time));
+    // } catch (ParseException e) {
+    // return null;
+    // }
+    // }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullableNumberSpinnerModel.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullableNumberSpinnerModel.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/editor/NullableNumberSpinnerModel.java	(revision 1235)
@@ -0,0 +1,157 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.editor;
+
+import javax.swing.SpinnerModel;
+import javax.swing.SpinnerNumberModel;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.locator.LocatorException;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class NullableNumberSpinnerModel extends SpinnerNumberModel implements
+    SpinnerModel {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1320385929219211201L;
+    private DynField field;
+    private Object number;
+    private boolean isFirstTime;
+
+    /**
+     * @param field
+     * @param value
+     */
+    public NullableNumberSpinnerModel(DynField field, Number value) {
+        super(0, (Comparable<?>) field.getMinValue(), (Comparable<?>) field
+            .getMaxValue(), Integer.valueOf(1));
+        this.field = field;
+        this.isFirstTime = true;
+        super.setValue(0);
+        if (value != null) {
+            setValue(value);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.swing.SpinnerModel#getNextValue()
+     */
+    @Override
+    public Object getNextValue() {
+        Number next = null;
+        if (isNull()) {
+            next = 0;
+        } else {
+            next = (Number) super.getNextValue();
+        }
+        this.number = next;
+        return next;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.swing.SpinnerModel#getPreviousValue()
+     */
+    @Override
+    public Object getPreviousValue() {
+        if (isNull()) {
+            return null;
+        }
+        if (this.number.equals(this.getMinimum())) {
+            // we are at the minimum value and we want to change to
+            // "undetermined"
+            this.number = null;
+            return "";
+        }
+        return super.getPreviousValue();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.swing.SpinnerModel#getValue()
+     */
+    @Override
+    public Object getValue() {
+        if (this.isFirstTime) {
+            this.number = 0;
+        }
+        if (this.number == null) {
+            return null;
+        }
+        try {
+            return ToolsLocator.getDataTypesManager().coerce(
+                this.field.getType(), this.number);
+        } catch (LocatorException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (CoercionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    protected boolean isNull() {
+        Object value = getValue();
+        return ((value == null) || (value.equals("")));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.swing.SpinnerModel#setValue(java.lang.Object)
+     */
+    @Override
+    public void setValue(Object value) {
+        this.number = value;
+        this.isFirstTime = false;
+        if (!isNull()) {
+            super.setValue(value);
+        }
+        this.fireStateChanged();
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/JNullSpinner.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/JNullSpinner.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/JNullSpinner.java	(revision 1235)
@@ -0,0 +1,358 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.date;
+
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.Icon;
+import javax.swing.JLabel;
+import javax.swing.JSpinner;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+
+public class JNullSpinner extends JSpinner {
+
+    private int type;
+    private Pattern pattern;
+
+    private String enableText;
+    private String toolTip;
+
+	private JLabel iconLabel;
+
+	private int filled = 0;
+    private String subType;    
+
+
+
+	// private static int[][] spinnerSizes = new int[][] { new int[] { 22, 30 },
+	// new int[] { 44, 30 }, new int[] { 66, 30 }, new int[] { 88, 30 },
+	// new int[] { 110, 30 }, new int[] { 132, 30 }, new int[] { 154, 30 } };
+
+
+
+    /**
+     * Creates a new empty instance of org.gvsig.gui.beans.swing.Jspinner.
+     */
+    public JNullSpinner(int dataType, String subType, Locale loc,
+        String initialValue) {
+        super();
+        initSettings(dataType, subType, loc, initialValue);
+    }
+
+    public JNullSpinner(int dataType, Object value, int defaultMaximumWidth) {
+        this(dataType, value);
+        this.filled = defaultMaximumWidth;
+    }
+
+    private void initSettings(int dataType, String subType, Locale loc,
+        Object value) {
+
+        this.type = dataType;
+        this.subType = subType;
+
+        this.pattern = setMatcher(dataType, subType);
+        setModel(this.type, this.subType, loc);
+
+        setValue(value);
+    }
+     
+    private void setModel(int type, String subType, Locale locale) {
+        NullSpinnerHandler handler =
+            new NullSpinnerHandler(type,subType, locale);
+        this.setModel(handler.getModel());
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.Jspinner containing
+     * an
+     * image.
+     */
+    public JNullSpinner(Icon icon) {
+        this(DataTypes.STRING, null);
+        iconLabel = new JLabel(icon);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.Jspinner containing a
+     * text.
+     * 
+     * @param text
+     */
+    public JNullSpinner(String text) {
+        this(DataTypes.STRING, text);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.Jspinner containing
+     * an
+     * image and a text.
+     * 
+     * @param text
+     * @param icon
+     */
+    public JNullSpinner(String text, Icon icon) {
+        this(text);
+        iconLabel = new JLabel(icon);
+    }
+
+    // /**
+    // * Creates a new instance of org.gvsig.gui.beans.swing.Jspinner from an
+    // * {@link Action}.
+    // */
+    // public JStandardizedspinner(Action action) {
+    // super(action);
+    // }
+
+    /**
+     * Gets the text that appears in the tooltip when the spinner is disabled.
+     * 
+     * @return String
+     */
+    public String getEnableText() {
+        return enableText;
+    }
+
+//    @Override
+//    public Dimension getMaximumSize() {
+//        return getPreferredSize();
+//    }
+//
+//    @Override
+//    public Dimension getMinimumSize() {
+//        return getPreferredSize();
+//    }
+
+//    @Override
+//    public Dimension getPreferredSize() {
+//        Dimension d = null;
+//        if (this.getParent()!=null){
+//            try{
+//                d= this.getParent().getMaximumSize(); 
+//            }catch(NullPointerException e){
+//                d = super.getMaximumSize();  
+//                if (d == null){
+//                    int index = spinnerSizes.length-1;
+//                    d = new Dimension(spinnerSizes[index][0],spinnerSizes[index][1]);                    
+//                }                
+//            }
+//        }
+//        Dimension pref = super.getPreferredSize();
+//        if ((pref!=null)&&(pref.getWidth()<=spinnerSizes[0][0])){
+//            pref.width = spinnerSizes[0][0];
+//            return pref;
+//        }
+//        if ((filled<0)&&(d!=null)){
+//            return d;
+//        }
+//        return pref;
+////        return super.getPreferredSize();
+////        int textSize = 0;
+////        if (this.getValue() != null) {
+////            textSize = this.getValue().toString().length();
+////        }
+////
+////        if (d == null) {
+////            return new Dimension(spinnerSizes[0][0], spinnerSizes[0][1]);
+////        }
+////        int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+////        int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+////
+////        // figure out the suitable width
+////        for (int i = spinnerSizes.length - 1; i >= 0; i--) {
+////            if (oldWidth <= spinnerSizes[i][0]) {
+////                newWidth = spinnerSizes[i][0];
+////            } else
+////                if (textSize > newWidth) {
+////                    newWidth = spinnerSizes[i][0];
+////                }
+////
+////        }
+////
+////        // figure out the suitable height
+////        for (int i = spinnerSizes.length - 1; i >= 0; i--) {
+////            if (oldHeight <= spinnerSizes[i][1]) {
+////                newHeight = spinnerSizes[i][1];
+////            }
+////        }
+////
+////        if (filled < 0) {
+////
+////            d = getUI().getMaximumSize(this);
+////            newWidth = (int) (d.getWidth() - 6);
+////        } else
+////            if (filled > 0) {
+////                if (oldWidth < filled) {
+////                    newWidth = filled;
+////                } else {
+////                    newWidth = oldWidth;
+////                }
+////            }
+////
+////        return new Dimension(newWidth, newHeight);
+//    }
+
+	// public void setValue(String text) {
+	// super.setValue(text);
+	// Dimension sz = getNewDimension();
+	// super.setSize(sz);
+	// super.setPreferredSize(sz);
+	// }
+	//
+	// private Dimension getNewDimension() {
+	// Dimension d = getUI().getMinimumSize(this);
+	// int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+	// int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+	//
+	// // figure out the suitable height
+	// // for (int i = spinnerSizes.length - 1; i >= 0; i--)
+	// // if (oldHeight <= spinnerSizes[i][1])
+	// // newHeight = spinnerSizes[i][1];
+	//
+	//
+	//
+	//
+	// //
+	// // int textSize = this.getText().trim().length();
+	// //
+	// // if (textSize<2){
+	// // newHeight = spinnerSizes[0][1];
+	// // }
+	// // newWidth = getSuitableTextWidth(textSize, newWidth);
+	//
+	// return new Dimension(newWidth, newHeight);
+	// }
+
+	// private int getSuitableTextWidth(int textWidth, int oldWidth) {
+	// int newWidth = spinnerSizes[0][0];
+	// if (oldWidth<1){
+	// return newWidth;
+	// }
+	// for (int i = spinnerSizes.length - 1; i >= 0; i--)
+	// if ((textWidth <= spinnerSizes[i][0])||(oldWidth<=spinnerSizes[i][0]))
+	// newWidth = spinnerSizes[i][0];
+	// return newWidth;
+	// }
+
+    private String getText() {
+        Object value = getValue();
+        if (value == null){
+            return "";
+        }
+        return value.toString();
+        
+    }
+
+    @Override
+    public void setEnabled(boolean aFlag) {
+        super.setEnabled(aFlag);
+        if (aFlag) {
+            setToolTipText(toolTip);
+        } else {
+            setToolTipText(enableText);
+        }
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the spinner is disabled.
+     * 
+     * @param enableText
+     *            The enableText to set.
+     */
+    public void setEnableText(String enableText) {
+        this.enableText = enableText;
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the spinner is enabled.
+     */
+    public void setToolTip(String text) {
+        toolTip = text;
+    }
+
+    public void setFill(int filledMaximumWidth) {
+        this.filled = filledMaximumWidth;
+    }
+
+    @Override
+    public Object getValue() {
+        return this.getModel().getValue();
+    }
+
+    @Override
+    public void setValue(Object value) {
+        if (value == null) {
+            value = "";
+        }
+        this.getModel().setValue(value);
+    }
+    
+    public JNullSpinner(int dataType, Object value) {
+        super();
+        this.initSettings(dataType, null, null, value);
+    }
+
+    private Pattern setMatcher(int dataType, String subType) {
+
+        Pattern p = Pattern.compile(".*?");
+
+        switch (dataType) {
+
+        case DataTypes.FLOAT:
+            Pattern.compile("([0-9]*)\\.[0]");
+            break;
+        case DataTypes.DOUBLE:
+            Pattern.compile("([0-9]*)\\.[0]");
+            break;
+        case DataTypes.INT:
+            Pattern.compile("([0-9]*)");
+            break;
+        case DataTypes.BOOLEAN:
+            Pattern.compile("[t|T]rue|[f|F]alse|[u|U]nknown");
+            break;
+        case DataTypes.LONG:
+            Pattern.compile("([0-9]*)");
+            break;
+
+        }
+
+        return p;
+    }
+
+    public boolean matches(String value) {
+        Matcher m = pattern.matcher(value);
+        return m.matches();
+    }
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/NullSpinnerHandler.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/NullSpinnerHandler.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/spinner/date/NullSpinnerHandler.java	(revision 1235)
@@ -0,0 +1,493 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+package org.gvsig.tools.swing.impl.usability.spinner.date;
+
+import java.awt.Component;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SpinnerListModel;
+import javax.swing.SpinnerModel;
+import javax.swing.SpinnerNumberModel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.swing.impl.usability.spinner.editor.DataTypesFormatter;
+
+/**
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class NullSpinnerHandler {
+
+    private Component txtField = null;
+    
+    private final Logger LOG = LoggerFactory
+    .getLogger(NullSpinnerHandler.class);
+
+
+    public class NullSpinnerDateModel extends SpinnerDateModel {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -400734052278449520L;
+        private NullSpinnerHandler handler;
+
+        public NullSpinnerDateModel(NullSpinnerHandler handler,
+            Comparable start, Comparable end) {
+            super(new Date(), start, end,handler.getFormatter().getCalendarField());
+            this.handler = handler;
+            this.setValue(null);
+        }
+
+        public Object format(Object value) {
+            return handler.getFormatter().format(value);
+        }
+
+        @Override
+        public int getCalendarField() {
+            return super.getCalendarField();
+        }
+
+        /**
+         * @return
+         */
+        public SimpleDateFormat getFormat() {
+            return getFormatter().getDateFormatter();
+        }
+
+        @Override
+        public Object getNextValue() {
+            Object next = handler.getNextValue();
+            // fireStateChanged();
+            return next;
+        }
+
+        @Override
+        public Object getPreviousValue() {
+            Object prev = handler.getPreviousValue();
+            // fireStateChanged();
+            return prev;
+        }
+
+        @Override
+        public Object getValue() {
+            return handler.getValue();
+        }
+
+        @Override
+        public void setCalendarField(int calendarField) {
+            try {
+                super.setCalendarField(calendarField);
+            } catch (IllegalArgumentException e) {
+                if (getValue() != null) {
+                    throw new IllegalArgumentException(e);
+                }
+                this.fireStateChanged();
+            }
+            handler.getFormatter().setCalendarField(getCalendarField());
+        }
+
+        @Override
+        public void setValue(Object value) {
+            Object oldValue = getValue();
+            handler.setValue(value);
+            if (value != null) {
+                super.setValue(handler.getValue());
+            } else
+                if (oldValue == null) {
+                    if (value != null) {
+                        fireStateChanged();
+                    }
+                } else
+                    if (!oldValue.equals(value)) {
+                        fireStateChanged();
+                    }
+        }
+    }
+
+    public class NullSpinnerNumberModel extends javax.swing.SpinnerNumberModel {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = -3645717385964526394L;
+        private NullSpinnerHandler handler;
+
+        public NullSpinnerNumberModel(NullSpinnerHandler handler,
+            Comparable minimum, Comparable maximum) {
+            super(0, minimum, maximum, 1);
+            this.handler = handler;
+        }
+        
+
+        /**
+         * @param value
+         * @return
+         */
+        public Object format(Object value) {
+            return getFormatter().format(value);
+        }
+        
+        public DataTypesFormatter getFormatter(){
+            return handler.getFormatter();
+        }
+
+        /**
+         * @return
+         */
+        public NumberFormat getFormat() {
+            return getFormatter().getNumberFormatter();
+        }
+
+        @Override
+        public Object getNextValue() {
+            return handler.getNextValue();
+        }
+
+        @Override
+        public Object getPreviousValue() {
+            // TODO Auto-generated method stub
+            return handler.getPreviousValue();
+        }
+
+        @Override
+        public Object getValue() {
+            return handler.getValue();
+        }
+
+        @Override
+        public void setValue(Object value) {
+            handler.setValue(value); 
+            value = handler.getValue();
+            if (value != null) {
+                super.setValue(value);
+            }
+            if (!isFirstTime()) {
+                this.fireStateChanged();
+            }
+           
+        }
+    }
+
+    /**
+     * @return
+     */
+    private static int getInitialCalendarField(DynField dynField, Locale loc) {
+        DataTypesFormatter formatter =
+            DataTypesFormatter.getInstance(dynField.getType(),
+                dynField.getSubtype(), loc);
+        return formatter.getCalendarField();
+    }
+
+    private DataTypesFormatter formatter = null;
+    private Object curValue = null;
+    private Comparable start = null;
+    private Comparable end = null;
+
+    private SpinnerModel model = null;
+
+    private boolean isNotFirstTime;
+
+    private boolean valid = true;
+
+    /**
+     * @param field
+     * @param value
+     */
+    public NullSpinnerHandler(DynField field) {
+        this(field, Locale.getDefault());
+    }
+
+    /**
+     * @param field
+     * @param value
+     */
+    public NullSpinnerHandler(DynField dynField, Locale loc) {
+        super();
+        init(dynField.getType(), dynField.getSubtype(), loc,
+            (Comparable) dynField.getMinValue(),
+            (Comparable) dynField.getMaxValue());
+    }
+
+    public NullSpinnerHandler(int type, String subType, Locale loc) {
+        super();
+        init(type, subType, new Locale("en"), null, null);
+    }
+
+    public Date getDate() {
+        if (formatter.isDate()) {
+            return (Date) getValue();
+        }
+        return null;
+    }
+
+    /**
+     * @return
+     */
+    public NullSpinnerDateModel getDateModel() {
+        if (model == null) {
+            this.model = new NullSpinnerDateModel(this, this.start, this.end);
+        }
+        return (NullSpinnerDateModel) model;
+    }
+
+    public DataTypesFormatter getDynFieldFormatter() {
+        return this.formatter;
+    }
+
+    /**
+     * @return
+     */
+    private Comparable getEnd() {
+        return this.end;
+    }
+
+    /**
+     * @return
+     */
+    public DataTypesFormatter getFormatter() {
+        return this.formatter;
+    }
+
+    public void initDefaultModel() {
+        if (model == null) {
+            this.model = getModel();
+        }
+    }
+
+    public Object getNextValue() {
+        Object next = formatter.getNextValue(getValue());
+        return ((this.getEnd() == null) || (this.getEnd().compareTo(next) >= 0))
+            ? next : null;
+    }
+
+    /**
+     * @return
+     */
+    public NullSpinnerNumberModel getNumberModel() {
+        if (model == null) {
+            this.model = new NullSpinnerNumberModel(this, this.start, this.end);
+        }
+        return (NullSpinnerNumberModel) model;
+    }
+
+    public Object getPreviousValue() {
+        Object prev = formatter.getPreviousValue(getValue());
+        return ((this.getStart() == null) || (this.getStart().compareTo(prev) <= 0))
+            ? prev : null;
+
+    }
+
+    /**
+     * @return
+     */
+    private Comparable getStart() {
+        return start;
+    }
+
+    public Object getValue() {
+        if ((isFirstTime()) && (this.curValue == null)) {
+            if (formatter.isDate()) {
+                return new Date();
+            } else
+                if (isNumber()) {
+                    return 0;
+                }
+            return null;
+        }
+        return formatter.parse(this.curValue);
+    }
+
+    /**
+     * @param textField
+     * @return
+     */
+    public Object getValueFromTexField(JFormattedTextField textField) {
+        String txt = textField.getText();
+        return parseOrNull(txt);
+    }
+
+    /**
+     * @param dynField
+     * @param loc
+     * @param value
+     */
+    protected void init(int dataType, String subType, Locale loc,
+        Comparable start, Comparable end) {
+        this.model = getModel(dataType,subType, loc, start, end);
+    }
+    /**
+     * @param dynField
+     * @param loc
+     * @param value
+     * @return 
+     */
+    protected SpinnerModel getModel(int dataType, String subType, Locale loc,
+        Comparable start, Comparable end) {
+        this.start = start;
+        this.end = end;
+        this.formatter = DataTypesFormatter.getInstance(dataType, subType, loc);
+        return getModel();
+    }
+    
+    public SpinnerModel getModel(DynField dynField){
+        if (formatter.isDate()) {
+            SpinnerDateModel dateModel = new SpinnerDateModel();
+            dateModel.setStart((Comparable) dynField.getMinValue());
+            dateModel.setEnd((Comparable) dynField.getMaxValue());
+            return dateModel;
+        } else
+            if (formatter.isNumber()) {
+                SpinnerNumberModel numModel = new SpinnerNumberModel();
+                numModel.setMinimum((Comparable) dynField.getMinValue());
+                numModel.setMaximum((Comparable) dynField.getMaxValue());
+                numModel.setStepSize(1);
+                return numModel;
+            }
+
+        SpinnerModel model = new SpinnerListModel(getLabelValues(dynField));
+        return model;
+    }
+
+    public String[] getLabelValues(DynField dynField) {
+        DynObjectValueItem[] items = dynField.getAvailableValues();
+
+        if ((items == null) || (items.length < 1)) {
+            return new String[0];
+        }
+
+        String[] strValues = new String[items.length];
+        for (int i = 0; i < strValues.length; i++) {
+            strValues[i] = items[i].getLabel();
+        }
+        return strValues;
+    }
+
+    /**
+     * @return 
+	 * 
+	 */
+    public SpinnerModel getModel() {
+        if (this.model == null){
+            if (formatter.isDate()) {
+                model = new NullSpinnerDateModel(this, this.start, this.end);
+            } else
+                if (formatter.isNumber()) {
+                    model =
+                        new NullSpinnerNumberModel(this, this.start, this.end);
+                } else {
+                    model = new SpinnerListModel();
+                }
+            
+        }
+        return model;
+
+    }
+
+    /**
+     * @return
+     */
+    public boolean isDate() {
+        return formatter.isDate();
+    }
+
+    private boolean isFirstTime() {
+        return !isNotFirstTime;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isNumber() {
+        return this.formatter.isNumber();
+    }
+
+    /**
+     * @param txt
+     * @return
+     */
+    public Object parseOrNull(String txt) {
+        try {
+            return formatter.parse(txt);
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    public void setDefaultValueOn(boolean isSet) {
+        this.isNotFirstTime = !isSet;
+    }
+
+    public void setValue(Object value) {
+		if (value instanceof String) {
+			if (((String) value).equals("")) {
+				value = null;
+			}
+		}
+          
+       if ((value != null) && (!formatter.isValidType(value))) {      
+            throw new IllegalArgumentException(value.toString());
+        } else {
+            this.curValue = formatter.parse(value);
+        }
+    }
+
+    public JFormattedTextField getTextField() {
+        model = this.getModel();
+        if (model instanceof JSpinner.DefaultEditor) {
+            return ((JSpinner.DefaultEditor) model).getTextField();
+        }
+        if (model instanceof JSpinner.NumberEditor) {
+            return ((JSpinner.NumberEditor) model).getTextField();
+        }
+        if (model instanceof JSpinner.ListEditor){
+            return ((JSpinner.ListEditor) model).getTextField();
+            
+        }
+        return null;
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/JBlank.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/JBlank.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/JBlank.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability;
+
+import java.awt.Component;
+import java.awt.Dimension;
+
+public class JBlank extends Component {
+
+	public JBlank(int width, int height) {
+		super();
+		Dimension dim = new Dimension(width, height);
+		setSize(dim);
+		setPreferredSize(dim);
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/text/JStandardizedTextArea.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/text/JStandardizedTextArea.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/text/JStandardizedTextArea.java	(revision 1235)
@@ -0,0 +1,264 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.text;
+
+import java.awt.Dimension;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JLabel;
+import javax.swing.JTextArea;
+
+/**
+ * According to the gvSIG's GUI style sheet all the TextAreas in the application
+ * will have a normative size. No smaller than a concrete size, and big enough
+ * to contain the text and avoiding the "..." characters. The TextArea will grow
+ * up in width by a set of widths defined in this style sheet, always choosing
+ * the smallest width that can contain the text. If the biggest width is not
+ * enought for this purpose then the TextArea will automatically grow up to the
+ * smallest necessary width to fit the text.<br>
+ * <p>
+ * The TextArea resizing is based on the <b>setText(String txt)</b> method.
+ * However, it is possible to use a custom size if you invoke one of
+ * <b>setSize(..)</b>, <b>setBorders(...)</b> or <b>setPreferredSize(...)</b>
+ * after invoking the <b>setText(...)<b> method.
+ * <p>
+ * This class is just a standard javax.swing.JTextArea that handles this issue.
+ * </p>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * 
+ */
+public class JStandardizedTextArea extends JTextArea {
+
+    private static final long serialVersionUID = -1635879317292710725L;
+
+    private static int[][] textAreaSizes = new int[][] { new int[] { 22, 25 },
+        new int[] { 44, 25 }, new int[] { 66, 25 }, new int[] { 88, 25 },
+        new int[] { 110, 25 }, new int[] { 132, 25 }, new int[] { 154, 25 } };
+
+    private String enableText;
+    private String toolTip;
+
+    private JLabel iconLabel;
+
+    private int filled = 0;
+
+    /**
+     * Creates a new empty instance of org.gvsig.gui.beans.swing.JTextArea.
+     */
+    public JStandardizedTextArea() {
+        super();
+        initSettings();
+    }
+
+    private void initSettings() {
+        setBorder(BorderFactory.createTitledBorder(""));
+        setRows(2);
+        setLineWrap(true);
+        this.setEnabled(true);
+        this.setEditable(true);
+    }
+
+    // /**
+    // * Creates a new instance of org.gvsig.gui.beans.swing.JTextArea from an
+    // * {@link Action}.
+    // */
+    // public JStandardizedTextArea(Action action) {
+    // super(action);
+    // }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JTextArea containing
+     * an
+     * image.
+     */
+    public JStandardizedTextArea(Icon icon) {
+        super();
+        iconLabel = new JLabel(icon);
+        initSettings();
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JTextArea containing
+     * a
+     * text.
+     * 
+     * @param text
+     */
+    public JStandardizedTextArea(String text) {
+        super();
+        setText(text);
+        initSettings();
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JTextArea containing
+     * an
+     * image and a text.
+     * 
+     * @param text
+     * @param icon
+     */
+    public JStandardizedTextArea(String text, Icon icon) {
+        this(icon);
+        setText(text);
+    }
+
+    /**
+     * Gets the text that appears in the tooltip when the TextArea is disabled.
+     * 
+     * @return String
+     */
+    public String getEnableText() {
+        return enableText;
+    }
+
+    @Override
+    public Dimension getMaximumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+    public Dimension getMinimumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+//    public Dimension getPreferredSize() {
+////        Dimension d = getUI().getMinimumSize(this);
+////        Dimension size = getNewDimension();
+////        int newWidth = 0;
+////        if (filled < 0) {
+////            d = getUI().getMaximumSize(this);
+////            newWidth = (int) (d.getWidth() - 1);
+////        } else
+////            if (filled > 0) {
+////                if (size.width < filled) {
+////                    newWidth = filled;
+////                } 
+////            }
+////        if (newWidth > 0){
+////            size.width = newWidth;
+////        }
+////        return size;
+//
+//        Dimension sz = getNewDimension();
+//        super.setSize(sz);
+//        super.setPreferredSize(sz);
+//        return sz;
+//    }
+
+    public void setText(String text) {
+        super.setText(text);
+        Dimension sz = getNewDimension();
+        super.setSize(sz);
+        super.setPreferredSize(sz);
+    }
+
+    private Dimension getNewDimension() {
+        Dimension d = getUI().getMinimumSize(this);
+        int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+        int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+
+//        // figure out the suitable width
+//        for (int i = textAreaSizes.length - 1; i >= 0; i--)
+//            if (oldWidth <= textAreaSizes[i][0])
+//                newWidth = textAreaSizes[i][0];
+
+        int rows = getRows();
+        if(rows == 0) {
+            rows = 1;
+        }
+//        newHeight = textAreaSizes[0][1]*rows;
+//        if (oldHeight>newHeight){
+//            rows =newHeight/oldHeight;
+//            if (newHeight%oldHeight!=0){
+//                rows+=1;
+//            }
+//        }
+//        if (oldHeight<newHeight){
+//            oldHeight = newHeight;
+//        }
+        // figure out the suitable height
+        for (int i = textAreaSizes.length - 1; i >= 0; i--)
+            if (oldHeight <= textAreaSizes[i][1]*rows)
+                newHeight = textAreaSizes[i][1]*rows;
+       
+        
+
+       
+        int textSize = this.getText().trim().length();
+        
+        if (textSize<2){
+            newHeight = textAreaSizes[0][1]*rows;
+        }
+        newWidth = getSuitableTextWidth(textSize, newWidth);
+    
+        return new Dimension(newWidth, newHeight);
+    }
+
+    private int getSuitableTextWidth(int textWidth, int oldWidth) {
+        int newWidth = textAreaSizes[0][0];
+        if (oldWidth<1){
+            return newWidth;
+        }
+        for (int i = textAreaSizes.length - 1; i >= 0; i--)
+            if ((textWidth <= textAreaSizes[i][0])||(oldWidth<=textAreaSizes[i][0]))
+                newWidth  = textAreaSizes[i][0];
+        return newWidth;
+    }
+
+    @Override
+    public void setEnabled(boolean aFlag) {
+        super.setEnabled(aFlag);
+        if (aFlag) {
+            setToolTipText(toolTip);
+        } else {
+            setToolTipText(enableText);
+        }
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the TextArea is disabled.
+     * 
+     * @param enableText
+     *            The enableText to set.
+     */
+    public void setEnableText(String enableText) {
+        this.enableText = enableText;
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the TextArea is enabled.
+     */
+    public void setToolTip(String text) {
+        toolTip = text;
+    }
+
+    public void setFill(int filledMaximumWidth) {
+        this.filled = filledMaximumWidth;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java	(revision 1235)
@@ -0,0 +1,200 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.button;
+
+import java.awt.Dimension;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+
+/**
+ * According to the gvSIG's GUI style sheet all the buttons in the application
+ * will have a normative size. No smaller than a concrete size, and big enough
+ * to contain the text and avoiding the "..." characters. The button will grow
+ * up in width by a set of widths defined in this style sheet, always choosing
+ * the smallest width that can contain the text. If the biggest width is not
+ * enought for this purpose then the button will automatically grow up to the
+ * smallest necessary width to fit the text.<br>
+ * <p>
+ * The button resizing is based on the <b>setText(String txt)</b> method.
+ * However, it is possible to use a custom size if you invoke one of
+ * <b>setSize(..)</b>, <b>setBorders(...)</b> or <b>setPreferredSize(...)</b>
+ * after invoking the <b>setText(...)<b> method.
+ * <p>
+ * This class is just a standard javax.swing.JButton that handles this issue.
+ * </p>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * 
+ */
+public class JStandardizedToolButton extends JButton {
+
+    private static final long serialVersionUID = -1635879317292710725L;
+
+    // TODO this should be initialized from a properties file or so.
+    private static int[][] buttonSizes =
+        new int[][] { new int[] { 22, 22 }, new int[] { 44, 22 },
+            new int[] { 66, 22 }, new int[] { 88, 22 }, new int[] { 110, 22 },
+            new int[] { 132, 22 }, new int[] { 154, 22 } };
+
+    private String enableText;
+    private String toolTip;
+
+    /**
+     * Creates a new empty instance of org.gvsig.gui.beans.swing.JButton.
+     */
+    public JStandardizedToolButton() {
+        super();
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton from an
+     * {@link Action}.
+     */
+    public JStandardizedToolButton(Action action) {
+        super(action);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+     * image.
+     */
+    public JStandardizedToolButton(Icon icon) {
+        super(icon);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing a
+     * text.
+     * 
+     * @param text
+     */
+    public JStandardizedToolButton(String text) {
+        super();
+        setText(text);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+     * image and a text.
+     * 
+     * @param text
+     * @param icon
+     */
+    public JStandardizedToolButton(String text, Icon icon) {
+        super(icon);
+        setText(text);
+    }
+
+    /**
+     * Gets the text that appears in the tooltip when the button is disabled.
+     * 
+     * @return String
+     */
+    public String getEnableText() {
+        return enableText;
+    }
+
+    @Override
+    public Dimension getMaximumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+    public Dimension getMinimumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+    public Dimension getPreferredSize() {
+        Dimension d = getUI().getMinimumSize(this);
+        int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+        int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+
+        // figure out the suitable width
+        for (int i = buttonSizes.length - 1; i >= 0; i--) {
+            if (oldWidth <= buttonSizes[i][0]) {
+                newWidth = buttonSizes[i][0];
+            }
+        }
+
+        // figure out the suitable height
+        for (int i = buttonSizes.length - 1; i >= 0; i--) {
+            if (oldHeight <= buttonSizes[i][1]) {
+                newHeight = buttonSizes[i][1];
+            }
+        }
+
+        return new Dimension(newWidth, newHeight);
+    }
+
+    // public void setText(String text) {
+    // super.setText(text);
+    // Dimension d = getUI().getMinimumSize(this);
+    // int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+    // int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+    //
+    // // figure out the suitable width
+    // for (int i = buttonSizes.length - 1; i >= 0; i--)
+    // if (oldWidth < buttonSizes[i][0])
+    // newWidth = buttonSizes[i][0];
+    //
+    // // figure out the suitable height
+    // for (int i = buttonSizes.length - 1; i >= 0; i--)
+    // if (oldHeight < buttonSizes[i][1])
+    // newHeight = buttonSizes[i][1];
+    //
+    // Dimension sz = new Dimension(newWidth, newHeight);
+    // super.setSize(sz);
+    // super.setPreferredSize(sz);
+    // }
+
+    @Override
+    public void setEnabled(boolean aFlag) {
+        super.setEnabled(aFlag);
+        if (aFlag) {
+            setToolTipText(toolTip);
+        } else {
+            setToolTipText(enableText);
+        }
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the button is disabled.
+     * 
+     * @param enableText
+     *            The enableText to set.
+     */
+    public void setEnableText(String enableText) {
+        this.enableText = enableText;
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the button is enabled.
+     */
+    public void setToolTip(String text) {
+        toolTip = text;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java	(revision 1235)
@@ -0,0 +1,199 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.impl.usability.button;
+
+import java.awt.Dimension;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+
+/**
+ * According to the gvSIG's GUI style sheet all the buttons in the application
+ * will have a normative size. No smaller than a concrete size, and big enough
+ * to contain the text and avoiding the "..." characters. The button will grow
+ * up in width by a set of widths defined in this style sheet, always choosing
+ * the smallest width that can contain the text. If the biggest width is not
+ * enought for this purpose then the button will automatically grow up to the
+ * smallest necessary width to fit the text.<br>
+ * <p>
+ * The button resizing is based on the <b>setText(String txt)</b> method.
+ * However, it is possible to use a custom size if you invoke one of
+ * <b>setSize(..)</b>, <b>setBorders(...)</b> or <b>setPreferredSize(...)</b>
+ * after invoking the <b>setText(...)<b> method.
+ * <p>
+ * This class is just a standard javax.swing.JButton that handles this issue.
+ * </p>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * 
+ */
+public class JStandardizedButton extends JButton {
+
+    private static final long serialVersionUID = -1635879317292710725L;
+
+    // TODO this should be initialized from a properties file or so.
+    private static int[][] buttonSizes =
+        new int[][] { new int[] { 90, 23 }, new int[] { 110, 23 },
+            new int[] { 135, 23 }, new int[] { 160, 23 } };
+
+    private String enableText;
+    private String toolTip;
+
+    /**
+     * Creates a new empty instance of org.gvsig.gui.beans.swing.JButton.
+     */
+    public JStandardizedButton() {
+        super();
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton from an
+     * {@link Action}.
+     */
+    public JStandardizedButton(Action action) {
+        super(action);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+     * image.
+     */
+    public JStandardizedButton(Icon icon) {
+        super(icon);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing a
+     * text.
+     * 
+     * @param text
+     */
+    public JStandardizedButton(String text) {
+        super();
+        setText(text);
+    }
+
+    /**
+     * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+     * image and a text.
+     * 
+     * @param text
+     * @param icon
+     */
+    public JStandardizedButton(String text, Icon icon) {
+        super(icon);
+        setText(text);
+    }
+
+    /**
+     * Gets the text that appears in the tooltip when the button is disabled.
+     * 
+     * @return String
+     */
+    public String getEnableText() {
+        return enableText;
+    }
+
+    @Override
+    public Dimension getMaximumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+    public Dimension getMinimumSize() {
+        return getPreferredSize();
+    }
+
+    @Override
+    public Dimension getPreferredSize() {
+        Dimension d = getUI().getMinimumSize(this);
+        int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+        int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+
+        // figure out the suitable width
+        for (int i = buttonSizes.length - 1; i >= 0; i--) {
+            if (oldWidth < buttonSizes[i][0]) {
+                newWidth = buttonSizes[i][0];
+            }
+        }
+
+        // figure out the suitable height
+        for (int i = buttonSizes.length - 1; i >= 0; i--) {
+            if (oldHeight < buttonSizes[i][1]) {
+                newHeight = buttonSizes[i][1];
+            }
+        }
+
+        return new Dimension(newWidth, newHeight);
+    }
+
+    // public void setText(String text) {
+    // super.setText(text);
+    // Dimension d = getUI().getMinimumSize(this);
+    // int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+    // int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+    //
+    // // figure out the suitable width
+    // for (int i = buttonSizes.length - 1; i >= 0; i--)
+    // if (oldWidth < buttonSizes[i][0])
+    // newWidth = buttonSizes[i][0];
+    //
+    // // figure out the suitable height
+    // for (int i = buttonSizes.length - 1; i >= 0; i--)
+    // if (oldHeight < buttonSizes[i][1])
+    // newHeight = buttonSizes[i][1];
+    //
+    // Dimension sz = new Dimension(newWidth, newHeight);
+    // super.setSize(sz);
+    // super.setPreferredSize(sz);
+    // }
+
+    @Override
+    public void setEnabled(boolean aFlag) {
+        super.setEnabled(aFlag);
+        if (aFlag) {
+            setToolTipText(toolTip);
+        } else {
+            setToolTipText(enableText);
+        }
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the button is disabled.
+     * 
+     * @param enableText
+     *            The enableText to set.
+     */
+    public void setEnableText(String enableText) {
+        this.enableText = enableText;
+    }
+
+    /**
+     * Sets the text that appears in the tooltip when the button is enabled.
+     */
+    public void setToolTip(String text) {
+        toolTip = text;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java	(revision 1235)
@@ -0,0 +1,197 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.impl.usability;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.FocusListener;
+import java.util.Locale;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.JTextArea;
+import javax.swing.border.Border;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+import org.gvsig.tools.swing.impl.usability.button.JStandardizedButton;
+import org.gvsig.tools.swing.impl.usability.button.JStandardizedToolButton;
+import org.gvsig.tools.swing.impl.usability.spinner.date.JNullSpinner;
+import org.gvsig.tools.swing.impl.usability.spinner.editor.DefaultDynFieldEditor;
+import org.gvsig.tools.swing.impl.usability.text.JStandardizedTextArea;
+
+/**
+ * Default implementation for the {@link UsabilitySwingManager}.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class DefaultUsabilitySwingManager implements UsabilitySwingManager {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.api.usability.UsabilitySwingManager#createBoxLayout
+     * (java.awt.Component, java.awt.Component, java.lang.Integer,
+     * java.lang.Integer)
+     */
+    public JPanel createGridBagRowPanel(JPanel gridBagPanel,
+        Component labelComponent, Component fieldComponent,
+        Integer labelMargin, Integer fieldMargin) {
+        // Creates a panel that uses BoxLayout.
+        JPanel panel;
+        if (gridBagPanel == null) {
+            panel = new JPanel();
+            panel.setLayout(new GridBagLayout());
+        } else {
+            panel = gridBagPanel;
+        }
+
+        GridBagConstraints constr = this.getDefaultParametersConstraints();
+        constr.fill = GridBagConstraints.HORIZONTAL;
+
+        constr.gridwidth = GridBagConstraints.RELATIVE;
+        constr.weighty = 0;
+
+        if (labelComponent != null) {
+            if (labelMargin != null) {
+                constr.weightx = labelMargin;
+            }
+            panel.add(labelComponent, constr);
+        }
+        constr.fill = GridBagConstraints.NONE;
+        // constr.gridwidth = GridBagConstraints.RELATIVE;
+
+        if (fieldComponent != null) {
+            constr.weightx = 0;
+            if (fieldMargin != null) {
+                constr.weightx = labelMargin;
+            }
+            panel.add(fieldComponent, constr);
+        }
+        return panel;
+    }
+
+    public JButton createJButton() {
+        return new JStandardizedButton();
+    }
+
+    public JButton createJButton(Action action) {
+        return new JStandardizedButton(action);
+    }
+
+    public JButton createJButton(Icon icon) {
+        return new JStandardizedButton(icon);
+    }
+
+    public JButton createJButton(String text) {
+        return new JStandardizedButton(text);
+    }
+
+    public JButton createJButton(String text, Icon icon) {
+        return new JStandardizedButton(text, icon);
+    }
+
+    public JButton createJToolButton(String text) {
+        return new JStandardizedToolButton(text);
+    }
+
+    /**
+     * @return
+     */
+    private GridBagConstraints getDefaultParametersConstraints() {
+        GridBagConstraints constr = new GridBagConstraints();
+        constr.insets = new Insets(2, 2, 2, 2);
+        constr.ipadx = 2;
+        constr.ipady = 2;
+        constr.anchor = GridBagConstraints.PAGE_START;
+        return constr;
+    }
+
+    /**
+     * Sets a new marked border returning the older border settings.
+     * 
+     * @param component
+     * @return
+     */
+    public Border setLightMarkedBorder(JComponent component){
+        return setLightMarkedBorder(component, 1, Color.red);
+    }
+    
+    /**
+     * Sets a new marked border returning the older border settings.
+     * 
+     * @param component
+     * @return
+     */
+    public Border setLightMarkedBorder(JComponent component, int thickness, Color color){
+        Border oldBorder = component.getBorder();
+        Border one = BorderFactory.createEtchedBorder();
+        Border two = BorderFactory.createMatteBorder(thickness,thickness,thickness,thickness, color);
+        component.setBorder(BorderFactory.createCompoundBorder(one, two));
+        return oldBorder;
+    }
+    public JTextArea createJTextArea(String text) {
+        return new JStandardizedTextArea(text);
+    }
+
+    public JTextArea createJTextArea(String text, int maxWidth) {
+        JStandardizedTextArea ta = new JStandardizedTextArea(text);
+        ta.setFill(maxWidth);
+        return ta;
+    }
+
+    public JSpinner createJNullSpinner(int dataType, Object value, int defaultMaximumWidth) {
+        JNullSpinner spinner = new JNullSpinner(dataType, value, defaultMaximumWidth);
+        return spinner;
+		// return new DefaultDynFieldEditor(listener,dynField, locale);
+    }
+
+
+    public JSpinner createJNullSpinner(int dataType, Object value) {
+        JNullSpinner spinner = new JNullSpinner(dataType, value);
+        return spinner;
+		// return new DefaultDynFieldEditor(listener,dynField, locale);
+    }
+    
+    public DefaultDynFieldEditor createNullSpinnerEditor(FocusListener listener, DynField dynField, Locale locale){
+        return new DefaultDynFieldEditor(listener,dynField, locale);
+	}
+
+	public Component createJBlank(int width, int height) {
+		return new JBlank(width, height);
+	}
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/transparent.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/transparent.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/unavailable.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/unavailable.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/disabledCancelRequestButton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/disabledCancelRequestButton.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/disabledRemoveTaskButton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/disabledRemoveTaskButton.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/cancelRequestButton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/cancelRequestButton.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/removeTaskButton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/removeTaskButton.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/showAllTaskStatusButton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/task/showAllTaskStatusButton.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.swing.impl.ToolsSwingDefaultImplLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml	(revision 1235)
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.impl</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.impl</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing</artifactId>
+        <version>3.0.57</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.impl
___________________________________________________________________
Added: svn:ignore
   + target
.settings
.classpath
.project
bin


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/pom.xml	(revision 1235)
@@ -0,0 +1,23 @@
+<?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.tools.swing</artifactId>
+    <packaging>pom</packaging>
+    <name>org.gvsig.tools.swing</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools</artifactId>
+        <version>3.0.57</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+        </dependency>
+    </dependencies>
+    <modules>
+        <module>org.gvsig.tools.swing.api</module>
+        <module>org.gvsig.tools.swing.impl</module>
+    </modules>
+</project>
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/test/java/org/gvsig/tools/AppTest.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/test/java/org/gvsig/tools/AppTest.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/test/java/org/gvsig/tools/AppTest.java	(revision 1235)
@@ -0,0 +1,58 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest extends TestCase {
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(AppTest.class);
+    }
+
+    /**
+     * Create the test case
+     * 
+     * @param testName
+     *            name of the test case
+     */
+    public AppTest(String testName) {
+        super(testName);
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp() {
+        assertTrue(true);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/Component.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/Component.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/Component.java	(revision 1235)
@@ -0,0 +1,44 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api;
+
+import javax.swing.JComponent;
+
+/**
+ * Interface for components that allows to define interfaces for them, as
+ * otherwise JComponent is a class and you cannot extend it with an interface.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public interface Component {
+
+    /**
+     * Returns this component as a swing {@link JComponent}.
+     * 
+     * @return a {@link JComponent}
+     */
+    public JComponent asJComponent();
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/EvaluatorPanel.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/EvaluatorPanel.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/EvaluatorPanel.java	(revision 1235)
@@ -0,0 +1,40 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.evaluator;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
+
+
+/**
+ * @author jldominguez
+ *
+ */
+public abstract class EvaluatorPanel extends JPanel {
+
+    public abstract void initialize(DynClass dclass, EvaluatorWithDescriptions evaluator);
+    public abstract String getExpression();
+    
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/ComponentSwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/ComponentSwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/ComponentSwingManager.java	(revision 1235)
@@ -0,0 +1,46 @@
+/* gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright � 2007-2013 gvSIG Association
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.evaluator;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
+
+
+/**
+ * 
+ * This manager will provide useful Swing-based components
+ * which can be re-used in different parts of the application
+ * (for example, a panel to form an expression, a panel to preview
+ * and select something, etc)
+ * 
+ * 
+ * 
+ * @author jldominguez
+ *
+ */
+public interface ComponentSwingManager {
+    
+    public EvaluatorPanel getEvaluatorPanel(
+        DynClass dclass, EvaluatorWithDescriptions evaluator);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusSwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusSwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusSwingManager.java	(revision 1235)
@@ -0,0 +1,37 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.task;
+
+import org.gvsig.tools.task.TaskStatusManager;
+
+public interface TaskStatusSwingManager {
+
+	public JTasksStatus createJTasksStatus(); 
+
+	public JTasksStatus createJTasksStatus(TaskStatusManager manager); 
+	
+	public JTaskStatus createJTaskStatus(); 
+
+	public JTasksStatusList createJTasksStatusList(TaskStatusManager manager);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusSwingManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.task;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.task.TaskStatusManager;
+
+public abstract class JTasksStatusList extends JPanel {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2712653249045541115L;
+
+	public abstract TaskStatusManager getManager();
+
+}
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java	(revision 1235)
@@ -0,0 +1,61 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.task;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.swing.api.Component;
+import org.gvsig.tools.task.TaskStatus;
+
+public abstract class JTaskStatus extends JPanel implements Component {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6606077362610993539L;
+
+	public abstract void bind(TaskStatus taskStatus);
+
+	public abstract boolean getShowCancelButton() ;
+	
+	public abstract void setShowCancelButton(boolean showCancelButton);
+
+	public abstract boolean getShowRemoveTaskButton();
+	
+	public abstract void setShowRemoveTaskButton(boolean showRemoveTaskButton) ;
+	
+    /**
+     * @deprecated @see {@link JTaskStatus#setTitle(String)}.
+     */
+	public abstract void setTittle(String tittle);
+
+    public abstract void setTitle(String title);
+
+	public abstract TaskStatus getTaskStatus();
+	
+	public abstract void message(String message);
+	
+	public abstract void setCurValue(long value);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java	(revision 1235)
@@ -0,0 +1,40 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.task;
+
+import javax.swing.JPanel;
+
+import org.gvsig.tools.swing.api.Component;
+import org.gvsig.tools.task.TaskStatusManager;
+
+public abstract class JTasksStatus extends JPanel implements Component {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2543254823980497949L;
+
+	public abstract void bind(TaskStatusManager manager);
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java	(revision 1235)
@@ -0,0 +1,38 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.windowmanager;
+
+import javax.swing.JComponent;
+
+public interface WindowManager {
+	
+	public enum MODE {
+		WINDOW,
+		DIALOG,
+		TOOL
+	};
+	
+	public void showWindow(JComponent componet, String tittle, MODE mode);
+
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ComponentService.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ComponentService.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ComponentService.java	(revision 1235)
@@ -0,0 +1,36 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api;
+
+import org.gvsig.tools.service.Service;
+
+/**
+ * Interface for services based on swing components.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public interface ComponentService extends Service, Component {
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/DynFieldEditor.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/DynFieldEditor.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/DynFieldEditor.java	(revision 1235)
@@ -0,0 +1,47 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.usability;
+
+import java.text.ParseException;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JSpinner;
+
+
+public interface DynFieldEditor {
+
+
+    public Object getDefaultValue();
+
+    public JSpinner getSpinner();
+
+    public Object parse (String text) throws ParseException;
+
+    public JFormattedTextField getTextField();
+
+	public Object getTextFieldValue();
+
+	public void setTextFieldValue(Object object);
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/UsabilitySwingManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/UsabilitySwingManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/UsabilitySwingManager.java	(revision 1235)
@@ -0,0 +1,171 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.tools.swing.api.usability;
+
+import java.awt.Component;
+import java.awt.event.FocusListener;
+import java.util.Locale;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JSpinner;
+import javax.swing.JTextArea;
+
+import org.gvsig.tools.dynobject.DynField;
+
+/**
+ * Creates common Swing components which take into account usability guides
+ * defined for the gvSIG project.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public interface UsabilitySwingManager {
+
+    /**
+     * Creates a button with no set text or icon.
+     * 
+     * @return a button.
+     */
+    JButton createJButton();
+
+    /**
+     * Creates a button where properties are taken from the {@link Action}
+     * supplied.
+     * 
+     * @param action
+     *            the {@link Action} used to specify the new button.
+     * 
+     */
+    JButton createJButton(Action action);
+
+    /**
+     * Creates a button with an icon.
+     * 
+     * @param icon
+     *            the Icon image to display on the button.
+     * 
+     * @return a button.
+     */
+    JButton createJButton(Icon icon);
+
+    /**
+     * Creates a button with text.
+     * 
+     * @param text
+     *            the text of the button.
+     * 
+     * @return a button.
+     */
+    JButton createJButton(String text);
+
+    /**
+     * Creates a button with initial text and icon.
+     * 
+     * @param text
+     *            the text of the button.
+     * @param icon
+     *            the Icon image to display on the button.
+     * 
+     * @return a button.
+     */
+    JButton createJButton(String text, Icon icon);
+
+    /**
+     * Creates a tool button with text.
+     * 
+     * @param text
+     *            the text of the tool button.
+     * 
+     * @return a tool button.
+     */
+    JButton createJToolButton(String text);
+
+    /**
+     * Creates a text area.
+     * 
+     * @param text
+     *            the text component
+     *             
+     * @return a tool button.
+     */
+    JTextArea createJTextArea(String text);
+
+    /**
+     * Creates a text area with a default maximum width.
+     * 
+     * @param text
+     *            the text component
+     * @param text
+     *            the text component
+     *             
+     * @return a tool button.
+     */
+    JTextArea createJTextArea(String text, int filledMaximumWidth);
+
+    /**
+     * Creates a spinner component that allows null values. It distinguishes between
+     *   number, date and floating point models based on their dataType.
+     * 
+     * @param text
+     *            the text component
+     * @param value
+     *            the initial value  
+     * 
+     * @param value
+     *            the maximum filling size  
+     *                  
+     * @return a spinner GUI component.
+     */
+    JSpinner createJNullSpinner(int dataType, Object value, int filledMaximumWidth);
+
+    /**
+     * Creates a spinner component that allows null values. It distinguishes between
+     *   number, date and floating point models based on their dataType.
+     * 
+     * @param int
+     *            the data type of dynobjectmanager.
+     * @param value
+     *            the initial value        
+     * @return a spinner GUI component.
+     */
+    JSpinner createJNullSpinner(int dataType, Object value);
+
+    
+    DynFieldEditor createNullSpinnerEditor(FocusListener listener, DynField dynField, Locale locale);
+
+	/**
+	 * Creates a JBlank panel
+	 * 
+	 * @param width
+	 * @param height
+	 * @return
+	 */
+	Component createJBlank(int width, int height);
+        
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/threadsafedialogs/ThreadSafeDialogsManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/threadsafedialogs/ThreadSafeDialogsManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/threadsafedialogs/ThreadSafeDialogsManager.java	(revision 1235)
@@ -0,0 +1,218 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api.threadsafedialogs;
+
+import java.awt.Component;
+import java.io.File;
+import javax.swing.filechooser.FileFilter;
+
+public interface ThreadSafeDialogsManager {
+	
+	/**
+	 * Create a message dialog with an ok button.
+	 * 
+	 * If message or title start whit a "_" then try to translate.
+	 *
+	 * This method is thread safe to use.
+	 * 
+	 * @param message to present in the dialog
+	 * @param title title of the dialog
+	 * @param messageType type of icon to use.
+	 * 
+	 * @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int)
+	 */
+	public void messageDialog(String message, String title, int messageType);
+	
+	/**
+	 * Create a message dialog with ok button.
+	 * 
+	 * If message or title start whit a "_" then try to translate.
+	 * if messageArgs not is null the message can be formated whit MessageFormat.
+	 * 
+	 * This method is thread safe to use.
+	 * 
+	 * @param message to present in the dialog
+	 * @param messageArgs string array of arguments used to format the message 
+	 * @param title title of the dialog
+	 * @param messageType type of icon to use.
+	 * 
+	 * @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int)
+	 */
+	public void messageDialog(String message, String messageArgs[], String title, int messageType);
+	
+	/**
+	 * Show a JOptionPane confirm dialog.
+	 * 
+	 * if this method is invoked out of the event dispatch thread of swing, 
+	 * the dialog is presented in the thread of swing and the calling thread
+	 * wait to close to continue.
+	 * 
+	 * @param message
+	 * @param title
+	 * @param optionType
+	 * @param messageType
+	 * @return
+	 * 
+	 * @see javax.swing.JOptionPane#showConfirmDialog(Component, Object, String, int, int)
+	 * 
+	 */
+	public int confirmDialog(String message, String title, int optionType, int messageType) ;
+
+	/**
+	 * Show a JOptionPane input dialog.
+	 * 
+	 * if this method is invoked out of the event dispatch thread of swing, 
+	 * the dialog is presented in the thread of swing and the calling thread
+	 * wait to close to continue.
+	 * 
+	 * @param message
+	 * @param title
+	 * @param optionType 
+         *           an integer designating the options available on the dialog: 
+         *           YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION
+	 * @param messageType
+         *           an integer designating the kind of message this is; 
+         *           primarily used to determine the icon from the pluggable 
+         *           Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, 
+         *           WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
+	 * @return
+	 * 
+	 * @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
+	 * 
+	 */
+	public String inputDialog(String message, String title, int messageType, String initialValue) ;
+	
+	/**
+	 * Show a JOptionPane input dialog.
+	 * 
+	 * if this method is invoked out of the event dispatch thread of swing, 
+	 * the dialog is presented in the thread of swing and the calling thread
+	 * wait to close to continue.
+	 * 
+	 * @param message
+	 * @param title
+	 * @param optionType
+	 * @param messageType
+	 * @return
+	 * 
+	 * @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int)
+	 * 
+	 */
+	public String inputDialog(String message, String title);
+		
+	/**
+	 * Creates an return a new instance of the component specified 
+	 * 
+	 * This method ensure that the component is created in the event dispatch thread of swing. 
+	 * 
+	 * @param theClass of component to be created
+	 * @param parameters passed to the constructor of the component
+	 * 
+	 * @return the instance of the component created
+	 */
+	public Component createComponent(final Class<? extends Component> theClass,  final Object ... parameters);
+
+	/**
+	 * Creates an return a new instance of the component specified 
+	 * 
+	 * This method ensure that the component is created in the event dispatch thread of swing. 
+	 * 
+	 * @param theClass of component to be created
+	 * @param parameters passed to the constructor of the component
+	 * 
+	 * @return the instance of the component created
+	 */
+	public Component createComponentWithParams(final Class<? extends Component> theClass,  final Object[] parameters);
+	
+	/**
+	 * Creates and show a JFileChooser dialog.
+	 * 
+	 * This method return an array whit the selected files. If multiselection is
+	 * not allowed, an array with one element is returned. 
+	 * 
+	 * If the user select the cancel button, null is returned.
+	 * 
+	 * if this method is invoked out of the event dispatch thread of swing, 
+	 * the dialog is presented in the thread of swing and the calling thread
+	 * wait to close to continue.
+	 * 
+	 * @param title, title of dialog
+	 * @param type of the dialog, JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOG
+	 * @param selectionMode of the dialog, values are: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES
+	 * @param multiselection, true if multiselection is allowed
+	 * @param inihelpertialPath, to show in the dialog
+	 * @param filter used to filter the files show in the dialog.
+	 * @param fileHidingEnabled, if true hidden files are show
+	 * @return an array whit the files selecteds or null.
+	 */
+	public File[] showChooserDialog(
+			final String title,
+			final int type,
+			final int selectionMode,
+			final boolean multiselection, 
+			final File inihelpertialPath,
+			final FileFilter filter,
+			final boolean fileHidingEnabled
+			) ;
+
+	/**
+	 * Creates and show a JFileChooser dialog for folder selection.
+	 *
+	 * This is an utility method that wrap a showChooserDialog call.
+	 *  
+ 	 * @param title, title of dialog
+	 * @param initialPath, to show in the dialog
+	 * @return an array whit the files selecteds or null.
+	 * 
+	 * @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
+	 */
+	public File[] showOpenDirectoryDialog(String title, File initialPath) ;
+	
+	/**
+	 * Creates and show a JFileChooser dialog for selection a file for open.
+	 *
+	 * This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)}  call.
+	 *  
+ 	 * @param title, title of dialog
+	 * @param initialPath, to show in the dialog
+	 * @return an array whit the files selecteds or null.
+	 * 
+	 * @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
+	 */
+	public File[] showOpenFileDialog(String title, File initialPath) ;
+	
+	/**
+	 * Creates and show a JFileChooser dialog for selection a file for save.
+	 *
+	 * This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)}  call.
+	 *  
+ 	 * @param title, title of dialog
+	 * @param initialPath, to show in the dialog
+	 * @return an array whit the files selecteds or null.
+	 * 
+	 * @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)
+	 */
+	public File[] showSaveFileDialog(String title, File initialPath) ;
+	
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLocator.java	(revision 1235)
@@ -0,0 +1,237 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api;
+
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.swing.api.evaluator.ComponentSwingManager;
+import org.gvsig.tools.swing.api.task.TaskStatusSwingManager;
+import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.gvsig.tools.swing.icontheme.IconThemeManager;
+
+/**
+ * {@link Locator} for the tools swing Library. It returns a reference to the
+ * library's main
+ * utilities.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class ToolsSwingLocator extends BaseLocator {
+
+    private static final String LOCATOR_NAME = "Tools.swing.locator";
+    
+    public static final String USABILITY_SWING_MANAGER_NAME =
+        "Tools.usability.swing.manager";
+
+    public static final String USABILITY_SWING_MANAGER_DESCRIPTION =
+        "Tools Usability Swing Manager";
+
+    private static final String TASKSTATUS_SWING_MANAGER_NAME = "Tools.task.swing.manager";
+
+    private static final String TASKSTATUS_SWING_MANAGER_DESCRIPTION = "Tools Task Swing Manager";
+
+    private static final String WINDOW_MANAGER_NAME = "Tools.swing.windowmanager";
+
+    private static final String WINDOW_MANAGER_DESCRIPTION = "Tools Window Manager";
+
+    private static final String ICONTHEME_MANAGER_NAME = "Tools.swing.iconthememanager";
+
+    private static final String ICONTHEME_MANAGER_DESCRIPTION = "Tools Icon Theme Manager";
+
+    private static final String COMPONENT_SWING_MANAGER_NAME = "Tools.swing.componentmanager";
+
+    private static final String COMPONENT_SWING_MANAGER_DESCRIPTION = "Tools Swing Component Manager";
+
+    private static final String THREADSAFEDIALOGS_MANAGER_NAME = "Tools.swing.threadsafedialogs";
+
+    private static final String THREADSAFEDIALOGS_MANAGER_DESCRIPTION = "Thread safe dialogs Manager";
+    
+    /**
+     * Unique instance.
+     */
+    private static final ToolsSwingLocator instance = new ToolsSwingLocator();
+
+    /**
+     * Return the {@link Singleton} instance.
+     * 
+     * @return the {@link Singleton} instance
+     */
+    public static ToolsSwingLocator getInstance() {
+        return instance;
+    }
+
+    /**
+     * Return the {@link Locator}'s name
+     * 
+     * @return a String with the {@link Locator}'s name
+     */
+    @Override
+    public String getLocatorName() {
+        return LOCATOR_NAME;
+    }
+
+    /**
+     * Gets the instance of the {@link UsabilitySwingManager} registered.
+     * 
+     * @return {@link UsabilitySwingManager}
+     */
+    public static UsabilitySwingManager getUsabilitySwingManager() {
+        return (UsabilitySwingManager) getInstance().get(
+            USABILITY_SWING_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link UsabilitySwingManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link UsabilitySwingManager} interface
+     */
+    public static void registerUsabilitySwingManager(
+        Class<? extends UsabilitySwingManager> clazz) {
+        getInstance().register(USABILITY_SWING_MANAGER_NAME,
+            USABILITY_SWING_MANAGER_DESCRIPTION, clazz);
+    }
+
+    /**
+     * Gets the instance of the {@link TaskStatusSwingManager} registered.
+     * 
+     * @return {@link TaskStatusSwingManager}
+     */
+    public static TaskStatusSwingManager getTaskStatusSwingManager() {
+        return (TaskStatusSwingManager) getInstance().get(
+        		TASKSTATUS_SWING_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link TaskStatusSwingManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link TaskStatusSwingManager} interface
+     */
+    public static void registerTaskStatusSwingManager(
+        Class<? extends TaskStatusSwingManager> clazz) {
+        getInstance().register(TASKSTATUS_SWING_MANAGER_NAME,
+        		TASKSTATUS_SWING_MANAGER_DESCRIPTION, clazz);
+    }
+
+    /**
+     * Gets the instance of the {@link WindowManager} registered.
+     * 
+     * @return {@link WindowManager}
+     */
+    public static WindowManager getWindowManager() {
+        return (WindowManager) getInstance().get(
+        		WINDOW_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link WindowManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link WindowManager} interface
+     */
+    public static void registerWindowManager(
+        Class<? extends WindowManager> clazz) {
+        getInstance().register(WINDOW_MANAGER_NAME,
+        		WINDOW_MANAGER_DESCRIPTION, clazz);
+    }
+
+    /**
+     * Gets the instance of the {@link IconThemeManager} registered.
+     * 
+     * @return {@link IconThemeManager}
+     */
+    public static IconThemeManager getIconThemeManager() {
+        return (IconThemeManager) getInstance().get(
+        		ICONTHEME_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link IconThemeManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link IconThemeManager} interface
+     */
+    public static void registerIconThemeManager(
+        Class<? extends IconThemeManager> clazz) {
+        getInstance().register(ICONTHEME_MANAGER_NAME,
+        		ICONTHEME_MANAGER_DESCRIPTION, clazz);
+    }
+    
+    /**
+     * Gets the instance of the {@link ComponentSwingManager} registered.
+     * 
+     * @return {@link ComponentSwingManager}
+     */
+    public static ComponentSwingManager getComponentSwingManager() {
+        return (ComponentSwingManager) getInstance().get(
+            COMPONENT_SWING_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link ComponentSwingManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link ComponentSwingManager} interface
+     */
+    public static void registerComponentSwingManager(
+        Class<? extends ComponentSwingManager> clazz) {
+        getInstance().register(
+            COMPONENT_SWING_MANAGER_NAME,
+            COMPONENT_SWING_MANAGER_DESCRIPTION, clazz);
+    }
+
+
+    /**
+     * Gets the instance of the {@link ThreadSafeDialogsManager} registered.
+     * 
+     * @return {@link ThreadSafeDialogsManager}
+     */
+    public static ThreadSafeDialogsManager getThreadSafeDialogsManager() {
+        return (ThreadSafeDialogsManager) getInstance().get(
+        		THREADSAFEDIALOGS_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the {@link ThreadSafeDialogsManager}
+     * interface.
+     * 
+     * @param clazz
+     *            implementing the {@link ThreadSafeDialogsManager} interface
+     */
+    public static void registerThreadSafeDialogsManager(
+        Class<? extends ThreadSafeDialogsManager> clazz) {
+        getInstance().register(THREADSAFEDIALOGS_MANAGER_NAME,
+        		THREADSAFEDIALOGS_MANAGER_DESCRIPTION, clazz);
+    }
+
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLibrary.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLibrary.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLibrary.java	(revision 1235)
@@ -0,0 +1,65 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.api;
+
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
+
+/**
+ * Initialization of the Tools swing library.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class ToolsSwingLibrary extends AbstractLibrary {
+	
+	@Override
+	public void doRegistration() {
+		super.doRegistration();
+		registerAsAPI(ToolsSwingLibrary.class);
+        require(ToolsLibrary.class);
+	}
+	
+    @Override
+    protected void doInitialize() throws LibraryException {
+        // Do nothing
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+
+        // Validates if there is any UsabilitySwingManager implementation
+        // registered.
+        UsabilitySwingManager usabilitySwingManager =
+            ToolsSwingLocator.getUsabilitySwingManager();
+
+        if (usabilitySwingManager == null) {
+            throw new ReferenceNotRegisteredException(
+                ToolsSwingLocator.USABILITY_SWING_MANAGER_NAME,
+                ToolsSwingLocator.getInstance());
+        }
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconThemeManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconThemeManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconThemeManager.java	(revision 1235)
@@ -0,0 +1,72 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.icontheme;
+
+import java.util.Iterator;
+
+import org.gvsig.tools.util.FolderSet;
+
+public interface IconThemeManager  {
+	/**
+	 * Gets the default theme
+	 * @return the default theme.
+	 */
+	public IconTheme getDefault();
+
+	/**
+	 * Sets the iconTheme like current theme
+	 * @param iconTheme
+	 */
+	public void setCurrent(IconTheme iconTheme);
+
+	/**
+	 * Gets the current theme
+	 * @return current the current theme
+	 */
+	public IconTheme getCurrent();
+
+	/**
+	 * Returns the theme that has been registered with the name that receives like
+	 * parameter
+	 * @param themeName
+	 * @return the theme that contains like name in its properties the parameter
+	 */
+	public IconTheme get(String themeID);
+
+	public int getCount();
+	
+	public IconTheme get(int index);
+	
+	public boolean contains(IconTheme theme);
+
+	public Iterator<IconTheme> iterator();
+
+	public boolean add(IconTheme theme);
+
+	public boolean remove(IconTheme theme);
+
+	public void clear();
+
+	public FolderSet getRepository();
+}
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconThemeManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconTheme.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconTheme.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconTheme.java	(revision 1235)
@@ -0,0 +1,226 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.icontheme;
+
+import java.awt.Image;
+import java.io.File;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.swing.ImageIcon;
+
+public interface IconTheme  {
+	
+	public static final String NO_ICON_NAME = "-no-icon-";
+
+	interface Icon extends Comparable<Icon> {
+		public String getName();
+		public String getGroup() ;
+		public ImageIcon getImageIcon();
+		public Image getImage();
+		public Object getResource() ;
+		public URL getURL() ;
+		public String getLabel();
+		public String getProviderName();
+	}
+
+	/**
+	 * Load all icons from the IconTheme
+	 */
+	public void load(Object resource) throws IllegalArgumentException;
+	
+
+	public void setDefault(IconTheme def);
+
+	public IconTheme getDefault();
+
+	/**
+	 * Returns <code>true</code> if the icon theme contains a mapping for the
+	 * specified iconName.
+	 *
+	 * @param iconName The key to check if it has been registered in this
+	 * IconTheme
+	 *
+	 * @return <code>true</code> if this IconTheme contains
+	 * <code>iconName</code>, <code>false</code> otherwise.
+	 */
+	public boolean exists(String name);
+
+	/**
+	 * Gets the ImageIcon associated with the provided name, if the name
+	 * is present in the theme. If the icon not exists try to return
+	 * a icon with name "no-icon" or returns <code>null</code> if 
+	 * this not exists.
+	 *
+	 * @param name
+	 * 			The name whose associated icon is to be retrieved
+	 *
+	 * @return
+	 * 			The icon associated with the provided name
+	 */
+	public ImageIcon get(String iconName);
+	
+	/**
+	 * Return the ThemeIcon associated with the name.
+	 *  
+	 * @param name of the icon
+	 * @return the IconTheme requiered
+	 */
+	public Icon getThemeIcon(String name);
+
+	/**
+	 * Gets the theme name of the theme
+	 * @return theme name
+	 */
+	public String getName();
+
+	/**
+	 * Sets the theme name of the theme
+	 *
+	 * @param themeName
+	 */
+	public void setName(String themeName);
+
+	public String getID();
+
+	public void setID(String id);
+
+	/**
+	 * Gets the theme description.
+	 *
+	 * @return The description of this theme.
+	 */
+	public String getDescription();
+
+	/**
+	 * Sets the theme description. It should be a short description
+	 * (around 20-30 words), including the highlights of the theme,
+	 * the author and maybe its email address or a link the the theme's
+	 * homepage.
+	 *
+	 * @param description
+	 */
+	public void setDescription(String description);
+
+	/**
+	 * Return an iterator over the names of the icons in the theme.
+	 * 
+	 * @return iterator of names of icons
+	 */
+	public Iterator<String> iterator();
+
+	/**
+	 * Return an iterator over the ThemIcon in the theme.
+	 *  
+	 * @return iterator of ThemeIcon
+	 */
+	public Iterator<Icon> getThemeIcons();
+
+	
+	/**
+	 * Return the icon used as icon by default when the requested icon 
+	 * not exists.
+	 * 
+	 * @return the default icon to use.
+	 */
+	public ImageIcon getDefaultIcon();
+	
+	/**
+	 * Set the default icon to use when the requestd icon not exists.
+	 * 
+	 * @param icon
+	 */
+	public void setDefaultIcon(ImageIcon icon);
+
+	public void setDefaultIcon(URL resource);
+
+	public void setDefaultIcon(String name);
+
+	/**
+	 * Register a icon in the theme.
+	 * The parameter icon can be null if the resource is specified.
+	 * The parameter resource can be null if the icon is specified. 
+	 * 
+	 * Plugin and group can be null.
+	 *  
+	 * @param provider name of the icon
+	 * @param group name for the icon.
+	 * @param name of icon
+	 * @param icon, can be nulll if the resource is specified. 
+	 * @param resource, resource of the icon, usualy and url to the icon.
+	 * 
+	 * @throws IllegalArgumentException if name is null/empty or icon/resource are null
+	 */
+	public void registerDefault(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException;
+
+	/**
+	 * Register a icon in the theme.
+	 * The parameter icon can be null if the resource is specified.
+	 * The parameter resource can be null if the icon is specified. 
+	 * 
+	 * Plugin and group can be null.
+	 * 
+	 * @param provider name of the icon
+	 * @param group name for the icon.
+	 * @param name of icon
+	 * @param icon, can be nulll if the resource is specified. 
+	 * @param resource, resource of the icon, usualy and url to the icon.
+	 * 
+	 * @throws IllegalArgumentException if name is null/empty or icon/resource are null
+	 */
+	public void register(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException;
+
+	public void export(File folder);
+	
+	/**
+	 * @deprecated use {@link #getDefaultIcon()} 
+	 * @return
+	 */
+	public ImageIcon getNoIcon();
+	
+	/**
+	 * @deprecated use {@link #get(String)} instead
+	 */
+	public ImageIcon get(String iconName, ClassLoader loader);
+
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void registerDefault(String iconName, ImageIcon image);
+
+	/**
+	 * @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void registerDefault(String iconName, Object resource);
+
+	/**
+	 * @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void register(String iconName, ImageIcon image);
+
+	/**
+	 * @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)}
+	 */
+	public void register(String iconName, Object resource);
+}

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconTheme.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 1235)
@@ -0,0 +1 @@
+org.gvsig.tools.swing.api.ToolsSwingLibrary
\ No newline at end of file
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api/pom.xml	(revision 1235)
@@ -0,0 +1,11 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.api</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.api</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing</artifactId>
+        <version>3.0.57</version>
+    </parent>
+</project>
\ No newline at end of file

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.api
___________________________________________________________________
Added: svn:ignore
   + target
.settings
.classpath
.project
bin


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynField.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynField.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynField.java	(revision 1235)
@@ -0,0 +1,324 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * 
+ * This interfaces provides with the logic necessary to create
+ * JDynFieldComponents. First, the initial values are extracted. Second, the
+ * user interface components are created.Third, the initial value is set to the
+ * right component, and last but not least, a fireEventChanged event is raised
+ * to inform all Listeners that the value has changed. Some additional functions
+ * related to DynField attributes are also implemented.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractJDynField {
+
+    private ValueField parent;
+
+    protected final List<ValueChangedListener> listeners;
+
+    private boolean writable;
+
+    private DynField definition;
+
+	private DynFieldValidateException validateException;
+
+	public AbstractJDynField(DynField definition, ValueField parent, boolean writable) {
+        this.parent = parent;
+        this.definition = definition;
+        listeners = new ArrayList<ValueChangedListener>();
+        this.writable = writable;
+    }
+	
+	protected boolean isReadOnly(){
+	    return !writable;
+	}
+	
+
+    public DynField getParentDynField() {
+        return parent.getDynField();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#
+     * addValueChangedListener
+     * (org.gvsig.tools.swing.api.dynobject.ValueChangedListener)
+     */
+    public void addValueChangedListener(ValueChangedListener listener) {
+        // If it was the first item, we need to
+        // initialize Component listeners
+        // add listener to the dynfield set of listeners
+        listeners.add(listener);
+        // set supplementary listeners.
+        this.setJDynFieldComponentListeners();
+    }
+
+
+    public String getValidationMessage(){
+		return this.getValueField().getValidationMessage();
+    }
+    
+    /**
+     * The {@link JDynFieldComponent} can use this function to add any code
+     * necessary
+     * once all swing components have been initialized.
+     */
+    protected abstract void afterUI();
+
+    /**
+     * Then all {@link ValueChangedListener}s are fired to alert them
+     * to check if the value has changed via the {@link getValue()} function of
+     * the {@link JDynFieldComponent}.
+     */
+    public abstract void fireValueChangedEvent();
+
+    /**
+     * Gets the default value of the {@link ValueField} object.
+     * 
+     * @return
+     *         the default value of the {@link ValueField} object.
+     */
+    public Object getDefaultFieldValue() {
+        return this.getValueField().getDefaultFieldValue();
+    }
+
+    /**
+     * Returns the {@link DynField} being rendered.
+     * 
+     * @return the {@link DynField}
+     */
+    public DynField getDynField() {
+        if (definition!=null){
+            return definition;
+        }
+        return getValueField().getDynField();
+    }
+    
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * 
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isMandatory
+     * ()
+     */
+    public boolean isMandatory() {
+        return getDynField().isMandatory();
+    }
+
+
+    /**
+     * Gets the current value of the {@link ValueField} object.
+     * 
+     * @return
+     *         the current value of the {@link ValueField} object.
+     */
+    public Object getFieldValue() {
+        return this.getValueField().getFieldValue();
+    }
+
+    /**
+     * Checks if the {@link ValueField} has an inputed value; if not, then it
+     * asks
+     * for its default value.
+     * 
+     * @return
+     *         the initial value of the {@link ValueField}. It can be
+     *         <b>null</b>.
+     */
+    public Object getInitialValue() {
+        Object value = getFieldValue();
+        if (value == null) {
+            value = getDefaultFieldValue();
+        }
+        return value;
+    }
+
+    /**
+     * Gets the {@link ValueField} object.
+     * 
+     * @return
+     *         the {@link ValueField} object.
+     */
+    private ValueField getValueField() {
+        return this.parent;
+    }
+
+    /**
+     * Inits the JDynFieldComponent logic to create its components and check its
+     * values.
+     */
+    protected void init() {
+        this.initData();
+        this.initUI();
+        if (isReadOnly()) {
+            this.setReadOnly();
+		}
+        this.setValue(getInitialValue());
+        this.afterUI();
+    }
+
+    /**
+     * JDynFieldComponents can use this function to initialize any
+     * data containers before the swing components are created.
+     */
+    protected abstract void initData();
+
+    /**
+     * {@link JDynFieldComponent}s can use this function to initialized any
+     * swing components to be used afterwards, and specify their
+     * default settings.
+     */
+    protected abstract void initUI();
+
+    /**
+     * Sets the current value of the {@link JDynFieldComponent} to the
+     * {@link DynObject} value via the {@link ValueField} object.
+     * 
+     */
+    public void setFieldValue(Object value) {
+        this.getValueField().setFieldValue(value);
+    }
+
+    protected abstract void setJDynFieldComponentListeners();
+
+    /**
+     * The {@link JDynFieldComponent} can use this function to set a <b>non
+     * null</b> value
+     * into the correspondent swing component.
+     * 
+     * @param value
+     *            the value to be set into the swing component.
+     */
+    protected abstract void setNonNullValue(Object value);
+
+    /**
+     * The {@link JDynFieldComponent} can use this function to set a <b>null</b>
+     * value
+     * into the correspondent swing component.
+     * 
+     * @param value
+     *            the value to be set into the swing component.
+     */
+    protected abstract void setNullValue();
+
+    /**
+     * The {@link JDynFieldComponent} can implement this function to set the
+     * swing
+     * components that represent this {@link DynField} to readOnly mode.
+     */
+    protected abstract void setReadOnly();
+
+	/**
+	 * Sets the value to the {@link JDynFieldComponent}. With this logic, it
+	 * checks first if it is a null value or not. Then all
+	 * {@link ValueChangedListener}s are fired to alert them to check if the
+	 * value has changed via the {@link getValue()} function.
+	 * 
+	 * @param newValue
+	 *            the value to be set into the swing component.
+	 */
+    public void setValue(Object newValue) {
+		// oldValue and newValue is null.
+		if ((this.getValue() == null) && (newValue == null)) {
+			return;
+		}
+		// If there's an oldValue not null and is equal to newValue, do
+		// Nothing.
+		if ((this.getValue() != null) && (this.getValue().equals(newValue))) {
+			return;
+		}
+		if (newValue == null) {
+            setNullValue();
+        } else {
+			setNonNullValue(newValue);
+        }
+        this.fireValueChangedEvent();
+    }
+
+	/**
+	 * @param value
+	 */
+	protected boolean validate(Object value) {
+		try {
+			this.getDynField().validate(value);
+			validateException = null;
+			return true;
+		} catch (DynFieldValidateException e) {
+			validateException = e;
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the current validation exception, if any
+	 * 
+	 * @return
+	 */
+	protected DynFieldValidateException getValidateException() {
+		if (validateException == null) {
+			validate(this.getValue());
+		}
+		return validateException;
+	}
+
+	/**
+	 * Gets the current value of the component
+	 * 
+	 * @return
+	 */
+	public abstract Object getValue();
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectFactory.java	(revision 1235)
@@ -0,0 +1,106 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponentFactory;
+
+/**
+ * 
+ * Swing Factory of the {@link JDynObjectComponent} object.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractDynObjectFactory extends
+    AbstractSwingServiceFactory implements JDynObjectComponentFactory {
+
+    @Override
+    protected DynClass createParametersDynClass() {
+
+        DynClass dynClassParams = this.getDynClassParams();
+        dynClassParams.addDynField(JDynObjectComponent.PARAMETERS.DYNOBJECT)
+            .setType(DataTypes.DYNOBJECT).setMandatory(true);
+        dynClassParams
+            .addDynFieldObject(JDynObjectComponent.PARAMETERS.DYNSTRUCT)
+            .setClassOfValue(DynStruct.class).setMandatory(true);
+        dynClassParams
+            .addDynFieldObject(JDynObjectComponent.PARAMETERS.DYNMODEL)
+            .setClassOfValue(DynObjectModel.class).setMandatory(true);
+        dynClassParams
+            .addDynFieldBoolean(JDynObjectComponent.PARAMETERS.WRITABLE)
+            .setMandatory(false).setDefaultFieldValue(Boolean.FALSE);
+
+        return dynClassParams;
+    }
+
+    @Override
+    protected Service doCreate(DynObject parameters,
+        ServiceManager serviceManager) throws ServiceException {
+
+        DynObjectModel dynModel =
+            (DynObjectModel) parameters
+                .getDynValue(JDynObjectComponent.PARAMETERS.DYNMODEL);
+        DynStruct definition =
+            (DynStruct) parameters
+                .getDynValue(JDynObjectComponent.PARAMETERS.DYNSTRUCT);
+        DynObject currentDynObjectValue =
+            (DynObject) parameters
+                .getDynValue(JDynObjectComponent.PARAMETERS.DYNOBJECT);
+        Boolean writable =
+            (Boolean) parameters
+                .getDynValue(JDynObjectComponent.PARAMETERS.WRITABLE);
+        writable = writable == null ? Boolean.FALSE : writable;
+
+        return this.createJDynObjectComponent(definition,
+            currentDynObjectValue, dynModel, writable.booleanValue());
+    }
+
+    public void initialize() {
+        // Nothing to do
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/ToolsSwingServiceLocator.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/ToolsSwingServiceLocator.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/ToolsSwingServiceLocator.java	(revision 1235)
@@ -0,0 +1,92 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.spi;
+
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
+
+/**
+ * Locator for the tools swing Library. Returns references to the library's main
+ * utilities.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class ToolsSwingServiceLocator extends BaseLocator {
+
+    private static final String LOCATOR_NAME = "Tools.swing.service.locator";
+
+    public static final String DYNOBJECT_SWING_SERVICE_MANAGER_NAME =
+        "Tools.swing.service.manager";
+
+    public static final String DYNOBJECT_SWING_SERVICE_MANAGER_DESCRIPTION =
+        "Tools DynObject Swing Service Manager";
+
+    /**
+     * Unique instance.
+     */
+    private static final ToolsSwingServiceLocator instance =
+        new ToolsSwingServiceLocator();
+
+    /**
+     * Return the singleton instance.
+     * 
+     * @return the singleton instance
+     */
+    public static ToolsSwingServiceLocator getInstance() {
+        return instance;
+    }
+
+    /**
+     * Gets the instance of the {@link DynObjectSwingManager} registered.
+     * 
+     * @return {@link DynObjectSwingManager}
+     */
+    public static DynObjectSwingServiceManager getServiceManager() {
+        return (DynObjectSwingServiceManager) getInstance().get(
+            DYNOBJECT_SWING_SERVICE_MANAGER_NAME);
+    }
+
+    /**
+     * Registers the Class implementing the DynObjectSwingManager interface.
+     * 
+     * @param clazz
+     *            implementing the DynObjectSwingManager interface
+     */
+    public static void registerDynObjectServiceManager(
+        Class<? extends ServiceManager> clazz) {
+        getInstance().register(DYNOBJECT_SWING_SERVICE_MANAGER_NAME,
+            DYNOBJECT_SWING_SERVICE_MANAGER_DESCRIPTION, clazz);
+    }
+
+    /**
+     * Return the Locator's name
+     * 
+     * @return a String with the Locator's name
+     */
+    @Override
+    public String getLocatorName() {
+        return LOCATOR_NAME;
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponent.java	(revision 1235)
@@ -0,0 +1,208 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.tools.swing.spi;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * Component which is able to render a {@link DynObject} attribute value.
+ * 
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public abstract class AbstractJDynFieldComponent extends AbstractJDynField
+    implements JDynFieldComponent {
+
+    private static final long serialVersionUID = 7833217085675382320L;
+
+    private final DynObjectSwingManager manager;
+
+    private final List<ValueChangedListener> listeners;
+
+    /**
+     * Constructor.
+     * @param writable 
+     * @param definition 
+     * 
+     * @param dynField
+     *            the field of the {@link DynObject} to render
+     * @param dynObject
+     *            the {@link DynObject} with the attribute to render
+     */
+	public AbstractJDynFieldComponent(DynField definition, ValueField parent, boolean writable)
+        throws ServiceException {
+		super(definition, parent, writable);
+        listeners = new ArrayList<ValueChangedListener>();
+        // this.dynObject = dynObject.getDynObject();
+        manager = ToolsSwingLocator.getDynObjectSwingManager();
+
+        this.init();
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#
+     * addValueChangedListener
+     * (org.gvsig.tools.swing.api.dynobject.ValueChangedListener)
+     */
+    @Override
+    public void addValueChangedListener(ValueChangedListener listener) {
+        // If it was the first item, we need to
+        // initialize Component listeners
+        // add listener to the dynfield set of listeners
+        listeners.add(listener);
+        // set supplementary listeners.
+        this.setJDynFieldComponentListeners();
+    }
+
+    protected JPanel createBoxLayout(Component component1,
+        Component component2, Integer marginLeft, Integer marginRight,
+        JPanel container) {
+        return this.createBoxRowPanel(container, component1, component2,
+            marginLeft, marginRight);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * 
+     * 
+     * 
+     * org.gvsig.tools.swing.api.usability.UsabilitySwingManager#createBoxRowPanel
+     * (javax.swing.JPanel, java.awt.Component, java.awt.Component,
+     * java.lang.Integer, java.lang.Integer)
+     */
+    public JPanel createBoxRowPanel(JPanel panel, Component labelComponent,
+        Component fieldLabel, Integer marginLeft, Integer marginRight) {
+
+        // Create a panel that uses GridLayout.
+        JPanel pane = new JPanel();
+        pane.setLayout(new BoxLayout(pane, BoxLayout.LINE_AXIS));
+        pane.add(labelComponent);
+        if (marginLeft != null) {
+            pane.add(Box.createHorizontalStrut(marginLeft));
+        }
+
+        if (marginRight != null) {
+            pane.add(Box.createHorizontalStrut(marginRight));
+        }
+        pane.add(fieldLabel, BorderLayout.NORTH);
+        pane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+        return pane;
+    }
+
+    protected JButton createButton(String text) {
+        return ToolsSwingLocator.getUsabilitySwingManager().createJToolButton(
+            this.translate(text));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#
+     * raiseValueChangedEvent()
+     */
+    @Override
+    public void fireValueChangedEvent() {
+        for (ValueChangedListener listener : listeners) {
+            listener.handleValueChanged(this);
+        }
+    }
+
+    public Object getDefaultValue() {
+        return this.getDynField().getDefaultValue();
+    }
+
+    protected String getFieldName() {
+        return this.getDynField().getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.service.Service#getManager()
+     */
+    public Manager getManager() {
+        return manager;
+    }
+
+    /**
+     * @return
+     */
+    public abstract Object getValue();
+
+    public boolean isMandatory() {
+        return this.getDynField().isMandatory();
+    }
+
+  
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isValid()
+     */
+    public boolean isValid() {
+        return this.validate(this.getValue());
+    }
+
+    /**
+     * Stores the edited data into the DynObject field.
+     */
+    public void saveStatus() {
+        this.setFieldValue(this.getValue());
+    }
+
+    /**
+	 * 
+	 */
+    @Override
+    protected abstract void setJDynFieldComponentListeners();
+
+    protected String translate(String text) {
+        return ToolsLocator.getI18nManager().getTranslation(text);
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractSwingServiceFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractSwingServiceFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractSwingServiceFactory.java	(revision 1235)
@@ -0,0 +1,126 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.service.spi.AbstractServiceFactory;
+
+/**
+ * 
+ * The Factory asociated to the swing Tools Service.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractSwingServiceFactory extends
+    AbstractServiceFactory {
+
+    private DynClass dynClassParams;
+    private DynObjectSwingServiceManager manager;
+
+    /**
+     * 
+     * Creates and returns a {@link DynClass} object based on its parameters.
+     * 
+     * @return
+     *         the created {@link DynClass}.
+     */
+    protected DynClass getDynClassParams() {
+
+        if (dynClassParams == null) {
+            dynClassParams =
+                ToolsLocator.getDynObjectManager().createDynClass(
+                    this.getFactoryName(), this.getFactoryDescription());
+        }
+        return dynClassParams;
+    }
+
+    /**
+     * 
+     * Returns a brief description of this Factory.
+     * 
+     * @return
+     *         the decription String.
+     */
+
+    public abstract String getFactoryDescription();
+
+    /**
+     * 
+     * Returns the factory name.
+     * 
+     * @return
+     *         the factory name String.
+     */
+    public abstract String getFactoryName();
+
+    /**
+     * 
+     * Returns the factory subType.
+     * 
+     * @return
+     *         the factory subType String.
+     */
+    public abstract String getFactorySubType();
+
+    /**
+     * 
+     * Returns the factory type
+     * 
+     * @return
+     *         the factory type value. It can be null.
+     */
+    public abstract Integer getFactoryType();
+
+    /**
+     * Returns the current Tools swing service manager.
+     * 
+     * @return
+     *         the {@link DynObjectSwingServiceManager}.
+     */
+    protected DynObjectSwingServiceManager getServiceManager() {
+        if (manager == null) {
+            manager = ToolsSwingServiceLocator.getServiceManager();
+        }
+        return manager;
+
+    }
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/DynObjectSwingServiceManager.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/DynObjectSwingServiceManager.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/DynObjectSwingServiceManager.java	(revision 1235)
@@ -0,0 +1,93 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * 
+ * Swing Manager Service for {@link JDynObjectComponent}s to get its
+ * correspondent {@link JDynFieldComponent}s.
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public interface DynObjectSwingServiceManager extends ServiceManager {
+
+    public static final String DEFAULT_FACTORY_SUBTYPE = "default";
+
+	/**
+	 * 
+	 * Returns a {@link JDynFieldComponent} that best matches with the given
+	 * {@link ValueField} and type.
+	 * 
+	 * @param parent
+	 *            the {@link ValueField} element.
+	 * @param type
+	 *            the current type.
+	 * @param writable
+	 * 
+	 * @return the {@link JDynFieldComponent}.
+	 * 
+	 * @throws ServiceException
+	 */
+    public JDynFieldComponent getJDynFieldComponent(ValueField parent,
+			boolean type, boolean writable) throws ServiceException;
+
+    /**
+     * 
+     * Returns a {@link JDynFieldComponent}in the form of a JComboBox.
+     * 
+     * @param component
+     *            the single component.
+     * @param field
+     *            the ValueField element.
+     * 
+     * @return
+     *         the {@link JDynFieldComponent}.
+     */
+    public JDynFieldComponent getJSingleComboBoxDynFieldComponent(
+        JDynFieldComponent component, ValueField field);
+
+    public String getServiceName(int type, String subType);
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractJDynFieldComponentFactory.java	(revision 1235)
@@ -0,0 +1,177 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceManager;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * Extends {@link AbstractSwingServiceFactory} and provides with
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractJDynFieldComponentFactory extends
+    AbstractSwingServiceFactory implements JDynFieldComponentFactory {
+
+    @Override
+    protected DynClass createParametersDynClass() {
+
+		DynClass dynClassParams = this.getDynClassParams();
+
+		dynClassParams.addDynFieldObject(JDynFieldComponent.PARAMETERS.PARENT)
+				.setClassOfValue(ValueField.class).setMandatory(true);
+		dynClassParams
+				.addDynFieldObject(JDynFieldComponent.PARAMETERS.DYNFIELD)
+				.setClassOfValue(DynField.class).setMandatory(true);
+		dynClassParams.addDynFieldBoolean(
+				JDynFieldComponent.PARAMETERS.WRITABLE).setMandatory(false);
+		
+		return dynClassParams;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.service.spi.AbstractServiceFactory#doCreate(org.gvsig
+     * .tools.dynobject.DynObject, org.gvsig.tools.service.spi.ServiceManager)
+     */
+    @Override
+    protected Service doCreate(DynObject parameters,
+        ServiceManager serviceManager) {
+
+        DynField child =
+            (DynField) parameters
+                .getDynValue(JDynFieldComponent.PARAMETERS.DYNFIELD);
+        ValueField valueField =
+            (ValueField) parameters
+                .getDynValue(JDynFieldComponent.PARAMETERS.PARENT);
+
+		Boolean writable = (Boolean) parameters
+				.getDynValue(JDynObjectComponent.PARAMETERS.WRITABLE);
+		writable = ( writable == null ? Boolean.TRUE : writable );
+
+        try {
+			JDynFieldComponent comp = this.createJDynFieldComponent(child, valueField,
+					writable.booleanValue());
+
+            return this.getSuitableComponent(comp, valueField);
+
+        } catch (ServiceException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryName()
+     */
+    @Override
+    public String getFactoryName() {
+        return this.getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryName()
+     */
+    @Override
+    public String getName() {
+        return this.getServiceManager().getServiceName(this.getFactoryType(),
+            this.getFactorySubType());
+    }
+
+    /**
+     * Checks if it's a container and has available values to render a JComboBox
+     * object
+     * instead of the otherwise created JComponent.
+     * 
+     * @param component
+     *            the JDynFieldComponent created beforehand.
+     * @param field
+     *            the ValueField object.
+     * @return
+     *         the JDynFieldComponent.
+     */
+
+    private JDynFieldComponent getSuitableComponent(
+        JDynFieldComponent component, ValueField field) {
+
+		// Checking containers
+		DynField dynField = field.getDynField();
+		if ((dynField.getType() == DataTypes.DYNOBJECT)
+				|| (dynField.getType() == DataTypes.LIST)) {
+			return component;
+		}
+
+		// If a simple component has available values it is a combobox
+		DynObjectValueItem[] values = dynField.getAvailableValues();
+		if ((values != null) && (values.length > 0)) {
+            return this.getServiceManager()
+                .getJSingleComboBoxDynFieldComponent(component, field);
+        }
+        return component;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.tools.service.spi.ServiceFactory#initialize()
+     */
+    public void initialize() {
+        // do nothing
+    }
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectComponent.java
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectComponent.java	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectComponent.java	(revision 1235)
@@ -0,0 +1,387 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2013 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.spi;
+
+import java.awt.Component;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.dynobject.exception.DynObjectFieldSubtypeRequiredValueException;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * 
+ * @author 2010 - <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG Team
+ * @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart�n&nbsp;</a> -
+ *         gvSIG Team
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractDynObjectComponent implements
+		JDynObjectComponent, ValueField {
+
+	private static final long serialVersionUID = 4088620749911859250L;
+
+	private DynObject dynObject;
+
+	private DynObjectModel model;
+
+	private DynObjectSwingManager swingManager;
+
+	private DynObjectManager manager;
+
+	private Map<DynObject, Components> components;
+
+	private DynStruct dynField;
+
+	private DynObject oldDynObject;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param dynObject
+	 *            the {@link DynObject} to render
+	 * @param writable
+	 */
+	public AbstractDynObjectComponent() {
+		this.swingManager = ToolsSwingLocator.getDynObjectSwingManager();
+		this.manager = ToolsLocator.getDynObjectManager();
+	}
+
+	protected void setDynObject(DynObject dynObject) {
+		this.oldDynObject = dynObject;
+		this.dynObject = dynObject;
+		if (this.dynObject == null) {
+			this.dynObject = manager.createDynObject(this.getDefinition());
+		}
+		if (this.dynObject != null) {
+			this.dynField = dynObject.getDynClass();
+		}
+		try {
+			checkFields();
+		} catch (DynObjectFieldSubtypeRequiredValueException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	private void checkFields()
+			throws DynObjectFieldSubtypeRequiredValueException {
+		for (DynField field : dynField.getDynFields()) {
+			if (field.getType() == DataTypes.DYNOBJECT) {
+				String dynObjectID = field.getSubtype();
+				// If subtype is null, the definition of the DynObject has not
+				// been correctly implemented
+				if (dynObjectID == null) {
+					throw new DynObjectFieldSubtypeRequiredValueException(
+							this.getDefinition(),
+							field,
+							"Definition "
+									+ field.getName()
+									+ " is not well defined. Subtype should contain its dynObjectID");
+				}
+				if (this.dynObject.getDynValue(field.getName()) == null) {
+					this.dynObject.setDynValue(field.getName(),
+							manager.createDynObject(manager.get(dynObjectID)));
+				}
+			}
+		}
+	}
+
+	protected boolean hasDynObject() {
+		return (this.dynObject != null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.tools.swing.impl.dynobject.JDynbjectComponent#getDynObject()
+	 */
+	public DynObject getDynObject() {
+		return dynObject;
+	}
+
+	public void setModel(DynObjectModel model) {
+		this.model = model;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.tools.swing.impl.dynobject.JDynbjectComponent#getModel()
+	 */
+	public DynObjectModel getModel() {
+		if (this.model == null) {
+			createModel();
+		}
+		return this.model;
+	}
+
+	protected void setDynField(DynStruct definition) {
+		this.dynField = definition;
+	}
+
+	protected DynStruct getDefinition() {
+		if (this.dynField != null) {
+			return this.dynField;
+		}
+		if (hasDynObject()) {
+			return this.getDynObject().getDynClass();
+		}
+		return null;
+	}
+
+	private void createModel() {
+		try {
+			this.model = this.swingManager
+					.createDynObjectModel(getDefinition());
+		} catch (ServiceException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public class Components extends HashMap<Component, JDynFieldComponent> {
+
+		private Map<Component, JDynFieldComponent> componentField;
+
+		/**
+		 * Gets the map of all graphic JDynFieldComponents of this
+		 * JDynObjectComponent.
+		 * 
+		 * @return the map containing the graphic Components.
+		 */
+		private Map<Component, JDynFieldComponent> getComponents() {
+			if ((!hasDynObject()) || (componentField == null)) {
+				componentField = new HashMap<Component, JDynFieldComponent>();
+			}
+			return componentField;
+		}
+
+		/**
+		 * 
+		 * Sets all FieldValues of this {@link JDynObjectComponent} to null.
+		 * 
+		 */
+		public void emptyAll() {
+			Map<Component, JDynFieldComponent> items = this.getComponents();
+			for (JDynFieldComponent item : items.values())
+				item.setValue(null);
+		}
+
+		/**
+		 * Adds a new JDynFieldComponent to the list.
+		 * 
+		 * @param component
+		 *            the java awt Component
+		 * @param input
+		 *            the correspondent JDynFieldComponent object
+		 */
+		public void addComponentToList(Component component,
+				JDynFieldComponent input) {
+			this.getComponents().put(component, input);
+		}
+
+		public Iterator<JDynFieldComponent> iterator() {
+			return this.getComponents().values().iterator();
+		}
+
+		public void loadComponents(DynObject dynObject) {
+			if (dynObject != null) {
+				for (JDynFieldComponent item : getComponents().values())
+					item.setValue(dynObject.getDynValue(item.getDynField()
+							.getName()));
+			} else {
+				for (JDynFieldComponent item : getComponents().values())
+					item.setValue(null);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return this.getDynObject();
+	}
+
+	/**
+	 * 
+	 * Returns a {@link JDynFieldComponent} that best matches with the given
+	 * {@link ValueField} and adds, if any, the given listener to the
+	 * JDynFieldComponent listeneres.
+	 * 
+	 * @param valueItem
+	 *            the {@link ValueField} element.
+	 * @param listener
+	 *            the current {@link ValueChangedListener} to be added to the
+	 *            JDynFieldComponent listeners.
+	 * @return the {@link JDynFieldComponent}.
+	 * 
+	 * @throws ServiceException
+	 */
+	protected JDynFieldComponent getJDynFieldComponent(ValueField valueItem,
+			ValueChangedListener listener) throws ServiceException {
+		JDynFieldComponent jfield = ((DynObjectSwingManager) this.getManager())
+				.createJDynFieldComponent(valueItem);
+		if (listener != null) {
+			jfield.addValueChangedListener(listener);
+			jfield.fireValueChangedEvent();
+		}
+		return jfield;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.tools.service.Service#getManager()
+	 */
+	public Manager getManager() {
+		return swingManager;
+	}
+
+	/**
+	 * Sets all FieldValues of this {@link JDynObjectComponent} to its the
+	 * current values of the same FieldValues at the {@link DynObject} given as
+	 * input.
+	 * 
+	 * @param value
+	 */
+	protected void fillValues(DynObject dynObject) {
+		this.setDynObject(dynObject);
+		if (this.getDynObject() != null) {
+			try {
+				this.load(dynObject);
+			} catch (ServiceException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		this.getSelectedComponents().loadComponents(dynObject);
+	}
+
+	public boolean isValid() {
+		if (!this.getDynField().isMandatory()) {
+			return true;
+		}
+
+		Map<Component, JDynFieldComponent> items = this.getSelectedComponents();
+		for (JDynFieldComponent item : items.values()) {
+			if (!item.isValid()) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public void load(DynObject dynObject) throws ServiceException {
+		setDynObject(dynObject);
+		// added to handle labels correctly
+		addParametersFromModel();
+	}
+
+	protected abstract void addParametersFromModel() throws ServiceException;
+
+	/**
+	 * Walks through all JDynFieldComponents to save its current values into
+	 * their DynObject.
+	 */
+	public void saveStatus() {
+		Iterator<JDynFieldComponent> componentFields = this
+				.getSelectedComponents().iterator();
+		JDynFieldComponent comp;
+		while (componentFields.hasNext()) {
+			comp = componentFields.next();
+			comp.saveStatus();
+		}
+	}
+
+	protected Components getSelectedComponents() {
+		return this.getComponents(this.getDynObject());
+	}
+
+	private Components getComponents(DynObject dynObject) {
+		if ((this.components == null) || (dynObject == null)) {
+			this.components = new HashMap<DynObject, Components>();
+		}
+
+		Components listComponents = this.components.get(dynObject);
+		if (listComponents == null) {
+			listComponents = new Components();
+			this.components.put(dynObject, listComponents);
+		}
+		return listComponents;
+	}
+
+	public void addValueChangedListener(ValueChangedListener listener) {
+		Iterator<JDynFieldComponent> componentFields = this
+				.getSelectedComponents().iterator();
+		JDynFieldComponent comp;
+		while (componentFields.hasNext()) {
+			comp = componentFields.next();
+			comp.addValueChangedListener(listener);
+		}
+	}
+
+	public String getValidationMessage() {
+		try {
+			this.getDynField().validate(this.getValue());
+			return "";
+		} catch (DynFieldValidateException e) {
+			return e.getLocalizedMessageStack();
+		}
+	}
+
+}
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/pom.xml	(revision 1235)
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.gvsig.tools.swing.spi</artifactId>
+    <packaging>jar</packaging>
+    <name>org.gvsig.tools.swing.spi</name>
+    <parent>
+        <groupId>org.gvsig</groupId>
+        <artifactId>org.gvsig.tools.swing</artifactId>
+        <version>3.0.34-SNAPSHOT</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.api</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing/org.gvsig.tools.swing.spi
___________________________________________________________________
Added: svn:ignore
   + .settings
bin
target
.classpath
.project



Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/org.gvsig.tools.swing
___________________________________________________________________
Added: svn:ignore
   + target
.settings
.project
.pom.xml.swp


Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/pom.xml
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/pom.xml	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/pom.xml	(revision 1235)
@@ -0,0 +1,577 @@
+<?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>
+    <groupId>org.gvsig</groupId>    
+    <artifactId>org.gvsig.tools</artifactId>
+    <packaging>pom</packaging>
+    <version>3.0.57</version>
+    <name>org.gvsig.tools</name>
+    <description>Tools related to application framework architecture 
+	and implementations of design patterns</description>
+
+
+    <licenses>
+        <license>
+            <name>GPLv3</name>
+            <url>http://www.gnu.org/licenses/gpl.html</url>
+            <distribution>repo</distribution>
+            <comments>
+			"GPL" stands for "General Public License". The most widespread such
+			license is the GNU General Public License, or GNU GPL for short.
+			This can be further shortened to "GPL", when it is understood that
+			the GNU GPL is the one intended.
+	      	</comments>
+        </license>
+    </licenses>
+    
+    <organization>
+        <name>gvSIG Association</name>
+        <url>http://www.gvsig.com/</url>
+    </organization>
+    
+    <scm>
+        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-tools/org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57</connection>
+        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-tools/org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57</developerConnection>
+        <url>https://devel.gvsig.org/redmine/projects/gvsig-tools/repository/show/org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57</url>
+    </scm>
+
+    <repositories>
+      <repository>
+        <id>gvsig-public-http-repository</id>
+        <name>gvSIG maven public HTTP repository</name>
+        <url>http://devel.gvsig.org/m2repo/j2se</url>
+        <releases>
+          <enabled>true</enabled>
+          <updatePolicy>daily</updatePolicy>
+          <checksumPolicy>warn</checksumPolicy>
+        </releases>
+        <snapshots>
+          <enabled>true</enabled>
+          <updatePolicy>daily</updatePolicy>
+          <checksumPolicy>warn</checksumPolicy>
+        </snapshots>
+      </repository>
+    </repositories>
+    
+    <distributionManagement>
+      <site>
+        <id>gvsig-repository</id>
+        <url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url>
+      </site>
+      <repository>
+          <id>gvsig-repository</id>
+          <name>gvSIG maven repository</name>
+          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
+          <uniqueVersion>false</uniqueVersion>
+      </repository>
+      <snapshotRepository>
+          <id>gvsig-repository</id>
+          <name>gvSIG maven repository</name>
+          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
+          <uniqueVersion>false</uniqueVersion>
+      </snapshotRepository>
+    </distributionManagement>
+    
+    <issueManagement>
+      <system>redmine</system>
+      <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop</url>
+    </issueManagement>
+
+    <mailingLists>
+      <mailingList>
+        <name>User List</name>
+        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</subscribe>
+        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</unsubscribe>
+        <post>gvsig_usuarios@listserv.gva.es</post>
+        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
+        <otherArchives>
+          <otherArchive>http://www.mail-archive.com/gvsig_usuarios@runas.cap.gva.es</otherArchive>
+          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
+        </otherArchives>
+      </mailingList>
+      <mailingList>
+        <name>Developer List</name>
+        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</subscribe>
+        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</unsubscribe>
+        <post>gvsig_desarrolladores@listserv.gva.es</post>
+        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
+        <otherArchives>
+          <otherArchive>http://www.mail-archive.com/gvsig_desarrolladores@runas.cap.gva.es</otherArchive>
+          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
+        </otherArchives>
+      </mailingList>
+      <mailingList>
+        <name>International List</name>
+        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</subscribe>
+        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</unsubscribe>
+        <post>gvsig_internacional@listserv.gva.es</post>
+        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
+        <otherArchives>
+          <otherArchive>http://www.mail-archive.com/gvsig_internacional@runas.cap.gva.es</otherArchive>
+          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
+        </otherArchives>
+      </mailingList>
+    </mailingLists>
+    
+    <developers>
+        <developer>
+            <id>jjdelcerro</id>
+            <name>Joaquín José del Cerro</name>
+            <email>jjdelcerro@gvsig.org</email>
+            <roles>
+                <role>Architect</role>
+                <role>Developer</role>
+            </roles>
+        </developer>
+        <developer>
+            <id>jmvivo</id>
+            <name>José Manuel Vivó</name>
+            <email>jmvivo@disid.com</email>
+            <roles>
+                <role>Developer</role>
+            </roles>
+        </developer>
+        <developer>
+            <id>cordinyana</id>
+            <name>César Ordiñana</name>
+            <email>cordin@gvsig.org</email>
+            <roles>
+                <role>Architect</role>
+                <role>Developer</role>
+            </roles>
+        </developer>
+    </developers>
+
+    <dependencyManagement>
+      <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+		<dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.5.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.5.5</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.14</version>
+        </dependency>
+		<dependency>
+          <groupId>easymock</groupId>
+          <artifactId>easymock</artifactId>
+          <version>1.2_Java1.3</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+           <groupId>net.sf.kxml</groupId>
+           <artifactId>kxml2</artifactId>
+	       <version>2.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.1</version>    
+        </dependency>
+        <dependency>
+            <groupId>net.sf</groupId>
+            <artifactId>flib-jcalendar</artifactId>
+            <version>unknown</version>
+        </dependency>
+        <dependency>
+	        <groupId>com.jgoodies</groupId>
+	        <artifactId>jgoodies-common</artifactId>
+	        <version>1.4.0</version>
+        </dependency>
+        <dependency>
+	        <groupId>com.jgoodies</groupId>
+	        <artifactId>jgoodies-forms</artifactId>
+	        <version>1.6.0</version>
+        </dependency>
+        <dependency>
+	        <groupId>com.jgoodies</groupId>
+	        <artifactId>looks</artifactId>
+	        <version>2.2.2</version>
+        </dependency>
+                
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.lib</artifactId>
+            <version>3.0.57</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing</artifactId>
+            <version>3.0.57</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.api</artifactId>
+            <version>3.0.57</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.impl</artifactId>
+            <version>3.0.57</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.spi</artifactId>
+            <version>3.0.34-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.serv</artifactId>
+            <version>3.0.34-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.serv.field</artifactId>
+            <version>3.0.34-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.serv.jform</artifactId>
+            <version>3.0.34-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.tools.swing.serv.jlist</artifactId>
+            <version>3.0.34-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+          <groupId>org.gvsig</groupId>
+          <artifactId>org.gvsig.tools.dynform.api</artifactId>
+          <version>3.0.57</version>
+        </dependency>
+        <dependency>
+          <groupId>org.gvsig</groupId>
+          <artifactId>org.gvsig.tools.dynform.spi</artifactId>
+          <version>3.0.57</version>
+        </dependency>
+        <dependency>
+          <groupId>org.gvsig</groupId>
+          <artifactId>org.gvsig.tools.dynform.services</artifactId>
+          <version>3.0.57</version>
+        </dependency>
+        
+      </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+       <extensions>
+           <extension>
+               <groupId>org.apache.maven.wagon</groupId>
+               <artifactId>wagon-webdav-jackrabbit</artifactId>
+               <version>2.4</version>
+           </extension>
+       </extensions>
+        
+      <pluginManagement>
+        <plugins>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-deploy-plugin</artifactId>
+              <version>2.6</version>
+          </plugin>        
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <version>2.7.1</version>
+              <configuration>
+                  <forkMode>once</forkMode>
+              </configuration>
+          </plugin>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <version>2.3.2</version>
+              <configuration>
+                  <source>1.5</source>
+                  <target>1.5</target>
+                  <encoding>ISO-8859-1</encoding>
+              </configuration>
+          </plugin>
+
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-resources-plugin</artifactId>
+              <version>2.4.3</version>
+              <configuration>
+                  <encoding>ISO-8859-1</encoding>
+              </configuration>
+          </plugin>
+        
+		   <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-javadoc-plugin</artifactId>
+              <version>2.9</version>
+              <configuration>
+                  <docTitle>${project.name} ${project.version}</docTitle>
+                  <encoding>ISO-8859-1</encoding>
+                  <footer />
+                  <header />
+                  <keywords>true</keywords>
+                  <detectLinks>true</detectLinks>
+                  <javaApiLinks>
+                      <property>
+                          <name>api_1.4</name>
+                          <value>http://download.oracle.com/javase/1.4.2/docs/api/</value>
+                      </property>
+                      <property>
+                          <name>api_1.5</name>
+                          <value>http://download.oracle.com/javase/1.5.0/docs/api/</value>
+                      </property>
+                      <property>
+                          <name>api_1.6</name>
+                          <value>http://download.oracle.com/javase/6/docs/api/</value>
+                      </property>
+                  </javaApiLinks>
+              </configuration>
+          </plugin>
+        
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-site-plugin</artifactId>
+              <configuration>
+                  <chmod>true</chmod>
+                  <chmodMode>a+rwX</chmodMode>
+              </configuration>
+          </plugin>
+          
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-jar-plugin</artifactId>
+              <version>2.3.1</version>
+              <configuration>
+                  <archive>
+                      <manifestEntries>
+                          <Built-By>gvSIG Team</Built-By>
+                      </manifestEntries>
+                  </archive>
+              </configuration>
+          </plugin>
+          
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>properties-maven-plugin</artifactId>
+            <version>1.0-alpha-2</version>
+          </plugin>
+  
+          <plugin>
+            <groupId>org.codehaus.gmaven</groupId>
+            <artifactId>gmaven-plugin</artifactId>
+            <version>1.4</version>
+          </plugin>
+  
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>1.7</version>
+          </plugin>
+
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>animal-sniffer-maven-plugin</artifactId>
+            <version>1.9</version>
+          </plugin>
+
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-release-plugin</artifactId>
+              <version>2.4.2</version>
+          </plugin>
+
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>2.2-beta-5</version>
+          </plugin>
+
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-clean-plugin</artifactId>
+            <version>2.4.1</version>
+          </plugin>
+          
+          <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>exec-maven-plugin</artifactId>
+              <version>1.2</version>
+          </plugin>    
+
+          <plugin>
+              <groupId>com.mycila.maven-license-plugin</groupId>
+              <artifactId>maven-license-plugin</artifactId>
+              <version>1.10.b1</version>
+          </plugin>    
+
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-source-plugin</artifactId>
+              <version>2.2.1</version>
+          </plugin>
+
+        </plugins>
+      </pluginManagement>
+      
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+                <configuration>
+                    <tagBase>https://devel.gvsig.org/svn/gvsig-tools/org.gvsig.tools/library/tags</tagBase>
+                    <!-- This is a 2.0 beta 6 bug. By default the goals are 'clean verify', so the modules  
+                    are not installed, so the dependencies between modules are not met. With this configuration   
+                    we force the module installation. -->  
+                    <preparationGoals>clean install</preparationGoals>  
+                    <autoVersionSubmodules>true</autoVersionSubmodules>
+                    <goals>deploy</goals>
+                </configuration>
+            </plugin>
+            <plugin>
+		          <!-- to continue building  when test fail -->
+		          <groupId>org.apache.maven.plugins</groupId>
+		          <artifactId>maven-surefire-plugin</artifactId>
+		          <configuration>
+		            <testFailureIgnore>true</testFailureIgnore>
+		          </configuration>
+		        </plugin>
+        </plugins>
+    </build>
+    
+	 <reporting>
+	    <excludeDefaults>true</excludeDefaults>
+	    <plugins>
+	      <plugin>
+	        <groupId>org.apache.maven.plugins</groupId>
+	        <artifactId>maven-project-info-reports-plugin</artifactId>
+            <version>2.7</version>
+	      </plugin>
+	      <plugin>
+	        <groupId>org.apache.maven.plugins</groupId>
+	        <artifactId>maven-javadoc-plugin</artifactId>
+            <version>2.9</version>
+	      </plugin>
+	      <plugin>
+	        <groupId>org.apache.maven.plugins</groupId>
+	        <artifactId>maven-jxr-plugin</artifactId>
+            <version>2.3</version>
+	        <configuration>
+	          <linkJavadoc>true</linkJavadoc>
+	        </configuration>
+	      </plugin>
+	    </plugins>
+	  </reporting>
+	
+  
+  <properties>
+    	<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
+    	<localRepository>${user.home}/.m2/repository</localRepository>
+    	<site-repository>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</site-repository>
+
+  	</properties>
+    
+    <profiles>
+        <profile>
+            <id>cdc</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <repositories>
+                <repository>
+                    <id>gvsig-public-http-repository</id>
+                    <name>gvSIG maven public HTTP repository</name>
+                    <url>http://devel.gvsig.org/m2repo/j2me</url>
+                    <releases>
+                        <enabled>true</enabled>
+                        <updatePolicy>daily</updatePolicy>
+                        <checksumPolicy>warn</checksumPolicy>
+                    </releases>
+                    <snapshots>
+                        <enabled>true</enabled>
+                        <updatePolicy>interval:60</updatePolicy>
+                        <checksumPolicy>warn</checksumPolicy>
+                    </snapshots>
+                </repository>
+                <!-- 
+                <repository>
+                    <id>osgeo</id>
+                    <name>Open Source Geospatial Foundation</name>
+                    <url>http://download.osgeo.org/webdav/geotools</url>
+                    <releases>
+                        <enabled>true</enabled>
+                        <updatePolicy>never</updatePolicy>
+                        <checksumPolicy>warn</checksumPolicy>
+                    </releases>
+                    <snapshots>
+                        <enabled>false</enabled>
+                    </snapshots>
+                </repository>
+                -->
+            </repositories>
+            <modules>
+                <module>org.gvsig.tools.lib</module>
+            </modules>
+        </profile>
+        <profile>
+            <id>se</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <repositories>
+                <repository>
+                    <id>gvsig-public-http-repository</id>
+                    <name>gvSIG maven public HTTP repository</name>
+                    <url>http://devel.gvsig.org/m2repo/j2se</url>
+                    <releases>
+                        <enabled>true</enabled>
+                        <updatePolicy>daily</updatePolicy>
+                        <checksumPolicy>warn</checksumPolicy>
+                    </releases>
+                    <snapshots>
+                        <enabled>true</enabled>
+                        <updatePolicy>daily</updatePolicy>
+                        <checksumPolicy>warn</checksumPolicy>
+                    </snapshots>
+                </repository>
+            </repositories>
+            <modules>
+                <module>org.gvsig.tools.lib</module>
+                <module>org.gvsig.tools.swing</module>
+                <module>org.gvsig.tools.main</module>
+                <module>org.gvsig.tools.dynform</module>
+            </modules>
+        </profile>
+    </profiles>
+</project>
Index: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/README.txt
===================================================================
--- org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/README.txt	(revision 0)
+++ org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57/README.txt	(revision 1235)
@@ -0,0 +1,45 @@
+====
+    gvSIG. Desktop Geographic Information System.
+
+    Copyright (C) 2007-2013 gvSIG Association.
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA  02110-1301, USA.
+
+    For any additional information, do not hesitate to contact us
+    at info AT gvsig.com, or visit our website www.gvsig.com.
+====
+
+The first time you checkout the current project to a new workspace, 
+you have to prepare it to be able to work easily with maven from
+eclipse itself.
+
+Perform the following steps:
+
+1.- Launch the *prepare-workspace.xml* ant build file. 
+    You can do it by loading the file into the ant view, 
+    and running the default task, or right-clicking the 
+    file from the package explorer or the navigator and
+    select the option: *Run as > Ant build*. 
+    
+2.- Restart eclipse.
+
+3.- Import the subprojects of the project you have just checked out.
+
+Those steps are only needed once per workspace.     
+
+
+
+

Property changes on: org.gvsig.tools/library/tags/org.gvsig.tools-3.0.57
___________________________________________________________________
Added: svn:ignore
   + .project
target
.settings
.pom.xml.swp
.add_getForm_method_to_JDynField.patch.swp


