Package org.goplanit.geoio.util
Class GeoIODataStoreManager
- java.lang.Object
-
- org.goplanit.geoio.util.GeoIODataStoreManager
-
public final class GeoIODataStoreManager extends Object
Utility class that manages data store connections and related functionality
-
-
Constructor Summary
Constructors Constructor Description GeoIODataStoreManager()
-
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 itstatic 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 itstatic 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 itprotected static org.geotools.data.DataStore
createDataStore(Path outputFileNameWithPath)
Create a datastore for the given file locationstatic 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 availablestatic void
reset()
Reset the manager and remove any registered data stores
-
-
-
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 persistsgeometryTypeClass
- 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 persistsmode
- 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 persistsoutputFileNameWithPath
- 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 persistsgeometryTypeClass
- for the reference classoutputFileNameWithPath
- 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 persistsmode
- for the reference classoutputFileNameWithPath
- 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 onfeature
- feature to register
-
-