Package mil.nga.geopackage
Class GeoPackageCoreImpl
- java.lang.Object
-
- mil.nga.geopackage.GeoPackageCoreImpl
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,GeoPackageCore
public abstract class GeoPackageCoreImpl extends Object implements GeoPackageCore
A single GeoPackage database connection implementation- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
writable
Writable GeoPackage flag
-
Constructor Summary
Constructors Modifier Constructor Description protected
GeoPackageCoreImpl(String name, String path, GeoPackageCoreConnection database)
Constructorprotected
GeoPackageCoreImpl(String name, String path, GeoPackageCoreConnection database, boolean writable)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
callInTransaction(Callable<T> callable)
Execute theCallable
class inside an ORMLite transactionvoid
close()
Close the GeoPackage connectionprotected void
copyAttributeTable(String tableName, String newTableName, boolean transferContent)
Copy the attribute tableprotected Contents
copyContents(String tableName, String newTableName)
Copy the contentsprotected void
copyFeatureTable(String tableName, String newTableName, boolean transferContent)
Copy the feature tablevoid
copyTable(String tableName, String newTableName)
Copy the table with transferred contents and extensionsprotected void
copyTable(String tableName, String newTableName, boolean transferContent, boolean extensions)
Copy the tablevoid
copyTableAsEmpty(String tableName, String newTableName)
Copy the table but leave the user table empty and without extensionsvoid
copyTableNoExtensions(String tableName, String newTableName)
Copy the table with transferred contents but no extensionsprotected void
copyTileTable(String tableName, String newTableName, boolean transferContent)
Copy the tile tableprotected Contents
copyUserTable(String tableName, String newTableName, boolean transferContent)
Copy the user tableprotected Contents
copyUserTable(String tableName, String newTableName, boolean transferContent, boolean validateContents)
Copy the user tablevoid
createAttributesTable(AttributesTable table)
Create a new attributes tableAttributesTable
createAttributesTable(AttributesTableMetadata metadata)
Create a new attributes table with GeoPackage metadata including: user attributes table and contents row.<D extends GeoPackageDao<T,?>,T>
DcreateDao(Class<T> type)
Create a daoboolean
createExtensionsTable()
Create the Extensions table if it does not already existvoid
createFeatureTable(FeatureTable table)
Create a new feature tableFeatureTable
createFeatureTable(FeatureTableMetadata metadata)
Create a new feature table with GeoPackage metadata including: geometry columns table and row, user feature table, and contents row.boolean
createGeometryColumnsTable()
Create the Geometry Columns table if it does not already existboolean
createTileMatrixSetTable()
Create the Tile Matrix Set table if it does not already existboolean
createTileMatrixTable()
Create the Tile Matrix table if it does not already existvoid
createTileTable(TileTable table)
Create a new tile tableTileTable
createTileTable(TileTableMetadata metadata)
Create a new tile table with GeoPackage metadata including: tile matrix set table and row, tile matrix table, user tile table, and contents row.void
createUserTable(UserTable<? extends UserColumn> table)
Create a new user tablevoid
deleteTable(String table)
Delete the user table (a feature or tile table) and all GeoPackage metadatavoid
deleteTableQuietly(String tableName)
Attempt to delete the user table (a feature or tile table) and all GeoPackage metadata quietlyvoid
dropTable(String table)
Drop the table if it exists.void
dropView(String view)
Drop the view if it exists.boolean
enableForeignKeys()
If foreign keys is disabled and there are no foreign key violations, enables foreign key checks, else logs violationsvoid
endAndBeginTransaction()
End a transaction as successful and begin a new transactionvoid
endTransaction()
End a transaction successfullyvoid
failTransaction()
Fail a transactionboolean
foreignKeys()
Query for the foreign keys valueboolean
foreignKeys(boolean on)
Change the foreign keys stateString
getApplicationId()
Get the application idString
getApplicationIdHex()
Get the application id as a hex string prefixed with 0xInteger
getApplicationIdInteger()
Get the application id integerList<String>
getAttributesTables()
Get the attributes tablesBoundingBox
getBoundingBox(String table)
Get the bounding box for the table in the table's projection, including contents and table metadataBoundingBox
getBoundingBox(String table, boolean manual)
Get the bounding box for the table in the table's projection, including contents, table metadata, and manual queries if enabledBoundingBox
getBoundingBox(Projection projection)
Get the bounding box for all tables in the provided projection, including contents and table metadataBoundingBox
getBoundingBox(Projection projection, boolean manual)
Get the bounding box for all tables in the provided projection, including contents, table metadata, and manual queries if enabledBoundingBox
getBoundingBox(Projection projection, String table)
Get the bounding box for the table in the provided projection, including contents and table metadataBoundingBox
getBoundingBox(Projection projection, String table, boolean manual)
Get the bounding box for the table in the provided projection, including contents, table metadata, and manual queries if enabledBoundingBox
getContentsBoundingBox(String table)
Get the bounding box from the contents for the table in the table's projectionBoundingBox
getContentsBoundingBox(Projection projection)
Get the bounding box for all table contents in the provided projectionBoundingBox
getContentsBoundingBox(Projection projection, String table)
Get the bounding box from the contents for the table in the provided projectionContentsDao
getContentsDao()
Get a Contents DAOProjection
getContentsProjection(String table)
Get the projection of the table contentsGeoPackageCoreConnection
getDatabase()
Get the SQLite databaseExtensionManager
getExtensionManager()
Get an extension manager on the GeoPackageExtensionsDao
getExtensionsDao()
Get an Extensions DAOList<String>
getFeatureTables()
Get the feature tablesGeometryColumnsDao
getGeometryColumnsDao()
Get a Geometry Columns DAOString
getName()
Get the GeoPackage nameString
getPath()
Get the GeoPackage pathProjection
getProjection(String table)
Get the projection of the tableSpatialReferenceSystemDao
getSpatialReferenceSystemDao()
Get a Spatial Reference System DAOBoundingBox
getTableBoundingBox(String table)
Get the bounding box for the table in the table's projection, using only table metadataBoundingBox
getTableBoundingBox(String table, boolean manual)
Get the bounding box for the table in the table's projection, using only table metadata and manual queries if enabledBoundingBox
getTableBoundingBox(Projection projection)
Get the bounding box for all tables in the provided projection, using only table metadataBoundingBox
getTableBoundingBox(Projection projection, boolean manual)
Get the bounding box for all tables in the provided projection, using only table metadata and manual queries if enabledBoundingBox
getTableBoundingBox(Projection projection, String table)
Get the bounding box for the table in the provided projection, using only table metadataBoundingBox
getTableBoundingBox(Projection projection, String table, boolean manual)
Get the bounding box for the table in the provided projection, using only table metadata and manual queries if enabledContents
getTableContents(String table)
Get the contents of the user tableContentsDataType
getTableCoreDataType(String table)
Get the data type of the user table only if it is a core data type (features, tiles, attributes)GeoPackageTableCreator
getTableCreator()
Get the Table CreatorContentsDataType
getTableDataType(String table)
Get the contents data type of the user tableList<String>
getTables()
Get all tablesList<String>
getTables(String type)
Get the tables for the contents data typeList<String>
getTables(String... types)
Get the tables for the contents data typesList<String>
getTables(ContentsDataType type)
Get the tables for the contents data typeList<String>
getTables(ContentsDataType... types)
Get the tables for the contents data typesString
getTableType(String table)
Get the contents data type of the user tableTileMatrixDao
getTileMatrixDao()
Get a Tile Matrix DAOTileMatrixSetDao
getTileMatrixSetDao()
Get a Tile Matrix Set DAOList<String>
getTileTables()
Get the tile tablesList<Contents>
getTypeContents(String type)
Get the contents for the data typeList<Contents>
getTypeContents(String... types)
Get the contents for the data typesList<Contents>
getTypeContents(ContentsDataType type)
Get the contents for the data typeList<Contents>
getTypeContents(ContentsDataType... types)
Get the contents for the data typesInteger
getUserVersion()
Get the user versionInteger
getUserVersionMajor()
Get the major user versionInteger
getUserVersionMinor()
Get the minor user versionInteger
getUserVersionPatch()
Get the patch user versionboolean
isAttributeTable(String table)
Check if the table is an attribute tableboolean
isContentsTable(String table)
Check if the table exists as a user contents tableboolean
isFeatureTable(String table)
Check if the table is a feature tableboolean
isTable(String table)
Check if the table existsboolean
isTableCoreDataType(String table)
Determine if the user table is one of the core data types (features, tiles, attributes)boolean
isTableOrView(String name)
Check if the table or view existsboolean
isTableType(String table, String type)
Check if the table is the provided typeboolean
isTableType(String table, String... types)
Check if the table is one of the provided typesboolean
isTableType(String table, ContentsDataType type)
Check if the table is the provided typeboolean
isTableType(String table, ContentsDataType... types)
Check if the table is one of the provided typesboolean
isTileTable(String table)
Check if the table is a tile tableboolean
isView(String view)
Check if the view existsboolean
isWritable()
Is the GeoPackage writablevoid
renameTable(String tableName, String newTableName)
Rename the tablevoid
saveSchema(UserTable<? extends UserColumn> table)
Save the table schema using theSchemaExtension
void
vacuum()
Rebuild the GeoPackage, repacking it into a minimal amount of disk spacevoid
verifyWritable()
Verify the GeoPackage is writable and throw an exception if it is not-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface mil.nga.geopackage.GeoPackageCore
beginTransaction, commit, endTransaction, execSQL, getFeatureBoundingBox, inTransaction
-
-
-
-
Constructor Detail
-
GeoPackageCoreImpl
protected GeoPackageCoreImpl(String name, String path, GeoPackageCoreConnection database)
Constructor- Parameters:
name
- namepath
- pathdatabase
- database- Since:
- 4.0.0
-
GeoPackageCoreImpl
protected GeoPackageCoreImpl(String name, String path, GeoPackageCoreConnection database, boolean writable)
Constructor- Parameters:
name
- namepath
- pathdatabase
- databasewritable
- true if writable- Since:
- 4.0.0
-
-
Method Detail
-
close
public void close()
Close the GeoPackage connection- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceGeoPackageCore
-
getName
public String getName()
Get the GeoPackage name- Specified by:
getName
in interfaceGeoPackageCore
- Returns:
- name
-
getPath
public String getPath()
Get the GeoPackage path- Specified by:
getPath
in interfaceGeoPackageCore
- Returns:
- path
-
getDatabase
public GeoPackageCoreConnection getDatabase()
Get the SQLite database- Specified by:
getDatabase
in interfaceGeoPackageCore
- Returns:
- connection
-
getTableCreator
public GeoPackageTableCreator getTableCreator()
Get the Table Creator- Specified by:
getTableCreator
in interfaceGeoPackageCore
- Returns:
- table creator
-
isWritable
public boolean isWritable()
Is the GeoPackage writable- Specified by:
isWritable
in interfaceGeoPackageCore
- Returns:
- true if writable
-
getApplicationId
public String getApplicationId()
Get the application id- Specified by:
getApplicationId
in interfaceGeoPackageCore
- Returns:
- application id
-
getApplicationIdInteger
public Integer getApplicationIdInteger()
Get the application id integer- Specified by:
getApplicationIdInteger
in interfaceGeoPackageCore
- Returns:
- application id integer
-
getApplicationIdHex
public String getApplicationIdHex()
Get the application id as a hex string prefixed with 0x- Specified by:
getApplicationIdHex
in interfaceGeoPackageCore
- Returns:
- application id hex string
-
getUserVersion
public Integer getUserVersion()
Get the user version- Specified by:
getUserVersion
in interfaceGeoPackageCore
- Returns:
- user version
-
getUserVersionMajor
public Integer getUserVersionMajor()
Get the major user version- Specified by:
getUserVersionMajor
in interfaceGeoPackageCore
- Returns:
- major user version
-
getUserVersionMinor
public Integer getUserVersionMinor()
Get the minor user version- Specified by:
getUserVersionMinor
in interfaceGeoPackageCore
- Returns:
- minor user version
-
getUserVersionPatch
public Integer getUserVersionPatch()
Get the patch user version- Specified by:
getUserVersionPatch
in interfaceGeoPackageCore
- Returns:
- patch user version
-
getFeatureTables
public List<String> getFeatureTables()
Get the feature tables- Specified by:
getFeatureTables
in interfaceGeoPackageCore
- Returns:
- table names
-
getTileTables
public List<String> getTileTables()
Get the tile tables- Specified by:
getTileTables
in interfaceGeoPackageCore
- Returns:
- table names
-
getAttributesTables
public List<String> getAttributesTables()
Get the attributes tables- Specified by:
getAttributesTables
in interfaceGeoPackageCore
- Returns:
- table name
-
getTables
public List<String> getTables(ContentsDataType type)
Get the tables for the contents data type- Specified by:
getTables
in interfaceGeoPackageCore
- Parameters:
type
- data type- Returns:
- table names
-
getTables
public List<String> getTables(ContentsDataType... types)
Get the tables for the contents data types- Specified by:
getTables
in interfaceGeoPackageCore
- Parameters:
types
- data types- Returns:
- table names
-
getTables
public List<String> getTables(String type)
Get the tables for the contents data type- Specified by:
getTables
in interfaceGeoPackageCore
- Parameters:
type
- data type- Returns:
- table names
-
getTables
public List<String> getTables(String... types)
Get the tables for the contents data types- Specified by:
getTables
in interfaceGeoPackageCore
- Parameters:
types
- data types- Returns:
- table names
-
getTypeContents
public List<Contents> getTypeContents(ContentsDataType type)
Get the contents for the data type- Specified by:
getTypeContents
in interfaceGeoPackageCore
- Parameters:
type
- data type- Returns:
- contents
-
getTypeContents
public List<Contents> getTypeContents(ContentsDataType... types)
Get the contents for the data types- Specified by:
getTypeContents
in interfaceGeoPackageCore
- Parameters:
types
- data types- Returns:
- contents
-
getTypeContents
public List<Contents> getTypeContents(String type)
Get the contents for the data type- Specified by:
getTypeContents
in interfaceGeoPackageCore
- Parameters:
type
- data type- Returns:
- contents
-
getTypeContents
public List<Contents> getTypeContents(String... types)
Get the contents for the data types- Specified by:
getTypeContents
in interfaceGeoPackageCore
- Parameters:
types
- data types- Returns:
- contents
-
getTables
public List<String> getTables()
Get all tables- Specified by:
getTables
in interfaceGeoPackageCore
- Returns:
- table names
-
isFeatureTable
public boolean isFeatureTable(String table)
Check if the table is a feature table- Specified by:
isFeatureTable
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if a feature table
-
isTileTable
public boolean isTileTable(String table)
Check if the table is a tile table- Specified by:
isTileTable
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if a tile table
-
isAttributeTable
public boolean isAttributeTable(String table)
Check if the table is an attribute table- Specified by:
isAttributeTable
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if an attribute table
-
isTableType
public boolean isTableType(String table, ContentsDataType type)
Check if the table is the provided type- Specified by:
isTableType
in interfaceGeoPackageCore
- Parameters:
table
- table nametype
- data type- Returns:
- true if the type of table
-
isTableType
public boolean isTableType(String table, ContentsDataType... types)
Check if the table is one of the provided types- Specified by:
isTableType
in interfaceGeoPackageCore
- Parameters:
table
- table nametypes
- data types- Returns:
- true if the type of table
-
isTableType
public boolean isTableType(String table, String type)
Check if the table is the provided type- Specified by:
isTableType
in interfaceGeoPackageCore
- Parameters:
table
- table nametype
- data type- Returns:
- true if the type of table
-
isTableType
public boolean isTableType(String table, String... types)
Check if the table is one of the provided types- Specified by:
isTableType
in interfaceGeoPackageCore
- Parameters:
table
- table nametypes
- data types- Returns:
- true if the type of table
-
isContentsTable
public boolean isContentsTable(String table)
Check if the table exists as a user contents table- Specified by:
isContentsTable
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if a user contents table
-
isTable
public boolean isTable(String table)
Check if the table exists- Specified by:
isTable
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if a table
-
isView
public boolean isView(String view)
Check if the view exists- Specified by:
isView
in interfaceGeoPackageCore
- Parameters:
view
- view name- Returns:
- true if a view
-
isTableOrView
public boolean isTableOrView(String name)
Check if the table or view exists- Specified by:
isTableOrView
in interfaceGeoPackageCore
- Parameters:
name
- table or view name- Returns:
- true if a table or view
-
getTableContents
public Contents getTableContents(String table)
Get the contents of the user table- Specified by:
getTableContents
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- contents
-
getTableType
public String getTableType(String table)
Get the contents data type of the user table- Specified by:
getTableType
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- table type
-
getTableDataType
public ContentsDataType getTableDataType(String table)
Get the contents data type of the user table- Specified by:
getTableDataType
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- table type or null if not an enumerated type
-
getTableCoreDataType
public ContentsDataType getTableCoreDataType(String table)
Get the data type of the user table only if it is a core data type (features, tiles, attributes)- Specified by:
getTableCoreDataType
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- core data type or null
-
isTableCoreDataType
public boolean isTableCoreDataType(String table)
Determine if the user table is one of the core data types (features, tiles, attributes)- Specified by:
isTableCoreDataType
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- true if a core data type
-
getContentsBoundingBox
public BoundingBox getContentsBoundingBox(Projection projection)
Get the bounding box for all table contents in the provided projection- Specified by:
getContentsBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projection- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(Projection projection)
Get the bounding box for all tables in the provided projection, including contents and table metadata- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projection- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(Projection projection, boolean manual)
Get the bounding box for all tables in the provided projection, including contents, table metadata, and manual queries if enabled- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectionmanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(Projection projection)
Get the bounding box for all tables in the provided projection, using only table metadata- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projection- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(Projection projection, boolean manual)
Get the bounding box for all tables in the provided projection, using only table metadata and manual queries if enabled- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectionmanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getContentsBoundingBox
public BoundingBox getContentsBoundingBox(String table)
Get the bounding box from the contents for the table in the table's projection- Specified by:
getContentsBoundingBox
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- bounding box
-
getContentsBoundingBox
public BoundingBox getContentsBoundingBox(Projection projection, String table)
Get the bounding box from the contents for the table in the provided projection- Specified by:
getContentsBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectiontable
- table name- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(String table)
Get the bounding box for the table in the table's projection, including contents and table metadata- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(Projection projection, String table)
Get the bounding box for the table in the provided projection, including contents and table metadata- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectiontable
- table name- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(String table, boolean manual)
Get the bounding box for the table in the table's projection, including contents, table metadata, and manual queries if enabled- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
table
- table namemanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getBoundingBox
public BoundingBox getBoundingBox(Projection projection, String table, boolean manual)
Get the bounding box for the table in the provided projection, including contents, table metadata, and manual queries if enabled- Specified by:
getBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectiontable
- table namemanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(String table)
Get the bounding box for the table in the table's projection, using only table metadata- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(Projection projection, String table)
Get the bounding box for the table in the provided projection, using only table metadata- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectiontable
- table name- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(String table, boolean manual)
Get the bounding box for the table in the table's projection, using only table metadata and manual queries if enabled- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
table
- table namemanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getTableBoundingBox
public BoundingBox getTableBoundingBox(Projection projection, String table, boolean manual)
Get the bounding box for the table in the provided projection, using only table metadata and manual queries if enabled- Specified by:
getTableBoundingBox
in interfaceGeoPackageCore
- Parameters:
projection
- desired bounding box projectiontable
- table namemanual
- manual query flag, true to determine missing bounds manually- Returns:
- bounding box
-
getContentsProjection
public Projection getContentsProjection(String table)
Get the projection of the table contents- Specified by:
getContentsProjection
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- projection
-
getProjection
public Projection getProjection(String table)
Get the projection of the table- Specified by:
getProjection
in interfaceGeoPackageCore
- Parameters:
table
- table name- Returns:
- projection
-
getSpatialReferenceSystemDao
public SpatialReferenceSystemDao getSpatialReferenceSystemDao()
Get a Spatial Reference System DAO- Specified by:
getSpatialReferenceSystemDao
in interfaceGeoPackageCore
- Returns:
- Spatial Reference System DAO
-
getContentsDao
public ContentsDao getContentsDao()
Get a Contents DAO- Specified by:
getContentsDao
in interfaceGeoPackageCore
- Returns:
- Contents DAO
-
getGeometryColumnsDao
public GeometryColumnsDao getGeometryColumnsDao()
Get a Geometry Columns DAO- Specified by:
getGeometryColumnsDao
in interfaceGeoPackageCore
- Returns:
- Geometry Columns DAO
-
createGeometryColumnsTable
public boolean createGeometryColumnsTable()
Create the Geometry Columns table if it does not already exist- Specified by:
createGeometryColumnsTable
in interfaceGeoPackageCore
- Returns:
- true if created
-
createFeatureTable
public void createFeatureTable(FeatureTable table)
Create a new feature tableWARNING: only creates the feature table, call
GeoPackageCore.createFeatureTable(FeatureTableMetadata)
) instead to create both the table and required GeoPackage metadata- Specified by:
createFeatureTable
in interfaceGeoPackageCore
- Parameters:
table
- feature table
-
createFeatureTable
public FeatureTable createFeatureTable(FeatureTableMetadata metadata)
Create a new feature table with GeoPackage metadata including: geometry columns table and row, user feature table, and contents row.- Specified by:
createFeatureTable
in interfaceGeoPackageCore
- Parameters:
metadata
- feature table metadata- Returns:
- feature table
-
getTileMatrixSetDao
public TileMatrixSetDao getTileMatrixSetDao()
Get a Tile Matrix Set DAO- Specified by:
getTileMatrixSetDao
in interfaceGeoPackageCore
- Returns:
- Tile Matrix Set DAO
-
createTileMatrixSetTable
public boolean createTileMatrixSetTable()
Create the Tile Matrix Set table if it does not already exist- Specified by:
createTileMatrixSetTable
in interfaceGeoPackageCore
- Returns:
- true if created
-
getTileMatrixDao
public TileMatrixDao getTileMatrixDao()
Get a Tile Matrix DAO- Specified by:
getTileMatrixDao
in interfaceGeoPackageCore
- Returns:
- Tile Matrix DAO
-
createTileMatrixTable
public boolean createTileMatrixTable()
Create the Tile Matrix table if it does not already exist- Specified by:
createTileMatrixTable
in interfaceGeoPackageCore
- Returns:
- true if created
-
createTileTable
public void createTileTable(TileTable table)
Create a new tile tableWARNING: only creates the tile table, call
GeoPackageCore.createTileTable(TileTableMetadata)
) instead to create both the table and required GeoPackage metadata- Specified by:
createTileTable
in interfaceGeoPackageCore
- Parameters:
table
- tile table
-
createTileTable
public TileTable createTileTable(TileTableMetadata metadata)
Create a new tile table with GeoPackage metadata including: tile matrix set table and row, tile matrix table, user tile table, and contents row.- Specified by:
createTileTable
in interfaceGeoPackageCore
- Parameters:
metadata
- tile table metadata- Returns:
- tile table
-
createAttributesTable
public void createAttributesTable(AttributesTable table)
Create a new attributes tableWARNING: only creates the attributes table, call
GeoPackageCore.createAttributesTable(AttributesTableMetadata)
) instead to create both the table and required GeoPackage metadata- Specified by:
createAttributesTable
in interfaceGeoPackageCore
- Parameters:
table
- attributes table
-
createAttributesTable
public AttributesTable createAttributesTable(AttributesTableMetadata metadata)
Create a new attributes table with GeoPackage metadata including: user attributes table and contents row.- Specified by:
createAttributesTable
in interfaceGeoPackageCore
- Parameters:
metadata
- attributes table metadata- Returns:
- attributes table
-
getExtensionsDao
public ExtensionsDao getExtensionsDao()
Get an Extensions DAO- Specified by:
getExtensionsDao
in interfaceGeoPackageCore
- Returns:
- Extensions DAO
-
createExtensionsTable
public boolean createExtensionsTable()
Create the Extensions table if it does not already exist- Specified by:
createExtensionsTable
in interfaceGeoPackageCore
- Returns:
- true if created
-
deleteTable
public void deleteTable(String table)
Delete the user table (a feature or tile table) and all GeoPackage metadata- Specified by:
deleteTable
in interfaceGeoPackageCore
- Parameters:
table
- table name
-
deleteTableQuietly
public void deleteTableQuietly(String tableName)
Attempt to delete the user table (a feature or tile table) and all GeoPackage metadata quietly- Specified by:
deleteTableQuietly
in interfaceGeoPackageCore
- Parameters:
tableName
- table name
-
createDao
public <D extends GeoPackageDao<T,?>,T> D createDao(Class<T> type)
Create a dao- Specified by:
createDao
in interfaceGeoPackageCore
- Type Parameters:
D
- dao typeT
- class type- Parameters:
type
- dao class type- Returns:
- base dao implementation
-
endTransaction
public void endTransaction()
End a transaction successfully- Specified by:
endTransaction
in interfaceGeoPackageCore
-
failTransaction
public void failTransaction()
Fail a transaction- Specified by:
failTransaction
in interfaceGeoPackageCore
-
endAndBeginTransaction
public void endAndBeginTransaction()
End a transaction as successful and begin a new transaction- Specified by:
endAndBeginTransaction
in interfaceGeoPackageCore
-
callInTransaction
public <T> T callInTransaction(Callable<T> callable) throws SQLException
Execute theCallable
class inside an ORMLite transaction- Specified by:
callInTransaction
in interfaceGeoPackageCore
- Type Parameters:
T
- callable type- Parameters:
callable
- Callable to execute inside of the transaction.- Returns:
- The object returned by the callable.
- Throws:
SQLException
- upon transaction error
-
enableForeignKeys
public boolean enableForeignKeys()
If foreign keys is disabled and there are no foreign key violations, enables foreign key checks, else logs violations- Specified by:
enableForeignKeys
in interfaceGeoPackageCore
- Returns:
- true if enabled or already enabled, false if foreign key violations and not enabled
-
foreignKeys
public boolean foreignKeys()
Query for the foreign keys value- Specified by:
foreignKeys
in interfaceGeoPackageCore
- Returns:
- true if enabled, false if disabled
-
foreignKeys
public boolean foreignKeys(boolean on)
Change the foreign keys state- Specified by:
foreignKeys
in interfaceGeoPackageCore
- Parameters:
on
- true to turn on, false to turn off- Returns:
- previous foreign keys value
-
verifyWritable
public void verifyWritable()
Verify the GeoPackage is writable and throw an exception if it is not- Specified by:
verifyWritable
in interfaceGeoPackageCore
-
dropTable
public void dropTable(String table)
Drop the table if it exists. Drops the table with the table name, not limited to GeoPackage specific tables.- Specified by:
dropTable
in interfaceGeoPackageCore
- Parameters:
table
- table name
-
dropView
public void dropView(String view)
Drop the view if it exists. Drops the view with the view name, not limited to GeoPackage specific tables.- Specified by:
dropView
in interfaceGeoPackageCore
- Parameters:
view
- view name
-
renameTable
public void renameTable(String tableName, String newTableName)
Rename the table- Specified by:
renameTable
in interfaceGeoPackageCore
- Parameters:
tableName
- table namenewTableName
- new table name
-
copyTable
public void copyTable(String tableName, String newTableName)
Copy the table with transferred contents and extensions- Specified by:
copyTable
in interfaceGeoPackageCore
- Parameters:
tableName
- table namenewTableName
- new table name
-
copyTableNoExtensions
public void copyTableNoExtensions(String tableName, String newTableName)
Copy the table with transferred contents but no extensions- Specified by:
copyTableNoExtensions
in interfaceGeoPackageCore
- Parameters:
tableName
- table namenewTableName
- new table name
-
copyTableAsEmpty
public void copyTableAsEmpty(String tableName, String newTableName)
Copy the table but leave the user table empty and without extensions- Specified by:
copyTableAsEmpty
in interfaceGeoPackageCore
- Parameters:
tableName
- table namenewTableName
- new table name
-
copyTable
protected void copyTable(String tableName, String newTableName, boolean transferContent, boolean extensions)
Copy the table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer content flagextensions
- extensions copy flag
-
copyAttributeTable
protected void copyAttributeTable(String tableName, String newTableName, boolean transferContent)
Copy the attribute table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer content flag- Since:
- 3.3.0
-
copyFeatureTable
protected void copyFeatureTable(String tableName, String newTableName, boolean transferContent)
Copy the feature table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer content flag- Since:
- 3.3.0
-
copyTileTable
protected void copyTileTable(String tableName, String newTableName, boolean transferContent)
Copy the tile table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer content flag- Since:
- 3.3.0
-
copyUserTable
protected Contents copyUserTable(String tableName, String newTableName, boolean transferContent)
Copy the user table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer user table content flag- Returns:
- copied contents
- Since:
- 3.3.0
-
copyUserTable
protected Contents copyUserTable(String tableName, String newTableName, boolean transferContent, boolean validateContents)
Copy the user table- Parameters:
tableName
- table namenewTableName
- new table nametransferContent
- transfer user table content flagvalidateContents
- true to validate a contents was copied- Returns:
- copied contents
- Since:
- 3.3.0
-
copyContents
protected Contents copyContents(String tableName, String newTableName)
Copy the contents- Parameters:
tableName
- table namenewTableName
- new table name- Returns:
- copied contents
- Since:
- 3.3.0
-
vacuum
public void vacuum()
Rebuild the GeoPackage, repacking it into a minimal amount of disk space- Specified by:
vacuum
in interfaceGeoPackageCore
-
getExtensionManager
public ExtensionManager getExtensionManager()
Get an extension manager on the GeoPackage- Specified by:
getExtensionManager
in interfaceGeoPackageCore
- Returns:
- extension manager
-
createUserTable
public void createUserTable(UserTable<? extends UserColumn> table)
Create a new user table- Specified by:
createUserTable
in interfaceGeoPackageCore
- Parameters:
table
- user table
-
saveSchema
public void saveSchema(UserTable<? extends UserColumn> table)
Save the table schema using theSchemaExtension
- Specified by:
saveSchema
in interfaceGeoPackageCore
- Parameters:
table
- user table
-
-