Index: DefaultFeatureStore.java
===================================================================
--- DefaultFeatureStore.java	(revision 41817)
+++ DefaultFeatureStore.java	(revision 41818)
@@ -102,6 +102,7 @@
 import org.gvsig.fmap.dal.feature.exception.WriteNotAllowedException;
 import org.gvsig.fmap.dal.feature.impl.expansionadapter.MemoryExpansionAdapter;
 import org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet;
+import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectFeatureFacade;
 import org.gvsig.fmap.dal.feature.impl.undo.DefaultFeatureCommandsStack;
 import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
 import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
@@ -181,7 +182,7 @@
     private DefaultFeatureStoreTransforms transforms;
 
     DelegatedDynObject metadata;
-    
+
     private Set metadataChildren;
 
     private Long featureCount = null;
@@ -192,7 +193,7 @@
 
     /*
      * TODO:
-     * 
+     *
      * - Comprobar que solo se pueden a�adir reglas de validacion sobre un
      * EditableFeatureType. - Comprobar que solo se puede hacer un update con un
      * featureType al que se le han cambiado las reglas de validacion cuando
@@ -334,7 +335,7 @@
      * // TODO:
      * // Si el provider devuelbe null habria que ver de construir aqui
      * // los metadatos basicos, como el Envelope y el SRS.
-     * 
+     *
      * // TODO: Estando en edicion el Envelope deberia de
      * // actualizarse usando el spatialManager
      * return this.provider.getMetadata();
@@ -344,7 +345,7 @@
     public Envelope getEnvelope() throws DataException {
         if (this.mode == MODE_FULLEDIT) {
         	// Just in case another thread tries to write in the store
-        	synchronized (this) {				
+        	synchronized (this) {
         		return this.spatialManager.getEnvelope();
 			}
         }
@@ -479,7 +480,7 @@
 
             String defFTypeid = state.getString("defaultFeatureTypeId");
             FeatureType ftype = null;
-            
+
             if (this.defaultFeatureType == null ||
                 this.defaultFeatureType.getId() == null ||
                 !this.defaultFeatureType.getId().equals(
@@ -973,10 +974,10 @@
         }
     }
 
-    public void delete(Feature feature) throws DataException {       
+    public void delete(Feature feature) throws DataException {
         this.commands.delete(feature);
     }
-    
+
     synchronized public void doDelete(Feature feature) throws DataException {
         try {
             checkInEditingMode();
@@ -984,12 +985,12 @@
             if (feature instanceof EditableFeature) {
                 throw new StoreDeleteEditableFeatureException(getName());
             }
-            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);            
-            
+            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);
+
             //Update the featureManager and the spatialManager
             featureManager.delete(feature.getReference());
             spatialManager.deleteFeature(feature);
-            
+
             newVersionOfUpdate();
             hasStrongChanges = true;
             notifyChange(FeatureStoreNotification.AFTER_DELETE, feature);
@@ -1000,7 +1001,7 @@
 
     private static EditableFeature lastChangedFeature = null;
 
-    public synchronized void insert(EditableFeature feature) 
+    public synchronized void insert(EditableFeature feature)
         throws DataException {
         LOG.debug("In editing mode {}, insert feature: {}", new Integer(mode),
             feature);
@@ -1023,21 +1024,21 @@
                 notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
                 break;
 
-            case MODE_FULLEDIT: 
+            case MODE_FULLEDIT:
                 if (feature.getSource() != null) {
                     throw new NoNewFeatureInsertException(this.getName());
                 }
-                commands.insert(feature);               
+                commands.insert(feature);
             }
         } catch (Exception e) {
             throw new StoreInsertFeatureException(e, this.getName());
         }
     }
-    
+
     synchronized public void doInsert(EditableFeature feature)
         throws DataException {
         checkIsOwnFeature(feature);
-   
+
         waitForIndexes();
 
         notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
@@ -1051,18 +1052,18 @@
         //Update the featureManager and the spatialManager
         ((DefaultEditableFeature) feature).setInserted(true);
         DefaultFeature newFeature = (DefaultFeature) feature.getNotEditableCopy();
-        
-        
+
+
         featureManager.add(newFeature);
         spatialManager.insertFeature(newFeature);
-        
+
         hasStrongChanges = true;
         hasInserts = true;
-        notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);       
+        notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
     }
-    
+
     public void update(EditableFeature feature)
-    throws DataException {        
+    throws DataException {
         if ((feature).getSource() == null) {
             insert(feature);
             return;
@@ -1072,7 +1073,7 @@
 
     synchronized public void doUpdate(EditableFeature feature, Feature oldFeature)
         throws DataException {
-        try {          
+        try {
             checkInEditingMode();
             checkIsOwnFeature(feature);
             notifyChange(FeatureStoreNotification.BEFORE_UPDATE, feature);
@@ -1083,12 +1084,12 @@
                 feature.validate(Feature.UPDATE);
                 lastChangedFeature = null;
             }
-            
+
             //Update the featureManager and the spatialManager
             Feature newf = feature.getNotEditableCopy();
             featureManager.update(newf, oldFeature);
             spatialManager.updateFeature(newf, oldFeature);
-   
+
             hasStrongChanges = true;
             notifyChange(FeatureStoreNotification.AFTER_UPDATE, feature);
         } catch (Exception e) {
@@ -1170,14 +1171,14 @@
     synchronized public void finishEditing() throws DataException {
         LOG.debug("finish editing of mode: {}", new Integer(mode));
         try {
-            
+
             /*
              * Selection needs to be cleared when editing stops
              * to prevent conflicts with selection remaining from
              * editing mode.
              */
             ((FeatureSelection) this.getSelection()).deselectAll();
-            
+
             switch (mode) {
             case MODE_QUERY:
                 throw new NeedEditingModeException(this.getName());
@@ -1197,7 +1198,7 @@
                 notifyChange(FeatureStoreNotification.BEFORE_FINISHEDITING);
                 if (hasStrongChanges) {
                     validateFeatures(Feature.FINISH_EDITING);
-                    
+
                     /*
                      * This will throw a PerformEditingExceptionif the provider
                      * does not accept the changes (for example, an invalid field name)
@@ -1285,10 +1286,10 @@
     	default:
         case MODE_QUERY:
         	return false;
-        	
+
         case MODE_APPEND:
         	return true;
-        
+
         case MODE_FULLEDIT:
             List types = this.getFeatureTypes();
             for( int i=0; i<types.size(); i++ ) {
@@ -1302,7 +1303,7 @@
             return true;
     	}
     }
-    
+
     public void beginEditingGroup(String description)
         throws NeedEditingModeException {
         checkInEditingMode();
@@ -1524,8 +1525,8 @@
                 return f;
             }
         }
-    
-        
+
+
         DefaultFeature feature =
             new DefaultFeature(this,
                 this.provider.getFeatureProviderByReference(
@@ -1645,7 +1646,7 @@
 
     public FeatureType getDefaultFeatureType() throws DataException {
         try {
-            
+
             if (isEditing()) {
                 FeatureType auxFeatureType =
                     featureTypeManager.getType(defaultFeatureType.getId());
@@ -1657,14 +1658,14 @@
             if (type != null) {
                 return avoidEditable(type);
             }
-            
+
             return avoidEditable(defaultFeatureType);
-            
+
         } catch (Exception e) {
             throw new GetFeatureTypeException(e, getName());
         }
     }
-    
+
     private FeatureType avoidEditable(FeatureType ft) {
         if (ft instanceof EditableFeatureType) {
             return ((EditableFeatureType) ft).getNotEditableCopy();
@@ -1766,7 +1767,7 @@
                 new DefaultEditableFeature(this, data);
             feature.initializeValues(defaultValues);
             data.setNew(true);
-            
+
             return feature;
         } catch (Exception e) {
             throw new CreateFeatureException(e, getName());
@@ -1993,7 +1994,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.gvsig.metadata.Metadata#getMetadataChildren()
      */
     public Set getMetadataChildren() {
@@ -2002,7 +2003,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.gvsig.metadata.Metadata#getMetadataName()
      */
     public String getMetadataName() {
@@ -2101,27 +2102,27 @@
         return this.provider.getRetrievedFeaturesLimit();
     }
 
-    public Interval getInterval() {  
+    public Interval getInterval() {
         return this.provider.getInterval();
     }
 
-    public Collection getTimes() {      
+    public Collection getTimes() {
         return this.provider.getTimes();
     }
 
-    public Collection getTimes(Interval interval) {       
+    public Collection getTimes(Interval interval) {
         return this.provider.getTimes(interval);
     }
-    
+
     /* (non-Javadoc)
      * @see java.lang.Object#clone()
      */
     public Object clone() throws CloneNotSupportedException {
-        
+
         DataStoreParameters dsp = getParameters();
-        
+
         DefaultFeatureStore cloned_store = null;
-        
+
         try {
             cloned_store = (DefaultFeatureStore) DALLocator.getDataManager().
                 openStore(this.getProviderName(), dsp);
@@ -2131,8 +2132,16 @@
             }
         } catch (Exception e) {
             throw new CloneException(e);
-        }   
+        }
         return cloned_store;
-        
+
     }
+
+    public Feature getFeature(DynObject dynobject) {
+        if (dynobject instanceof DynObjectFeatureFacade){
+            Feature f = ((DynObjectFeatureFacade)dynobject).getFeature();
+            return f;
+        }
+        return null;
+    }
 }
\ No newline at end of file
