Interface FeatureStore<T extends FeatureType,​F extends Feature>

    • Method Detail

      • addFeatures

        List<FeatureId> addFeatures​(FeatureCollection<T,​F> featureCollection)
                             throws IOException
        Adds all features from the feature collection.

        A list of FeatureIds is returned, one for each feature in the order created. However, these might not be assigned until after a commit has been performed.

        Parameters:
        featureCollection - the collection of features to add
        Returns:
        the FeatureIds of the newly added features
        Throws:
        IOException - if an error occurs modifying the data source
      • removeFeatures

        void removeFeatures​(Filter filter)
                     throws IOException
        Removes features selected by the given filter.
        Parameters:
        filter - an OpenGIS filter
        Throws:
        IOException - if an error occurs modifying the data source
      • modifyFeatures

        void modifyFeatures​(Name[] attributeNames,
                            Object[] attributeValues,
                            Filter filter)
                     throws IOException
        Modifies the attributes with the supplied values in all features selected by the given filter.
        Parameters:
        attributeNames - the attributes to modify
        attributeValues - the new values for the attributes
        filter - an OpenGIS filter
        Throws:
        IOException - if the attribute and object arrays are not equal in length; if the value types do not match the attribute types; if modification is not supported; or if there errors accessing the data source
      • modifyFeatures

        void modifyFeatures​(Name attributeName,
                            Object attributeValue,
                            Filter filter)
                     throws IOException
        Modifies an attribute with the supplied value in all features selected by the given filter.
        Parameters:
        attributeName - the attribute to modify
        attributeValue - the new value for the attribute
        filter - an OpenGIS filter
        Throws:
        IOException - if modification is not supported; if the value type does not match the attribute type; or if there errors accessing the data source
      • setFeatures

        void setFeatures​(FeatureReader<T,​F> reader)
                  throws IOException
        Deletes any existing features in the data source and then inserts new features provided by the given reader. This is primarily used as a convenience method for file-based data sources.
        Parameters:
        reader - - the collection to be written
        Throws:
        IOException - if there are any datasource errors.
      • setTransaction

        void setTransaction​(Transaction transaction)
        Provide a transaction for commit/rollback control of a modifying operation on this FeatureStore.
        
         Transaction t = new DefaultTransaction();
         featureStore.setTransaction(t);
         try {
             featureStore.addFeatures( someFeatures );
             t.commit();
         } catch ( IOException ex ) {
             // something went wrong;
            java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", ex);
             t.rollback();
         } finally {
             t.close();
         }
         
        Parameters:
        transaction - the transaction
      • getTransaction

        Transaction getTransaction()
        Gets the Transaction that this FeatureStore is currently operating against.
        
         Transaction t = featureStore.getTransaction();
         try {
             featureStore.addFeatures( features );
             t.commit();
         } catch( IOException erp ){
             // something went wrong;
            java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", ex);
             t.rollback();
         }
         
        Returns:
        Transaction in use, or Transaction.AUTO_COMMIT