@@ -93,6 +93,30 @@ protected static SourceDbToSpannerOptions getSourceDbToSpannerOptions(String[] a
9393 return options ;
9494 }
9595
96+ /**
97+ * Validates the provided pipeline options. TODO: move this to source connector.
98+ *
99+ * @param options The execution parameters to the pipeline.
100+ * @param sourceConnectionConfig Parsed source connection config.
101+ * @throws IllegalArgumentException if the provided options are invalid for the pipeline.
102+ */
103+ @ VisibleForTesting
104+ static void validateOptions (
105+ SourceDbToSpannerOptions options , SourceConnectionConfig sourceConnectionConfig ) {
106+ if (SourceDbToSpannerOptions .PG_SOURCE_DIALECT .equals (options .getSourceDbDialect ())) {
107+ Preconditions .checkArgument (
108+ (sourceConnectionConfig instanceof JdbcShardConfig ),
109+ "Postgresql dialect should have JDBC source config." );
110+ for (Shard shard : ((JdbcShardConfig ) sourceConnectionConfig ).getShardConfigs ()) {
111+ if (StringUtils .isNotBlank (shard .getNamespace ())
112+ && !shard .getNamespace ().equals ("public" )) {
113+ throw new IllegalArgumentException (
114+ "Non-public namespaces are currently unsupported for PostgreSQL migrations." );
115+ }
116+ }
117+ }
118+ }
119+
96120 /**
97121 * Create the pipeline with the supplied options.
98122 *
@@ -132,28 +156,4 @@ static SpannerConfig createSpannerConfig(SourceDbToSpannerOptions options) {
132156 }
133157 return spannerConfig ;
134158 }
135-
136- /**
137- * Validates the provided pipeline options.
138- *
139- * @param options The execution parameters to the pipeline.
140- * @param sourceConnectionConfig Parsed source connection config.
141- * @throws IllegalArgumentException if the provided options are invalid for the pipeline.
142- */
143- @ VisibleForTesting
144- static void validateOptions (
145- SourceDbToSpannerOptions options , SourceConnectionConfig sourceConnectionConfig ) {
146- if (SourceDbToSpannerOptions .PG_SOURCE_DIALECT .equals (options .getSourceDbDialect ())) {
147- Preconditions .checkArgument (
148- (sourceConnectionConfig instanceof JdbcShardConfig ),
149- "Postgresql dialect should have JDBC source config." );
150- for (Shard shard : ((JdbcShardConfig ) sourceConnectionConfig ).getShardConfigs ()) {
151- if (StringUtils .isNotBlank (shard .getNamespace ())
152- && !shard .getNamespace ().equals ("public" )) {
153- throw new IllegalArgumentException (
154- "Non-public namespaces are currently unsupported for PostgreSQL migrations." );
155- }
156- }
157- }
158- }
159159}
0 commit comments