77import static io .airbyte .integrations .base .errors .messages .ErrorMessage .getErrorMessage ;
88
99import com .fasterxml .jackson .databind .JsonNode ;
10+ import com .google .common .annotations .VisibleForTesting ;
1011import com .google .common .base .Preconditions ;
1112import com .google .common .collect .Lists ;
1213import io .airbyte .commons .exceptions .ConnectionErrorException ;
@@ -234,7 +235,7 @@ private void validateCursorFieldForIncrementalTables(
234235 }
235236 }
236237
237- protected List <TableInfo <CommonField <DataType >>> discoverWithoutSystemTables (
238+ private List <TableInfo <CommonField <DataType >>> discoverWithoutSystemTables (
238239 final Database database ) throws Exception {
239240 final Set <String > systemNameSpaces = getExcludedInternalNameSpaces ();
240241 final List <TableInfo <CommonField <DataType >>> discoveredTables = discoverInternal (database );
@@ -244,7 +245,7 @@ protected List<TableInfo<CommonField<DataType>>> discoverWithoutSystemTables(
244245 Collectors .toList ()));
245246 }
246247
247- protected List <AutoCloseableIterator <AirbyteMessage >> getFullRefreshIterators (
248+ private List <AutoCloseableIterator <AirbyteMessage >> getFullRefreshIterators (
248249 final Database database ,
249250 final ConfiguredAirbyteCatalog catalog ,
250251 final Map <String , TableInfo <CommonField <DataType >>> tableNameToTable ,
@@ -287,7 +288,7 @@ protected List<AutoCloseableIterator<AirbyteMessage>> getIncrementalIterators(
287288 * sync mode
288289 * @return List of AirbyteMessageIterators containing all iterators for a catalog
289290 */
290- protected List <AutoCloseableIterator <AirbyteMessage >> getSelectedIterators (
291+ private List <AutoCloseableIterator <AirbyteMessage >> getSelectedIterators (
291292 final Database database ,
292293 final ConfiguredAirbyteCatalog catalog ,
293294 final Map <String , TableInfo <CommonField <DataType >>> tableNameToTable ,
@@ -331,7 +332,7 @@ protected List<AutoCloseableIterator<AirbyteMessage>> getSelectedIterators(
331332 * @param emittedAt Time when data was emitted from the Source database
332333 * @return
333334 */
334- protected AutoCloseableIterator <AirbyteMessage > createReadIterator (final Database database ,
335+ private AutoCloseableIterator <AirbyteMessage > createReadIterator (final Database database ,
335336 final ConfiguredAirbyteStream airbyteStream ,
336337 final TableInfo <CommonField <DataType >> table ,
337338 final StateManager stateManager ,
@@ -414,7 +415,7 @@ protected AutoCloseableIterator<AirbyteMessage> createReadIterator(final Databas
414415 * @param emittedAt Time when data was emitted from the Source database
415416 * @return AirbyteMessage Iterator that
416417 */
417- protected AutoCloseableIterator <AirbyteMessage > getIncrementalStream (final Database database ,
418+ private AutoCloseableIterator <AirbyteMessage > getIncrementalStream (final Database database ,
418419 final ConfiguredAirbyteStream airbyteStream ,
419420 final List <String > selectedDatabaseFields ,
420421 final TableInfo <CommonField <DataType >> table ,
@@ -456,7 +457,7 @@ protected AutoCloseableIterator<AirbyteMessage> getIncrementalStream(final Datab
456457 * @param emittedAt Time when data was emitted from the Source database
457458 * @return AirbyteMessageIterator with all records for a database source
458459 */
459- protected AutoCloseableIterator <AirbyteMessage > getFullRefreshStream (final Database database ,
460+ private AutoCloseableIterator <AirbyteMessage > getFullRefreshStream (final Database database ,
460461 final String streamName ,
461462 final String namespace ,
462463 final List <String > selectedDatabaseFields ,
@@ -468,11 +469,11 @@ protected AutoCloseableIterator<AirbyteMessage> getFullRefreshStream(final Datab
468469 return getMessageIterator (queryStream , streamName , namespace , emittedAt .toEpochMilli ());
469470 }
470471
471- protected String getFullyQualifiedTableName (final String nameSpace , final String tableName ) {
472+ private String getFullyQualifiedTableName (final String nameSpace , final String tableName ) {
472473 return nameSpace != null ? nameSpace + "." + tableName : tableName ;
473474 }
474475
475- public AutoCloseableIterator <AirbyteMessage > getMessageIterator (
476+ private AutoCloseableIterator <AirbyteMessage > getMessageIterator (
476477 final AutoCloseableIterator <JsonNode > recordIterator ,
477478 final String streamName ,
478479 final String namespace ,
@@ -493,7 +494,7 @@ public AutoCloseableIterator<AirbyteMessage> getMessageIterator(
493494 * @return list of table/data structure info
494495 * @throws Exception might throw an error during connection to database
495496 */
496- protected List <TableInfo <Field >> getTables (final Database database ) throws Exception {
497+ private List <TableInfo <Field >> getTables (final Database database ) throws Exception {
497498 final List <TableInfo <CommonField <DataType >>> tableInfos = discoverWithoutSystemTables (database );
498499 final Map <String , List <String >> fullyQualifiedTableNameToPrimaryKeys = discoverPrimaryKeys (
499500 database , tableInfos );
@@ -522,7 +523,7 @@ protected List<TableInfo<Field>> getTables(final Database database) throws Excep
522523 .collect (Collectors .toList ());
523524 }
524525
525- protected Field toField (final CommonField <DataType > field ) {
526+ private Field toField (final CommonField <DataType > field ) {
526527 if (getType (field .getType ()) == JsonSchemaType .OBJECT && field .getProperties () != null
527528 && !field .getProperties ().isEmpty ()) {
528529 final var properties = field .getProperties ().stream ().map (this ::toField ).toList ();
@@ -532,7 +533,7 @@ protected Field toField(final CommonField<DataType> field) {
532533 }
533534 }
534535
535- protected void assertColumnsWithSameNameAreSame (final String nameSpace , final String tableName ,
536+ private void assertColumnsWithSameNameAreSame (final String nameSpace , final String tableName ,
536537 final List <CommonField <DataType >> columns ) {
537538 columns .stream ()
538539 .collect (Collectors .groupingBy (CommonField <DataType >::getName ))
@@ -557,7 +558,7 @@ protected void assertColumnsWithSameNameAreSame(final String nameSpace, final St
557558 * for SELECT-ing the table with privileges. In some cases such SELECT doesn't require (e.g. in
558559 * Oracle DB - the schema is the user, you cannot REVOKE a privilege on a table from its owner).
559560 */
560- public <T > Set <T > getPrivilegesTableForCurrentUser (final JdbcDatabase database ,
561+ protected <T > Set <T > getPrivilegesTableForCurrentUser (final JdbcDatabase database ,
561562 final String schema ) throws SQLException {
562563 return Collections .emptySet ();
563564 }
@@ -585,7 +586,7 @@ public <T> Set<T> getPrivilegesTableForCurrentUser(final JdbcDatabase database,
585586 *
586587 * @return list of consumers that run queries for the check command.
587588 */
588- public abstract List <CheckedConsumer <Database , Exception >> getCheckOperations (JsonNode config )
589+ protected abstract List <CheckedConsumer <Database , Exception >> getCheckOperations (JsonNode config )
589590 throws Exception ;
590591
591592 /**
@@ -601,7 +602,7 @@ public abstract List<CheckedConsumer<Database, Exception>> getCheckOperations(Js
601602 *
602603 * @return set of system namespaces(schemas) to be excluded
603604 */
604- public abstract Set <String > getExcludedInternalNameSpaces ();
605+ protected abstract Set <String > getExcludedInternalNameSpaces ();
605606
606607 /**
607608 * Discover all available tables in the source database.
@@ -653,7 +654,7 @@ protected abstract Map<String, List<String>> discoverPrimaryKeys(Database databa
653654 * @param tableName target table
654655 * @return iterator with read data
655656 */
656- public abstract AutoCloseableIterator <JsonNode > queryTableFullRefresh (final Database database ,
657+ protected abstract AutoCloseableIterator <JsonNode > queryTableFullRefresh (final Database database ,
657658 final List <String > columnNames ,
658659 final String schemaName ,
659660 final String tableName );
@@ -666,7 +667,7 @@ public abstract AutoCloseableIterator<JsonNode> queryTableFullRefresh(final Data
666667 *
667668 * @return iterator with read data
668669 */
669- public abstract AutoCloseableIterator <JsonNode > queryTableIncremental (Database database ,
670+ protected abstract AutoCloseableIterator <JsonNode > queryTableIncremental (Database database ,
670671 List <String > columnNames ,
671672 String schemaName ,
672673 String tableName ,
@@ -685,7 +686,7 @@ protected int getStateEmissionFrequency() {
685686 /**
686687 * @return list of fields that could be used as cursors
687688 */
688- public abstract boolean isCursorType (DataType type );
689+ protected abstract boolean isCursorType (DataType type );
689690
690691 private Database createDatabaseInternal (final JsonNode sourceConfig ) throws Exception {
691692 final Database database = createDatabase (sourceConfig );
0 commit comments