Index: FeatureStore.java
===================================================================
--- FeatureStore.java	(revision 41817)
+++ FeatureStore.java	(revision 41818)
@@ -49,7 +49,7 @@
  * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
  * different {@link FeatureType}(s) (as in GML format for instance).
  * </p>
- * 
+ *
  * <p>
  * FeatureStore allows:
  * </p>
@@ -68,7 +68,7 @@
  * <li>Selection.
  * <li>Locks management.
  * </ul>
- * 
+ *
  */
 public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable {
 
@@ -85,13 +85,13 @@
 
     /*
      * =============================================================
-     * 
+     *
      * information related services
      */
 
     /**
      * Indicates whether this store allows writing.
-     * 
+     *
      * @return
      *         true if this store can be written, false if not.
      */
@@ -99,10 +99,10 @@
 
     /**
      * Returns this store's default {@link FeatureType}.
-     * 
+     *
      * @return
      *         this store's default {@link FeatureType}.
-     * 
+     *
      * @throws DataException
      */
     public FeatureType getDefaultFeatureType() throws DataException;
@@ -110,11 +110,11 @@
     /**
      * Returns this store's featureType {@link FeatureType} matches with
      * featureTypeId.
-     * 
+     *
      * @param featureTypeId
-     * 
+     *
      * @return this store's default {@link FeatureType}.
-     * 
+     *
      * @throws DataException
      */
     public FeatureType getFeatureType(String featureTypeId)
@@ -122,16 +122,16 @@
 
     /**
      * Returns this store's {@link FeatureType}(s).
-     * 
+     *
      * @return a list with this store's {@link FeatureType}(s).
-     * 
+     *
      * @throws DataException
      */
     public List getFeatureTypes() throws DataException;
 
     /**
      * Returns this store's parameters.
-     * 
+     *
      * @return
      *         {@link DataStoreParameters} containing this store's parameters
      */
@@ -145,14 +145,14 @@
 
     /**
      * Returns this store's total envelope (extent).
-     * 
+     *
      * @return this store's total envelope (extent) or <code>null</code> if
      *         store not have geometry information
      */
     public Envelope getEnvelope() throws DataException;
 
     /**
-     * 
+     *
      * @deprecated use getDefaultFeatureType().getDefaultSRS()
      * @return
      * @throws DataException
@@ -161,15 +161,15 @@
 
     /**
      * Exports this store to another store.
-     * 
+     *
      * @param explorer
      *            {@link DataServerExplorer} target
      * @param params
      *            New parameters of this store that will be used on the target
      *            explorer
-     * 
+     *
      * @throws DataException
-     * 
+     *
      * @Deprecated this method is unstable
      */
     public void export(DataServerExplorer explorer, String provider,
@@ -177,7 +177,7 @@
 
     /*
      * =============================================================
-     * 
+     *
      * Query related services
      */
 
@@ -185,18 +185,18 @@
      * Returns all available features in the store.
      * <p>
      * <em>
-     * <strong>NOTE:</strong> if you use this method to get a 
-     * {@link FeatureSet}, you  must get sure it is disposed 
-     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
-     * error occurs while getting the data. It is recommended to use the 
-     * <code>accept</code> methods instead, which handle everything for you. 
-     * Take into account the accept methods may use a fast iterator to 
+     * <strong>NOTE:</strong> if you use this method to get a
+     * {@link FeatureSet}, you  must get sure it is disposed
+     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
+     * error occurs while getting the data. It is recommended to use the
+     * <code>accept</code> methods instead, which handle everything for you.
+     * Take into account the accept methods may use a fast iterator to
      * get the features.
      * </em>
      * </p>
-     * 
+     *
      * @see #accept(org.gvsig.tools.visitor.Visitor)
-     * 
+     *
      * @return a collection of features
      * @throws ReadException
      *             if there is any error while reading the features
@@ -208,19 +208,19 @@
      * restrictions of the FeatureQuery.
      * <p>
      * <em>
-     * <strong>NOTE:</strong> if you use this method to get a 
-     * {@link FeatureSet}, you  must get sure it is disposed 
-     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
-     * error occurs while getting the data. It is recommended to use the 
-     * <code>accept</code> methods instead, which handle everything for you. 
-     * Take into account the accept methods may use a fast iterator to 
+     * <strong>NOTE:</strong> if you use this method to get a
+     * {@link FeatureSet}, you  must get sure it is disposed
+     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
+     * error occurs while getting the data. It is recommended to use the
+     * <code>accept</code> methods instead, which handle everything for you.
+     * Take into account the accept methods may use a fast iterator to
      * get the features.
      * </em>
      * </p>
-     * 
+     *
      * @see #accept(org.gvsig.tools.visitor.Visitor,
      *      org.gvsig.fmap.dal.DataQuery)
-     * 
+     *
      * @param featureQuery
      *            defines the characteristics of the features to return
      * @return a collection of features
@@ -233,7 +233,7 @@
      * Loads a subset of features taking into account the properties and
      * restrictions of the FeatureQuery. Feature loading is performed by calling
      * the Observer, once each loaded Feature.
-     * 
+     *
      * @param featureQuery
      *            defines the characteristics of the features to return
      * @param observer
@@ -247,7 +247,7 @@
     /**
      * Loads all available feature in the store. The loading of Features is
      * performed by calling the Observer, once each loaded Feature.
-     * 
+     *
      * @param observer
      *            to be notified of each loaded Feature
      * @throws DataException
@@ -257,39 +257,39 @@
 
     /**
      * Returns the feature given its reference.
-     * 
+     *
      * @param reference
      *            a unique FeatureReference
      * @return
      *         The Feature
-     * 
+     *
      * @throws DataException
-     * 
+     *
      */
     public Feature getFeatureByReference(FeatureReference reference)
         throws DataException;
 
     /**
      * Returns the feature given its reference and feature type.
-     * 
+     *
      * @param reference
      *            a unique FeatureReference
-     * 
+     *
      * @param featureType
      *            FeatureType to which the requested Feature belongs
-     * 
+     *
      * @return
      *         The Feature
-     * 
+     *
      * @throws DataException
-     * 
+     *
      */
     public Feature getFeatureByReference(FeatureReference reference,
         FeatureType featureType) throws DataException;
 
     /*
      * =============================================================
-     * 
+     *
      * Editing related services
      */
 
@@ -300,23 +300,23 @@
 
     /**
      * Enters editing state specifying the editing mode.
-     * 
+     *
      * @param mode
-     * 
+     *
      * @throws DataException
      */
     public void edit(int mode) throws DataException;
 
     /**
      * Cancels all editing since the last edit().
-     * 
+     *
      * @throws DataException
      */
     public void cancelEditing() throws DataException;
 
     /**
      * Exits editing state.
-     * 
+     *
      * @throws DataException
      */
     public void finishEditing() throws DataException;
@@ -336,16 +336,16 @@
      * Returns true if you can call CommitChanges method.
      * If not in editing or changes have been made in the structure
      * return false.
-     *  
+     *
      * @return true if can call commitChanges
-     * @throws DataException 
+     * @throws DataException
      */
     public boolean canCommitChanges() throws DataException;
 
-    
+
     /**
      * Indicates whether this store is in editing state.
-     * 
+     *
      * @return
      *         true if this store is in editing state, false if not.
      */
@@ -354,7 +354,7 @@
     /**
      * Indicates whether this store is in appending state. In this state the new
      * features are automatically inserted at the end of the {@link FeatureSet}.
-     * 
+     *
      * @return true if this store is in appending state.
      */
     public boolean isAppending();
@@ -362,12 +362,12 @@
     /**
      * Updates a {@link FeatureType} in the store with the changes in the
      * {@link EditableFeatureType}.<br>
-     * 
+     *
      * Any {@link FeatureSet} from this store that are used will be invalidated.
-     * 
+     *
      * @param featureType
      *            an {@link EditableFeatureType} with the changes.
-     * 
+     *
      * @throws DataException
      */
     public void update(EditableFeatureType featureType) throws DataException;
@@ -375,42 +375,42 @@
     /**
      * Updates a {@link Feature} in the store with the changes in the
      * {@link EditableFeature}.<br>
-     * 
+     *
      * Any {@link FeatureSet} from this store that was still in use will be
      * invalidated. You can override this using
      * {@link FeatureSet#update(EditableFeature)}.
-     * 
+     *
      * @param feature
      *            the feature to be updated
-     * 
+     *
      * @throws DataException
      */
     public void update(EditableFeature feature) throws DataException;
 
     /**
      * Deletes a {@link Feature} from the store.<br>
-     * 
+     *
      * Any {@link FeatureSet} from this store that was still in use will be
      * invalidated. You can override this using {@link Iterator#remove()} from
      * {@link FeatureSet}.
-     * 
+     *
      * @param feature
      *            The feature to be deleted.
-     * 
+     *
      * @throws DataException
      */
     public void delete(Feature feature) throws DataException;
 
     /**
      * Inserts a {@link Feature} in the store.<br>
-     * 
+     *
      * Any {@link FeatureSet} from this store that was still in use will be
      * invalidated. You can override this using
      * {@link FeatureSet#insert(EditableFeature)}.
-     * 
+     *
      * @param feature
      *            The feature to be inserted
-     * 
+     *
      * @throws DataException
      */
     public void insert(EditableFeature feature) throws DataException;
@@ -418,9 +418,9 @@
     /**
      * Creates a new feature using the default feature type and returns it as an
      * {@link EditableFeature}
-     * 
+     *
      * @return a new feature in editable state
-     * 
+     *
      * @throws DataException
      */
     public EditableFeature createNewFeature() throws DataException;
@@ -428,16 +428,16 @@
     /**
      * Creates a new feature of the given {@link FeatureType} and uses the given
      * {@link Feature} as default values to initialize it.
-     * 
+     *
      * @param type
      *            the new feature's feature type
-     * 
+     *
      * @param defaultValues
      *            a feature whose values are used as default values for the new
      *            feature.
-     * 
+     *
      * @return the new feature.
-     * 
+     *
      * @throws DataException
      */
     public EditableFeature createNewFeature(FeatureType type,
@@ -447,17 +447,17 @@
      * Creates a new feature of the given {@link FeatureType}. The flag
      * defaultValues is used to indicate whether the new feature should be
      * initialized with default values or not.
-     * 
+     *
      * @param type
      *            the new feature's feature type
-     * 
+     *
      * @param defaultValues
      *            if true the new feature is initialized with each attribute's
      *            default value.
-     * 
+     *
      * @return
      *         the new feature
-     * 
+     *
      * @throws DataException
      */
     public EditableFeature createNewFeature(FeatureType type,
@@ -467,14 +467,14 @@
      * Creates a new feature of default {@link FeatureType}. The flag
      * defaultValues is used to indicate whether the new feature should be
      * initialized with default values or not.
-     * 
+     *
      * @param defaultValues
      *            if true the new feature is initialized with each attribute's
      *            default value.
-     * 
+     *
      * @return
      *         the new feature
-     * 
+     *
      * @throws DataException
      */
     public EditableFeature createNewFeature(boolean defaultValues)
@@ -483,17 +483,17 @@
     /**
      * Applies the validation rules associated to the given mode to the active
      * {@link FeatureSet}.
-     * 
+     *
      * @param mode
      *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
-     * 
+     *
      * @throws DataException
      */
     public void validateFeatures(int mode) throws DataException;
 
     /**
      * Indicates whether this store supports append mode.
-     * 
+     *
      * @return
      *         true if this store supports append mode.
      */
@@ -502,10 +502,10 @@
     /**
      * Initiates an editing group. This is typically used to group series of
      * store editing operations.
-     * 
+     *
      * @param description
      *            Description of the editing group.
-     * 
+     *
      * @throws NeedEditingModeException
      */
     public void beginEditingGroup(String description)
@@ -513,33 +513,33 @@
 
     /**
      * Finishes an editing group.
-     * 
+     *
      * @throws NeedEditingModeException
      */
     public void endEditingGroup() throws NeedEditingModeException;
 
     /*
      * =============================================================
-     * 
+     *
      * Index related services
      */
 
     /**
      * Creates an index which will be applied to the features of the given type,
      * by using the data of the given attribute.
-     * 
+     *
      * @param featureType
      *            The FeatureType to which the indexed attribute belongs.
-     * 
+     *
      * @param attributeName
      *            The name of the attributed to be indexed
-     * 
+     *
      * @param indexName
      *            The index name
-     * 
+     *
      * @return the resulting {@link FeatureIndex}
-     * 
-     * 
+     *
+     *
      * @throws FeatureIndexException
      *             if there is an error creating the index
      */
@@ -549,22 +549,22 @@
     /**
      * Creates an index which will be applied to the features of the given type,
      * by using the data of the given attribute.
-     * 
+     *
      * @param indexTypeName
      *            the type of the index to be created. That name is
      *            related to one of the registered index providers
      * @param featureType
      *            The FeatureType to which the indexed attribute belongs.
-     * 
+     *
      * @param attributeName
      *            The name of the attributed to be indexed
-     * 
+     *
      * @param indexName
      *            The index name
-     * 
+     *
      * @return the resulting {@link FeatureIndex}
-     * 
-     * 
+     *
+     *
      * @throws FeatureIndexException
      *             if there is an error creating the index
      */
@@ -580,16 +580,16 @@
      * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
      * when the index has finished filling with data and is available to be
      * used.
-     * 
+     *
      * @param featureType
      *            The FeatureType to which the indexed attribute belongs.
-     * 
+     *
      * @param attributeName
      *            The name of the attributed to be indexed
-     * 
+     *
      * @param indexName
      *            The index name
-     * 
+     *
      * @param observer
      *            to notify to when the created index has finished filling
      *            with data and is available to be used. The observer will
@@ -600,14 +600,14 @@
      *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
      *            notification with the exception object if there has been
      *            any error in the process. Optional.
-     * 
+     *
      * @return the resulting {@link FeatureIndex}
-     * 
+     *
      * @see FeatureStoreNotification#INDEX_FILLING_STARTED
      * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
      * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
      * @see FeatureStoreNotification#INDEX_FILLING_ERROR
-     * 
+     *
      * @throws FeatureIndexException
      *             if there is an error creating the index
      */
@@ -623,19 +623,19 @@
      * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
      * when the index has finished filling with data and is available to be
      * used.
-     * 
+     *
      * @param indexTypeName
      *            the type of the index to be created. That name is
      *            related to one of the registered index providers
      * @param featureType
      *            The FeatureType to which the indexed attribute belongs.
-     * 
+     *
      * @param attributeName
      *            The name of the attributed to be indexed
-     * 
+     *
      * @param indexName
      *            The index name
-     * 
+     *
      * @param observer
      *            to notify to when the created index has finished filling
      *            with data and is available to be used. The observer will
@@ -646,14 +646,14 @@
      *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
      *            notification with the exception object if there has been
      *            any error in the process. Optional.
-     * 
+     *
      * @return the resulting {@link FeatureIndex}
-     * 
+     *
      * @see FeatureStoreNotification#INDEX_FILLING_STARTED
      * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
      * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
      * @see FeatureStoreNotification#INDEX_FILLING_ERROR
-     * 
+     *
      * @throws FeatureIndexException
      *             if there is an error creating the index
      */
@@ -664,20 +664,20 @@
     /**
      * Returns a FeatureIndexes structure containing all available indexes in
      * the store.
-     * 
+     *
      * @return
      */
     public FeatureIndexes getIndexes();
 
     /*
      * =============================================================
-     * 
+     *
      * Selection related services
      */
 
     /**
      * Sets the selection to the passed {@link FeatureSet}
-     * 
+     *
      * @param selection
      *            A {@link FeatureSet} with the requested selection
      */
@@ -685,10 +685,10 @@
 
     /**
      * Creates a {@link FeatureSelection}
-     * 
+     *
      * @return
      *         a {@link FeatureSelection}
-     * 
+     *
      * @throws DataException
      */
     public FeatureSelection createFeatureSelection() throws DataException;
@@ -696,23 +696,23 @@
     /**
      * Returns the current {@link FeatureSelection}.
      * Create a empty selection if not exits.
-     * 
+     *
      * @return
      *         current {@link FeatureSelection}.
-     * 
+     *
      * @throws DataException
      */
     public FeatureSelection getFeatureSelection() throws DataException;
 
     /*
      * =============================================================
-     * 
+     *
      * Lock related services
      */
 
     /**
      * Indicates whether this store supports locks.
-     * 
+     *
      * @return
      *         true if this store supports locks, false if not.
      */
@@ -720,10 +720,10 @@
 
     /**
      * Returns the set of locked features
-     * 
+     *
      * @return
      *         set of locked features
-     * 
+     *
      * @throws DataException
      */
     public FeatureLocks getLocks() throws DataException;
@@ -736,7 +736,7 @@
 
     /**
      * Returns this store transforms
-     * 
+     *
      * @return
      *         this store transforms
      */
@@ -744,7 +744,7 @@
 
     /**
      * Returns a new {@link FeatureQuery} associated to this store.
-     * 
+     *
      * @return
      *         a new {@link FeatureQuery} associated to this store.
      */
@@ -752,7 +752,7 @@
 
     /**
      * Returns featue count of this store.
-     * 
+     *
      * @return
      * @throws DataException
      */
@@ -760,7 +760,7 @@
 
     /**
      * Creates a vectorial cache that is used to save and retrieve data.
-     * 
+     *
      * @param name
      *            the cache name.
      * @param parameters
@@ -779,7 +779,7 @@
      * Return if the provider knows the real envelope of a layer. If not,
      * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
      * the full envelope.
-     * 
+     *
      * @return
      *         <true> if it knows the real envelope.
      */
@@ -788,7 +788,7 @@
     /**
      * Return if the maximum number of features provided by the
      * provider are limited.
-     * 
+     *
      * @return
      *         <true> if there is a limit of features.
      */
@@ -798,9 +798,18 @@
      * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
      * true,
      * it returns the limit of features retrieved from the provider.
-     * 
+     *
      * @return
      *         The limit of the retrieved features.
      */
     public int getRetrievedFeaturesLimit();
+
+    /**
+     * Return the associated feature to the dynobject.
+     * If the dynobject isn't associated to a feature of this store, return null.
+     *
+     * @param dynobject
+     * @return
+     */
+    public Feature getFeature(DynObject dynobject);
 }
