mil.nga.geopackage.extension.SchemaExtension Java Examples

The following examples show how to use mil.nga.geopackage.extension.SchemaExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoPackageCoreImpl.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean createDataColumnConstraintsTable() {
	verifyWritable();

	boolean created = false;
	DataColumnConstraintsDao dao = getDataColumnConstraintsDao();
	try {
		if (!dao.isTableExists()) {
			created = tableCreator.createDataColumnConstraints() > 0;
			if (created) {
				// Create the schema extension record
				SchemaExtension schemaExtension = new SchemaExtension(this);
				schemaExtension.getOrCreate();
			}
		}
	} catch (SQLException e) {
		throw new GeoPackageException("Failed to check if "
				+ DataColumnConstraints.class.getSimpleName()
				+ " table exists and create it", e);
	}
	return created;
}
 
Example #2
Source File: GeoPackageExample.java    From geopackage-android with MIT License 5 votes vote down vote up
private void validateExtensions(GeoPackage geoPackage, boolean has)
        throws SQLException {

    ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();

    TestCase.assertEquals(has && RTREE_SPATIAL_INDEX,
            new RTreeIndexExtension(geoPackage).has());
    TestCase.assertEquals(
            has
                    && (RELATED_TABLES_FEATURES || RELATED_TABLES_MEDIA || RELATED_TABLES_SIMPLE_ATTRIBUTES),
            new RelatedTablesExtension(geoPackage).has());
    TestCase.assertEquals(
            has && COVERAGE_DATA,
            extensionsDao.isTableExists()
                    && !extensionsDao.queryByExtension(
                    CoverageData.EXTENSION_NAME).isEmpty());

    TestCase.assertEquals(has && SCHEMA,
            new SchemaExtension(geoPackage).has());
    TestCase.assertEquals(has && METADATA,
            new MetadataExtension(geoPackage).has());
    TestCase.assertEquals(
            has && NON_LINEAR_GEOMETRY_TYPES,
            extensionsDao.isTableExists()
                    && !extensionsDao
                    .queryByExtension(
                            GeometryExtensions
                                    .getExtensionName(GeometryType.CIRCULARSTRING))
                    .isEmpty());
    TestCase.assertEquals(has && WEBP, extensionsDao.isTableExists()
            && !extensionsDao
            .queryByExtension(WebPExtension.EXTENSION_NAME)
            .isEmpty());
    TestCase.assertEquals(has && CRS_WKT,
            new CrsWktExtension(geoPackage).has());

}
 
Example #3
Source File: GeoPackageExample.java    From geopackage-java with MIT License 5 votes vote down vote up
private void validateExtensions(GeoPackage geoPackage, boolean has)
		throws SQLException {

	ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();

	TestCase.assertEquals(has && RTREE_SPATIAL_INDEX,
			new RTreeIndexExtension(geoPackage).has());
	TestCase.assertEquals(
			has && (RELATED_TABLES_FEATURES || RELATED_TABLES_MEDIA
					|| RELATED_TABLES_SIMPLE_ATTRIBUTES),
			new RelatedTablesExtension(geoPackage).has());
	TestCase.assertEquals(has && COVERAGE_DATA,
			extensionsDao.isTableExists() && !extensionsDao
					.queryByExtension(CoverageData.EXTENSION_NAME)
					.isEmpty());
	TestCase.assertEquals(has && SCHEMA,
			new SchemaExtension(geoPackage).has());
	TestCase.assertEquals(has && METADATA,
			new MetadataExtension(geoPackage).has());
	TestCase.assertEquals(has && NON_LINEAR_GEOMETRY_TYPES,
			extensionsDao.isTableExists() && !extensionsDao
					.queryByExtension(GeometryExtensions
							.getExtensionName(GeometryType.CIRCULARSTRING))
					.isEmpty());
	TestCase.assertEquals(has && WEBP,
			extensionsDao.isTableExists() && !extensionsDao
					.queryByExtension(WebPExtension.EXTENSION_NAME)
					.isEmpty());
	TestCase.assertEquals(has && CRS_WKT,
			new CrsWktExtension(geoPackage).has());

}