@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { Throwables.propagate(e); } finally { metadata.close(); geopackage.close(); } }
@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { throw new RuntimeException(e); } finally { metadata.close(); geopackage.close(); } }
@Override protected void runInternal(GeogigCLI cli) throws IOException { File databaseFile = new File(commonArgs.database); Preconditions.checkArgument(databaseFile.exists(), "Database file not found."); final GeoPackage geopackage = new GeoPackage(databaseFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { metadata = new GeopkgGeogigMetadata(connection); super.runInternal(cli); } catch (SQLException e) { throw new RuntimeException(e); } finally { metadata.close(); geopackage.close(); } }
public void createFIDMappingTable(ConcurrentMap<String, String> fidMappings, String targetTableName) throws IOException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createFidMappingTable(targetTableName, fidMappings); } } catch (SQLException e) { throw new RuntimeException(e); } } finally { geopackage.close(); } }
public void createFIDMappingTable(ConcurrentMap<String, String> fidMappings, String targetTableName) throws IOException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); try { final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createFidMappingTable(targetTableName, fidMappings); } } catch (SQLException e) { throw Throwables.propagate(e); } } finally { geopackage.close(); } }
public void createChangeLog(final String targetTableName, Map<String, ChangeType> changedNodes) throws IOException, SQLException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createChangeLog(targetTableName); metadata.populateChangeLog(targetTableName, changedNodes); } finally { geopackage.close(); } }
public void createChangeLog(final String targetTableName, Map<String, ChangeType> changedNodes) throws IOException, SQLException { final GeoPackage geopackage = new GeoPackage(geopackageDbFile); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { metadata.createChangeLog(targetTableName); metadata.populateChangeLog(targetTableName, changedNodes); } finally { geopackage.close(); } }
/** * Create the audit tables for the specified feature type. * * @param geopackage the geopackage to add the tables to * @param mappedPath the feature tree path * @param fe the feature entry to add audit logs too * @param commitId the commit that the exported features came from * @throws SQLException */ private void createAuditLog(final GeoPackage geopackage, final String mappedPath, final FeatureEntry fe, final ObjectId commitId) throws SQLException { info("Creating audit metadata for table '%s'", fe.getIdentifier()); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { URI repoURI = context.repository().getLocation(); metadata.init(repoURI); final String auditedTable = fe.getIdentifier(); metadata.createAudit(auditedTable, mappedPath, commitId); } }
/** * Create the audit tables for the specified feature type. * * @param geopackage the geopackage to add the tables to * @param mappedPath the feature tree path * @param fe the feature entry to add audit logs too * @param commitId the commit that the exported features came from * @throws SQLException */ private void createAuditLog(final GeoPackage geopackage, final String mappedPath, final FeatureEntry fe, final ObjectId commitId) throws SQLException { info("Creating audit metadata for table '%s'", fe.getIdentifier()); final DataSource dataSource = geopackage.getDataSource(); try (Connection connection = dataSource.getConnection(); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { URI repoURI = context.repository().getLocation(); metadata.init(repoURI); final String auditedTable = fe.getIdentifier(); metadata.createAudit(auditedTable, mappedPath, commitId); } }
try (Connection cx = geopackage.getDataSource().getConnection()) { final String sql = format("SELECT * FROM %s", auditTable.getAuditTable()); try (Statement st = cx.createStatement()) {
try (Connection cx = geopackage.getDataSource().getConnection()) { final String sql = format("SELECT * FROM %s", auditTable.getAuditTable()); try (Statement st = cx.createStatement()) {
throw Throwables.propagate(e); final DataSource dataSource = geopackage.getDataSource();
throw new RuntimeException(e); final DataSource dataSource = geopackage.getDataSource();
final GeoPackage geopkg = new GeoPackage(geopackage); try { final DataSource dataSource = geopkg.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) {
final GeoPackage geopkg = new GeoPackage(geopackage); try { final DataSource dataSource = geopkg.getDataSource(); try (Connection connection = dataSource.getConnection()) { try (GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) {