org.geotools.data.store
Class ActiveTypeEntry

java.lang.Object
  extended by org.geotools.data.store.ActiveTypeEntry
All Implemented Interfaces:
TypeEntry

public abstract class ActiveTypeEntry
extends java.lang.Object
implements TypeEntry

Starting place for holding information about a FeatureType.

Like say for instance the FeatureType, its metadata and so on.

The default implemenation should contain enough information to wean us off of AbstractDataStore. That is it should provide its own locking and event notification.

There is a naming convention:

  • Feedback:

    Author:
    jgarnett

    Field Summary
     FeatureListenerManager listenerManager
              Manages listener lists for FeatureSource implementation
    protected static java.util.logging.Logger LOGGER
               
    protected  DataStore parent
              Remember parent.
     
    Constructor Summary
    ActiveTypeEntry(DataStore parent, org.opengis.feature.simple.SimpleFeatureType schema, java.util.Map metadata)
               
     
    Method Summary
    protected  FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createAppend(Transaction transaction)
              It would be great to kill this method, and add a "skipToEnd" method to featureWriter?
    protected  FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureLocking()
              Create the FeatureLocking, override for your own custom implementation.
    abstract  FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureSource()
              Create a new FeatueSource allowing interaction with content.
    protected  FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureSource(org.opengis.feature.simple.SimpleFeatureType featureType)
              Create the FeatureSource, override for your own custom implementation.
    protected  FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureStore()
              Create the FeatureStore, override for your own custom implementation.
     FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createReader()
              Create a reader for this query.
    protected  FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createReader(Query query)
              GR: this method is called from inside getFeatureReader(Query ,Transaction ) to allow subclasses return an optimized FeatureReader wich supports the filter and attributes truncation specified in query
    protected  FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createWriter()
              Low level feature writer access.
     void fireAdded(org.opengis.feature.simple.SimpleFeature newFeature, Transaction transaction)
              Change notifcation
     void fireChanged(org.opengis.feature.simple.SimpleFeature before, org.opengis.feature.simple.SimpleFeature after, Transaction transaction)
              Change notifcation
     void fireRemoved(org.opengis.feature.simple.SimpleFeature removedFeature, Transaction transaction)
              Change notifcation
     org.opengis.util.InternationalString getDescription()
              TODO summary sentence for getDescription ...
     org.opengis.util.InternationalString getDisplayName()
              TODO summary sentence for getDisplayName ...
     org.opengis.feature.simple.SimpleFeatureType getFeatureType()
              TODO summary sentence for getFeatureType ...
     java.lang.String[] getMetadataNames()
              Metadata names from metadata.keySet().
     java.lang.String getTypeName()
               
    protected  org.opengis.filter.Filter getUnsupportedFilter(org.opengis.filter.Filter filter)
              GR: if a subclass supports filtering, it should override this method to return the unsupported part of the passed filter, so a FilteringFeatureReader will be constructed upon it.
     java.util.Map metadata()
              Map of metadata by name.
     FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader(Query query, Transaction transaction)
              Access a FeatureReader providing access to Feature information.
     FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> writer(Transaction transaction)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface org.geotools.data.store.TypeEntry
    equals, hashCode
     

    Field Detail

    LOGGER

    protected static final java.util.logging.Logger LOGGER

    parent

    protected DataStore parent
    Remember parent.

    We only refer to partent as a DataSource to keep hacks down.


    listenerManager

    public FeatureListenerManager listenerManager
    Manages listener lists for FeatureSource implementation

    Constructor Detail

    ActiveTypeEntry

    public ActiveTypeEntry(DataStore parent,
                           org.opengis.feature.simple.SimpleFeatureType schema,
                           java.util.Map metadata)
    Method Detail

    getDisplayName

    public org.opengis.util.InternationalString getDisplayName()
    TODO summary sentence for getDisplayName ...

    Specified by:
    getDisplayName in interface TypeEntry
    Returns:
    user name for this feature collection
    See Also:
    org.geotools.data.TypeEntry#getDisplayName()

    getDescription

    public org.opengis.util.InternationalString getDescription()
    TODO summary sentence for getDescription ...

    Specified by:
    getDescription in interface TypeEntry
    Returns:
    Description of this feature collection
    See Also:
    org.geotools.data.TypeEntry#getDescription()

    getFeatureType

    public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
    TODO summary sentence for getFeatureType ...

    Specified by:
    getFeatureType in interface TypeEntry
    Returns:
    Schema of this feature collection
    Throws:
    java.io.IOException
    See Also:
    org.geotools.data.TypeEntry#getFeatureType()

    getMetadataNames

    public java.lang.String[] getMetadataNames()
    Metadata names from metadata.keySet().

    Returns:
    metadata names mentioned in metadata.keySet();

    metadata

    public java.util.Map metadata()
    Map of metadata by name.

    Returns:
    Map of metadata by name

    getTypeName

    public java.lang.String getTypeName()

    reader

    public FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader(Query query,
                                                                                                                       Transaction transaction)
                                                                                                                throws java.io.IOException
    Access a FeatureReader providing access to Feature information.

    This implementation passes off responsibility to the following overrideable methods:

    • getFeatureReader(String typeName) - subclass *required* to implement

    If you can handle some aspects of Query natively (say expressions or reprojection) override the following:

  • getFeatureReader(typeName, query) - override to handle query natively
  • getUnsupportedFilter(typeName, filter) - everything you cannot handle natively
  • getFeatureReader(String typeName) - you must implement this, but you could point it back to getFeatureReader( typeName, Query.ALL );

    Throws:
    java.io.IOException

  • fireAdded

    public void fireAdded(org.opengis.feature.simple.SimpleFeature newFeature,
                          Transaction transaction)
    Description copied from interface: TypeEntry
    Change notifcation

    Specified by:
    fireAdded in interface TypeEntry

    fireRemoved

    public void fireRemoved(org.opengis.feature.simple.SimpleFeature removedFeature,
                            Transaction transaction)
    Description copied from interface: TypeEntry
    Change notifcation

    Specified by:
    fireRemoved in interface TypeEntry

    fireChanged

    public void fireChanged(org.opengis.feature.simple.SimpleFeature before,
                            org.opengis.feature.simple.SimpleFeature after,
                            Transaction transaction)
    Description copied from interface: TypeEntry
    Change notifcation

    Specified by:
    fireChanged in interface TypeEntry

    createFeatureSource

    public abstract FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureSource()
    Description copied from interface: TypeEntry
    Create a new FeatueSource allowing interaction with content.

    Subclass may optionally implement:

    • FeatureStore - to allow read/write access
    • FeatureLocking - for locking support
    This choice may even be made a runtime (allowing the api to represent a readonly file).

    Several default implemenations are provided

    Specified by:
    createFeatureSource in interface TypeEntry
    Returns:
    FeatureLocking allowing access to content.

    createFeatureSource

    protected FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureSource(org.opengis.feature.simple.SimpleFeatureType featureType)
    Create the FeatureSource, override for your own custom implementation.

    Default implementation makes use of DataStore getReader( ... ), and listenerManager.


    createFeatureStore

    protected FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureStore()
    Create the FeatureStore, override for your own custom implementation.


    createFeatureLocking

    protected FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createFeatureLocking()
    Create the FeatureLocking, override for your own custom implementation.

    Warning: The default implementation of this method uses lockingManger. You must override this method if you support your own locking system (like WFS).


    createReader

    public FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createReader()
    Create a reader for this query.

    Subclass must override this to actually aquire content.

    Parameters:
    typeName -
    query -
    Returns:
    FeatureReader for all content

    createReader

    protected FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createReader(Query query)
                                                                                                                         throws java.io.IOException
    GR: this method is called from inside getFeatureReader(Query ,Transaction ) to allow subclasses return an optimized FeatureReader wich supports the filter and attributes truncation specified in query

    A subclass that supports the creation of such an optimized FeatureReader shold override this method. Otherwise, it just returns getFeatureReader(typeName)

    Throws:
    java.io.IOException

    getUnsupportedFilter

    protected org.opengis.filter.Filter getUnsupportedFilter(org.opengis.filter.Filter filter)
    GR: if a subclass supports filtering, it should override this method to return the unsupported part of the passed filter, so a FilteringFeatureReader will be constructed upon it. Otherwise it will just return the same filter.

    If the complete filter is supported, the subclass must return Filter.INCLUDE


    writer

    public FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> writer(Transaction transaction)
                                                                                                                throws java.io.IOException
    Throws:
    java.io.IOException

    createWriter

    protected FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createWriter()
    Low level feature writer access.

    This is the only method you must implement to aquire content.

    Returns:
    Subclass must supply a FeatureWriter

    createAppend

    protected FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> createAppend(Transaction transaction)
                                                                                                                         throws java.io.IOException
    It would be great to kill this method, and add a "skipToEnd" method to featureWriter?

    Override this if you can provide a native optimization for this. (aka copy file, open the file in append mode, replace origional on close).

    Throws:
    java.io.IOException


    Copyright © 1996-2010 Geotools. All Rights Reserved.