Class AbstractDuckDBDataStoreFactory
- All Implemented Interfaces:
DataAccessFactory,DataStoreFactorySpi,Factory
- Direct Known Subclasses:
DuckDBDataStoreFactory
This factory provides the foundation for creating DataStore implementations that use DuckDB as their underlying database engine. It manages:
- Common parameter definition and handling
- DuckDB JDBC connection setup and configuration
- Extension management
- DataStore configuration (simplification, etc.)
Subclasses like GeoParquetDataStoreFactory extend this to provide format-specific implementation details while inheriting the common DuckDB handling code. This separation allows reuse of the DuckDB infrastructure across multiple datastore implementations.
DuckDB is an embedded analytical database that excels at reading and processing analytical data formats like Parquet, and includes excellent built-in support for spatial operations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataAccessFactory.Paramstatic final DataAccessFactory.Paramstatic final DataAccessFactory.Paramstatic final DataAccessFactory.ParamEnables usage of a simplification function, when the queries contain geometry simplification hints.Fields inherited from class JDBCDataStoreFactory
BATCH_INSERT_SIZE, CALLBACK_FACTORY, DATABASE, DATASOURCE, DBTYPE, EVICTOR_TESTS_PER_RUN, EXPOSE_PK, HOST, MAX_OPEN_PREPARED_STATEMENTS, MAXCONN, MAXWAIT, MIN_EVICTABLE_TIME, MINCONN, PASSWD, PK_METADATA_TABLE, PORT, SCHEMA, SQL_ON_BORROW, SQL_ON_RELEASE, TEST_WHILE_IDLE, TIME_BETWEEN_EVICTOR_RUNS, USER, VALIDATECONN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddDatabaseSpecificParameters(Map<String, Object> parameters) Allows subclasses to add their specific parametersprotected BasicDataSourcecreateDataSource(Map<String, ?> params, SQLDialect dialect) Called byJDBCDataStoreFactory.createDataStore(Map)to set up the JDCBDataSourceprotected JDBCDataStorecreateDataStoreInternal(JDBCDataStore dataStore, Map<String, ?> params) Subclass hook to do additional initialization of a newly created datastore.protected final StringReturns the fully qualified class name of the jdbc driver.protected abstract StringgetJDBCUrl(Map<String, ?> params) Builds up the JDBC url in a jdbc::// : / Override if you need a different setup protected StringOverride this to return a good validation query (a very quick one, such as one that asks the database what time is it) or return null if the factory does not support validation.protected abstract JDBCDataStoresetupDataStore(JDBCDataStore dataStore, Map<String, ?> params) Allows subclasses to perform additional setup for their specific datastoresprotected voidsetupParameters(Map<String, Object> parameters) Sets up the database connection parameters.Methods inherited from class JDBCDataStoreFactory
canProcess, checkDBType, checkDBType, createDataSource, createDataStore, createNewDataStore, createSQLDialect, createSQLDialect, getDatabaseID, getDisplayName, getImplementationHints, getParametersInfo, isAvailableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataAccessFactory
canProcess, getDescription, getDisplayName, getParametersInfo, isAvailableMethods inherited from interface DataStoreFactorySpi
createDataStore, createNewDataStoreMethods inherited from interface Factory
getImplementationHints
-
Field Details
-
NAMESPACE
-
FETCHSIZE
-
SCREENMAP
-
SIMPLIFY
Enables usage of a simplification function, when the queries contain geometry simplification hints. The simplification function used depends on SIMPLIFICATION_METHOD setting, and is ST_Simplify by default.
-
-
Constructor Details
-
AbstractDuckDBDataStoreFactory
public AbstractDuckDBDataStoreFactory()
-
-
Method Details
-
addDatabaseSpecificParameters
Allows subclasses to add their specific parameters -
getJDBCUrl
Description copied from class:JDBCDataStoreFactoryBuilds up the JDBC url in a jdbc::// : / Override if you need a different setup - Overrides:
getJDBCUrlin classJDBCDataStoreFactory- Throws:
IOException
-
setupDataStore
protected abstract JDBCDataStore setupDataStore(JDBCDataStore dataStore, Map<String, ?> params) throws IOExceptionAllows subclasses to perform additional setup for their specific datastores- Throws:
IOException
-
setupParameters
Description copied from class:JDBCDataStoreFactorySets up the database connection parameters.Subclasses may extend, but should not override. This implementation registers the following parameters.
Subclass implementation may remove any parameters from the map, or may overrwrite any parameters in the map.- Overrides:
setupParametersin classJDBCDataStoreFactory- Parameters:
parameters- Map ofDataAccessFactory.Paramobjects.
-
getDriverClassName
Description copied from class:JDBCDataStoreFactoryReturns the fully qualified class name of the jdbc driver.For example: org.postgresql.Driver
- Specified by:
getDriverClassNamein classJDBCDataStoreFactory
-
createDataSource
protected BasicDataSource createDataSource(Map<String, ?> params, SQLDialect dialect) throws IOExceptionCalled byJDBCDataStoreFactory.createDataStore(Map)to set up the JDCBDataSource- Overrides:
createDataSourcein classJDBCDataStoreFactory- Parameters:
params- the connection parametersdialect- theDuckDBDialectfromJDBCDataStoreFactory.createSQLDialect(JDBCDataStore, Map)- Throws:
IOException
-
createDataStoreInternal
protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map<String, ?> params) throws IOExceptionDescription copied from class:JDBCDataStoreFactorySubclass hook to do additional initialization of a newly created datastore.Typically subclasses will want to override this method in the case where they provide additional datastore parameters, those should be processed here.
This method is provided with an instance of the datastore. In some cases subclasses may wish to create a new instance of the datastore, for instance in order to wrap the original instance. This is supported but the new datastore must be returned from this method. If not is such the case this method should still return the original passed in.
- Overrides:
createDataStoreInternalin classJDBCDataStoreFactory- Parameters:
dataStore- The newly created datastore.params- THe datastore parameters.- Throws:
IOException
-
getValidationQuery
Description copied from class:JDBCDataStoreFactoryOverride this to return a good validation query (a very quick one, such as one that asks the database what time is it) or return null if the factory does not support validation.- Specified by:
getValidationQueryin classJDBCDataStoreFactory
-