File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed
cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres
database-commons/src/main/java/io/cdap/plugin/util Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © 2024 Cask Data, Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+ * use this file except in compliance with the License. You may obtain a copy of
6+ * the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+ * License for the specific language governing permissions and limitations under
14+ * the License.
15+ */
16+
17+ package io .cdap .plugin .cloudsql .postgres ;
18+
19+ import io .cdap .plugin .postgres .PostgresErrorDetailsProvider ;
20+ import io .cdap .plugin .util .DBUtils ;
21+
22+ /**
23+ * A custom ErrorDetailsProvider for CloudSQL PostgreSQL plugin.
24+ */
25+ public class CloudSQLPostgreSQLErrorDetailsProvider extends PostgresErrorDetailsProvider {
26+ @ Override
27+ protected String getExternalDocumentationLink () {
28+ return DBUtils .CLOUDSQLPOSTGRES_SUPPORTED_DOC_URL ;
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ protected LineageRecorder getLineageRecorder(BatchSinkContext context) {
147147 return new LineageRecorder (context , assetBuilder .build ());
148148 }
149149
150+ @ Override
151+ protected String getErrorDetailsProviderClassName () {
152+ return CloudSQLPostgreSQLErrorDetailsProvider .class .getName ();
153+ }
154+
150155 /** CloudSQL PostgreSQL sink config. */
151156 public static class CloudSQLPostgreSQLSinkConfig extends AbstractDBSpecificSinkConfig {
152157
Original file line number Diff line number Diff line change @@ -86,6 +86,16 @@ protected Class<? extends DBWritable> getDBRecordType() {
8686 return PostgresDBRecord .class ;
8787 }
8888
89+ @ Override
90+ protected String getExternalDocumentationLink () {
91+ return DBUtils .CLOUDSQLPOSTGRES_SUPPORTED_DOC_URL ;
92+ }
93+
94+ @ Override
95+ protected String getErrorDetailsProviderClassName () {
96+ return CloudSQLPostgreSQLErrorDetailsProvider .class .getName ();
97+ }
98+
8999 @ Override
90100 protected String createConnectionString () {
91101 if (CloudSQLUtil .PRIVATE_INSTANCE .equalsIgnoreCase (
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ public final class DBUtils {
6464 public static final String CLOUDSQLMYSQL_SUPPORTED_DOC_URL = "https://cloud.google.com/sql/docs/mysql/error-messages" ;
6565 public static final String POSTGRES_SUPPORTED_DOC_URL =
6666 "https://www.postgresql.org/docs/current/errcodes-appendix.html" ;
67+ public static final String CLOUDSQLPOSTGRES_SUPPORTED_DOC_URL =
68+ "https://cloud.google.com/sql/docs/postgres/error-messages" ;
6769
6870 // Java by default uses October 15, 1582 as a Gregorian cut over date.
6971 // Any timestamp created with time less than this cut over date is treated as Julian date.
You can’t perform that action at this time.
0 commit comments