Class GeoIODataStoreManager


  • public final class GeoIODataStoreManager
    extends Object
    Utility class that manages data store connections and related functionality
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass, Class<? extends org.locationtech.jts.geom.Geometry> geometryTypeClass, Path outputFileNameWithPath)
      For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
      static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass, Path outputFileNameWithPath)
      For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
      static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass, Mode mode, Path outputFileNameWithPath)
      For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
      protected static org.geotools.data.DataStore createDataStore​(Path outputFileNameWithPath)
      Create a datastore for the given file location
      static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass)
      Collect a registered datastore for a given PLANit entity class (for which only a single geometry type exists), if not available null is returned.
      static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass, Class<? extends org.locationtech.jts.geom.Geometry> geometryTypeClass)
      Collect a registered datastore for a given PLANit entity class and geometry type (in case multiple geometry types require multiple stores with one store per type), if not available null is returned.
      static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass, Mode mode)
      Collect a registered datastore for a given PLANit entity class and mode (in case multiple modes require multiple stores with one store per type), if not available null is returned.
      static void registerFeatureOnDataStore​(org.geotools.data.DataStore dataStore, org.opengis.feature.simple.SimpleFeatureType feature)
      Given a feature, register it on the datastore if not already available
      static void reset()
      Reset the manager and remove any registered data stores
    • Constructor Detail

      • GeoIODataStoreManager

        public GeoIODataStoreManager()
    • Method Detail

      • createDataStore

        protected static org.geotools.data.DataStore createDataStore​(Path outputFileNameWithPath)
        Create a datastore for the given file location
        Parameters:
        outputFileNameWithPath - to use
        Returns:
        data store created, null if not possible
      • getDataStore

        public static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass)
        Collect a registered datastore for a given PLANit entity class (for which only a single geometry type exists), if not available null is returned.
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        Returns:
        the datastore
      • getDataStore

        public static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass,
                                                               Class<? extends org.locationtech.jts.geom.Geometry> geometryTypeClass)
        Collect a registered datastore for a given PLANit entity class and geometry type (in case multiple geometry types require multiple stores with one store per type), if not available null is returned.
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        geometryTypeClass - for the reference class
        Returns:
        the datastore
      • getDataStore

        public static org.geotools.data.DataStore getDataStore​(Class<?> dataStoreReferenceClass,
                                                               Mode mode)
        Collect a registered datastore for a given PLANit entity class and mode (in case multiple modes require multiple stores with one store per type), if not available null is returned.
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        mode - for the reference class
        Returns:
        the datastore
      • createDataStore

        public static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass,
                                                                  Path outputFileNameWithPath)
        For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        outputFileNameWithPath - the output file path to persist to
        Returns:
        the datastore
      • createDataStore

        public static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass,
                                                                  Class<? extends org.locationtech.jts.geom.Geometry> geometryTypeClass,
                                                                  Path outputFileNameWithPath)
        For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        geometryTypeClass - for the reference class
        outputFileNameWithPath - the output file path to persist to
        Returns:
        the datastore
      • createDataStore

        public static org.geotools.data.DataStore createDataStore​(Class<?> dataStoreReferenceClass,
                                                                  Mode mode,
                                                                  Path outputFileNameWithPath)
        For a given PLANit entity that we persist to file, we track its datastore here to avoid overhead of recreating it
        Parameters:
        dataStoreReferenceClass - the reference class, i.e., PLANit entity types the datastore persists
        mode - for the reference class
        outputFileNameWithPath - the output file path to persist to
        Returns:
        the datastore
      • reset

        public static void reset()
        Reset the manager and remove any registered data stores
      • registerFeatureOnDataStore

        public static void registerFeatureOnDataStore​(org.geotools.data.DataStore dataStore,
                                                      org.opengis.feature.simple.SimpleFeatureType feature)
        Given a feature, register it on the datastore if not already available
        Parameters:
        dataStore - to register on
        feature - feature to register