From f1c11c9e410d92a67eb866f1c19a2c9ee97ada34 Mon Sep 17 00:00:00 2001 From: Rajmund Takacs Date: Thu, 30 May 2024 16:46:36 +0200 Subject: [PATCH] Remove Adapter - Provider abstraction --- .../nifi-generic-database-adapter/pom.xml | 32 --------- .../org.apache.nifi.db.DatabaseAdapter | 15 ---- .../nifi-mysql-database-adapter/pom.xml | 37 ---------- .../org.apache.nifi.db.DatabaseAdapter | 15 ---- .../org.apache.nifi.db.DatabaseAdapter | 16 ----- .../nifi-phoenix-database-adapter/pom.xml | 32 --------- .../nifi-postgresql-database-adapter/pom.xml | 37 ---------- .../org.apache.nifi.db.DatabaseAdapter | 15 ---- .../nifi-database-adapters/pom.xml | 34 ---------- .../nifi-derby-database-adapter/pom.xml | 32 --------- .../org.apache.nifi.db.DatabaseAdapter | 15 ---- ...ion.java => DatabaseAdapterMigration.java} | 44 ++++++------ ...java => DatabaseAdapterMigrationTest.java} | 36 +++++----- .../nifi-extension-utils/pom.xml | 2 - .../nifi-standard-parameter-providers/pom.xml | 2 +- .../parameter/DatabaseParameterProvider.java | 5 +- .../TestDatabaseParameterProvider.java | 12 ++-- .../nifi-standard-processors/pom.xml | 45 +----------- .../AbstractDatabaseFetchProcessor.java | 12 ++-- .../standard/AbstractQueryDatabaseTable.java | 54 +++++++-------- .../standard/GenerateTableFetch.java | 47 ++++++------- .../standard/PutDatabaseRecord.java | 12 ++-- .../standard/QueryDatabaseTable.java | 2 +- .../standard/QueryDatabaseTableRecord.java | 2 +- .../standard/UpdateDatabaseTable.java | 17 ++--- .../standard/PutDatabaseRecordIT.java | 12 ++-- .../standard/PutDatabaseRecordTest.java | 36 +++++----- .../standard/QueryDatabaseTableIT.java | 8 +-- .../standard/QueryDatabaseTableRecordIT.java | 8 +-- .../QueryDatabaseTableRecordTest.java | 64 ++++++----------- .../standard/QueryDatabaseTableTest.java | 53 ++++++--------- .../standard/TestGenerateTableFetch.java | 18 +++-- .../standard/TestUpdateDatabaseTable.java | 60 +++++++--------- ...ifi.processors.standard.db.DatabaseAdapter | 2 +- .../nifi-db-adapter-api}/pom.xml | 4 +- .../org/apache/nifi/db/ColumnDescription.java | 0 .../org/apache/nifi/db/DatabaseAdapter.java | 7 +- .../nifi/db/DatabaseAdapterProvider.java | 5 +- .../nifi/db/TableNotFoundException.java | 0 .../java/org/apache/nifi/db/TableSchema.java | 0 .../nifi-db-adapter-nar/pom.xml | 2 +- .../src/main/resources/META-INF/LICENSE | 0 .../src/main/resources/META-INF/NOTICE | 0 .../nifi-db-adapter}/pom.xml | 7 +- .../nifi/db}/GenericDatabaseAdapter.java | 10 ++- .../nifi/db/LegacyOracleDatabaseAdapter.java} | 12 ++-- .../nifi/db}/MSSQL2008DatabaseAdapter.java | 8 ++- .../nifi/db/MSSQL2012DatabaseAdapter.java} | 11 +-- .../apache/nifi/db}/MySQLDatabaseAdapter.java | 7 +- .../nifi/db}/Oracle12DatabaseAdapter.java | 12 ++-- .../nifi/db}/PhoenixDatabaseAdapter.java | 11 +-- .../nifi/db}/PostgreSQLDatabaseAdapter.java | 7 +- ....apache.nifi.controller.ControllerService} | 10 ++- .../db/TestLegacyOracleDatabaseAdapter.java} | 9 +-- .../db}/TestMSSQL2008DatabaseAdapter.java | 3 +- .../db/TestMSSQL2012DatabaseAdapter.java} | 7 +- .../nifi/db}/TestMySQLDatabaseAdapter.java | 2 +- .../nifi/db}/TestOracle12DatabaseAdapter.java | 5 +- .../nifi/db}/TestPhoenixDatabaseAdapter.java | 2 +- .../db}/TestPostgreSQLDatabaseAdapter.java | 2 +- .../nifi-derby-db-adapter}/pom.xml | 7 +- .../apache/nifi/db}/DerbyDatabaseAdapter.java | 12 ++-- .../db/DerbyDatabaseAdapterProvider.java} | 14 ++-- ....apache.nifi.controller.ControllerService} | 2 +- .../pom.xml | 3 +- .../nifi-db-adapter-provider-api/pom.xml | 32 --------- .../nifi-db-adapter/pom.xml | 68 ------------------- .../db/GenericDatabaseAdapterProvider.java | 35 ---------- .../LegacyOracleDatabaseAdapterProvider.java | 35 ---------- .../db/MSSQL2008DatabaseAdapterProvider.java | 35 ---------- .../db/MSSQL2012DatabaseAdapterProvider.java | 35 ---------- .../db/Oracle12DatabaseAdapterProvider.java | 35 ---------- .../db/PhoenixDatabaseAdapterProvider.java | 35 ---------- .../db/PostgreSQLDatabaseAdapterProvider.java | 35 ---------- ...g.apache.nifi.controller.ControllerService | 22 ------ .../nifi-standard-services-api-nar/pom.xml | 2 +- .../nifi-standard-services/pom.xml | 4 +- 77 files changed, 333 insertions(+), 1054 deletions(-) delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter rename nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/{DatabaseAdapterProviderMigration.java => DatabaseAdapterMigration.java} (64%) rename nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/{DatabaseAdapterProviderMigrationTest.java => DatabaseAdapterMigrationTest.java} (60%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api => nifi-standard-services/nifi-db-adapter-api}/pom.xml (91%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api => nifi-standard-services/nifi-db-adapter-api}/src/main/java/org/apache/nifi/db/ColumnDescription.java (100%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api => nifi-standard-services/nifi-db-adapter-api}/src/main/java/org/apache/nifi/db/DatabaseAdapter.java (97%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-api => nifi-db-adapter-api}/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java (81%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api => nifi-standard-services/nifi-db-adapter-api}/src/main/java/org/apache/nifi/db/TableNotFoundException.java (100%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api => nifi-standard-services/nifi-db-adapter-api}/src/main/java/org/apache/nifi/db/TableSchema.java (100%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-bundle => nifi-db-adapter-bundle}/nifi-db-adapter-nar/pom.xml (96%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-bundle => nifi-db-adapter-bundle}/nifi-db-adapter-nar/src/main/resources/META-INF/LICENSE (100%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-bundle => nifi-db-adapter-bundle}/nifi-db-adapter-nar/src/main/resources/META-INF/NOTICE (100%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter}/pom.xml (88%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/GenericDatabaseAdapter.java (87%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/OracleDatabaseAdapter.java => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapter.java} (95%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/MSSQL2008DatabaseAdapter.java (91%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQLDatabaseAdapter.java => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapter.java} (92%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/MySQLDatabaseAdapter.java (96%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/Oracle12DatabaseAdapter.java (96%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/PhoenixDatabaseAdapter.java (95%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db}/PostgreSQLDatabaseAdapter.java (96%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService} (69%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracleDatabaseAdapter.java => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestLegacyOracleDatabaseAdapter.java} (96%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db}/TestMSSQL2008DatabaseAdapter.java (98%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQLDatabaseAdapter.java => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2012DatabaseAdapter.java} (97%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/test/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db}/TestMySQLDatabaseAdapter.java (99%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db}/TestOracle12DatabaseAdapter.java (98%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/test/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db}/TestPhoenixDatabaseAdapter.java (99%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/test/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db}/TestPostgreSQLDatabaseAdapter.java (99%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter => nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter}/pom.xml (88%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-derby-database-adapter/src/main/java/org/apache/nifi/db/impl => nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db}/DerbyDatabaseAdapter.java (94%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapterProvider.java => nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapterProvider.java} (60%) rename nifi-extension-bundles/{nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter => nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService} (94%) rename nifi-extension-bundles/nifi-standard-services/{nifi-db-adapter-provider-bundle => nifi-db-adapter-bundle}/pom.xml (93%) delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/pom.xml delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/pom.xml delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapterProvider.java delete mode 100644 nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/pom.xml deleted file mode 100644 index f3643728d12f1..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-database-adapters - 2.0.0-SNAPSHOT - - - nifi-generic-database-adapter - jar - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter deleted file mode 100644 index 1da46761f399e..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.impl.GenericDatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/pom.xml deleted file mode 100644 index 82fd8734af33f..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-database-adapters - 2.0.0-SNAPSHOT - - - nifi-mysql-database-adapter - jar - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-generic-database-adapter - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter deleted file mode 100644 index c2b7c65420bae..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.impl.MySQLDatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter deleted file mode 100644 index a9f4ffde572f6..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.impl.OracleDatabaseAdapter -org.apache.nifi.db.impl.Oracle12DatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/pom.xml deleted file mode 100644 index 69fe157a1974b..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-database-adapters - 2.0.0-SNAPSHOT - - - nifi-phoenix-database-adapter - jar - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/pom.xml deleted file mode 100644 index a1168380377a3..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-database-adapters - 2.0.0-SNAPSHOT - - - nifi-postgresql-database-adapter - jar - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-generic-database-adapter - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter deleted file mode 100644 index 82ea87d3d5ea8..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.impl.PostgreSQLDatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/pom.xml deleted file mode 100644 index 7b896d7bc7b48..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-extension-utils - 2.0.0-SNAPSHOT - - - nifi-database-adapters - pom - - nifi-database-adapter-api - nifi-generic-database-adapter - nifi-oracle-database-adapter - nifi-mssql-database-adapter - nifi-mysql-database-adapter - nifi-postgresql-database-adapter - nifi-phoenix-database-adapter - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/pom.xml b/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/pom.xml deleted file mode 100644 index 3642d90b5a61c..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-extension-utils - 2.0.0-SNAPSHOT - - - nifi-derby-database-adapter - jar - - - org.apache.nifi - nifi-generic-database-adapter - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter deleted file mode 100644 index af9550240968d..0000000000000 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.impl.DerbyDatabaseAdapter \ No newline at end of file diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterProviderMigration.java b/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterMigration.java similarity index 64% rename from nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterProviderMigration.java rename to nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterMigration.java index ec8c4e8ec3edd..d65bfcb857745 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterProviderMigration.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/main/java/org/apache/nifi/migration/DatabaseAdapterMigration.java @@ -20,7 +20,7 @@ import org.apache.nifi.components.PropertyDescriptor; -public final class DatabaseAdapterProviderMigration { +public final class DatabaseAdapterMigration { static final String GENERIC_DATABASE_ADAPTER_NAME = "Generic"; static final String MSSQL_2012_DATABASE_ADAPTER_NAME = "MS SQL 2012+"; @@ -31,28 +31,28 @@ public final class DatabaseAdapterProviderMigration { static final String PHOENIX_DATABASE_ADAPTER_NAME = "Phoenix"; static final String POSTGRESQL_DATABASE_ADAPTER_NAME = "PostgreSQL"; - static final String GENERIC_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.GenericDatabaseAdapterProvider"; - static final String MSSQL_2012_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.MSSQL2012DatabaseAdapterProvider"; - static final String MSSQL_2008_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.MSSQL2008DatabaseAdapterProvider"; - static final String MYSQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.MySQLDatabaseAdapterProvider"; - static final String LEGACY_ORACLE_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.LegacyOracleDatabaseAdapterProvider"; - static final String ORACLE_12_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.Oracle12DatabaseAdapterProvider"; - static final String PHOENIX_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.PhoenixDatabaseAdapterProvider"; - static final String POSTGRESQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME = "org.apache.nifi.db.PostgreSQLDatabaseAdapterProvider"; + static final String GENERIC_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.GenericDatabaseAdapter"; + static final String MSSQL_2012_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.MSSQL2012DatabaseAdapter"; + static final String MSSQL_2008_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.MSSQL2008DatabaseAdapter"; + static final String MYSQL_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.MySQLDatabaseAdapter"; + static final String LEGACY_ORACLE_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.LegacyOracleDatabaseAdapter"; + static final String ORACLE_12_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.Oracle12DatabaseAdapter"; + static final String PHOENIX_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.PhoenixDatabaseAdapter"; + static final String POSTGRESQL_DATABASE_ADAPTER_CLASSNAME = "org.apache.nifi.db.PostgreSQLDatabaseAdapter"; static final String DB_TYPE_PROPERTY = "db-type"; - private DatabaseAdapterProviderMigration() { } + private DatabaseAdapterMigration() { } /** - * Migrates component level Database Type property to DatabaseAdapterProvider controller service. + * Migrates component level Database Type property to DatabaseAdapter controller service. * * @param config the component's property config to be migrated - * @param dbAdapterProviderProperty the component's property descriptor referencing DatabaseAdapterProvider service + * @param dbAdapterProperty the component's property descriptor referencing DatabaseAdapter service * @param dbTypeProperty the name of the component level Database Type property */ public static void migrateProperties(final PropertyConfiguration config, - final PropertyDescriptor dbAdapterProviderProperty, final String dbTypeProperty) { + final PropertyDescriptor dbAdapterProperty, final String dbTypeProperty) { if (!config.isPropertySet(dbTypeProperty)) { return; // nothing to do } @@ -60,34 +60,34 @@ public static void migrateProperties(final PropertyConfiguration config, final String serviceId; switch (config.getRawPropertyValue(dbTypeProperty).orElseThrow()) { case GENERIC_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(GENERIC_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(GENERIC_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case MSSQL_2012_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(MSSQL_2012_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(MSSQL_2012_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case MSSQL_2008_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(MSSQL_2008_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(MSSQL_2008_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case MYSQL_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(MYSQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(MYSQL_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case LEGACY_ORACLE_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(LEGACY_ORACLE_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(LEGACY_ORACLE_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case ORACLE_12_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(ORACLE_12_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(ORACLE_12_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case PHOENIX_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(PHOENIX_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(PHOENIX_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; case POSTGRESQL_DATABASE_ADAPTER_NAME: - serviceId = config.createControllerService(POSTGRESQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME, emptyMap()); + serviceId = config.createControllerService(POSTGRESQL_DATABASE_ADAPTER_CLASSNAME, emptyMap()); break; default: return; // fail migration, but let the user resolve it by hand. } - config.setProperty(dbAdapterProviderProperty, serviceId); + config.setProperty(dbAdapterProperty, serviceId); config.removeProperty(dbTypeProperty); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterProviderMigrationTest.java b/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterMigrationTest.java similarity index 60% rename from nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterProviderMigrationTest.java rename to nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterMigrationTest.java index 6277ddc29656c..610822796359d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterProviderMigrationTest.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-migration-utils/src/test/java/org/apache/nifi/migration/DatabaseAdapterMigrationTest.java @@ -17,14 +17,14 @@ package org.apache.nifi.migration; import static java.util.Collections.emptyMap; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.GENERIC_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.LEGACY_ORACLE_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.MSSQL_2008_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.MSSQL_2012_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.MYSQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.ORACLE_12_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.PHOENIX_DATABASE_ADAPTER_PROVIDER_CLASSNAME; -import static org.apache.nifi.migration.DatabaseAdapterProviderMigration.POSTGRESQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.GENERIC_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.LEGACY_ORACLE_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.MSSQL_2008_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.MSSQL_2012_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.MYSQL_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.ORACLE_12_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.PHOENIX_DATABASE_ADAPTER_CLASSNAME; +import static org.apache.nifi.migration.DatabaseAdapterMigration.POSTGRESQL_DATABASE_ADAPTER_CLASSNAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -39,7 +39,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -class DatabaseAdapterProviderMigrationTest { +class DatabaseAdapterMigrationTest { private static final PropertyDescriptor DATABASE_ADAPTER_PROVIDER = new PropertyDescriptor.Builder() .name("db-adapter-provider") @@ -55,7 +55,7 @@ void testMigrateDatabaseTypeProperty(String serviceClassname, String dbType) { ); final MockPropertyConfiguration config = new MockPropertyConfiguration(properties); - DatabaseAdapterProviderMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, DB_TYPE); + DatabaseAdapterMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, DB_TYPE); assertFalse(config.hasProperty(DB_TYPE)); assertTrue(config.isPropertySet(DATABASE_ADAPTER_PROVIDER)); @@ -73,14 +73,14 @@ void testMigrateDatabaseTypeProperty(String serviceClassname, String dbType) { private static Stream provideArgs() { return Stream.of( - Arguments.of(GENERIC_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "Generic"), - Arguments.of(MSSQL_2012_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "MS SQL 2012+"), - Arguments.of(MSSQL_2008_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "MS SQL 2008"), - Arguments.of(MYSQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "MySQL"), - Arguments.of(LEGACY_ORACLE_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "Oracle"), - Arguments.of(ORACLE_12_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "Oracle 12+"), - Arguments.of(PHOENIX_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "Phoenix"), - Arguments.of(POSTGRESQL_DATABASE_ADAPTER_PROVIDER_CLASSNAME, "PostgreSQL") + Arguments.of(GENERIC_DATABASE_ADAPTER_CLASSNAME, "Generic"), + Arguments.of(MSSQL_2012_DATABASE_ADAPTER_CLASSNAME, "MS SQL 2012+"), + Arguments.of(MSSQL_2008_DATABASE_ADAPTER_CLASSNAME, "MS SQL 2008"), + Arguments.of(MYSQL_DATABASE_ADAPTER_CLASSNAME, "MySQL"), + Arguments.of(LEGACY_ORACLE_DATABASE_ADAPTER_CLASSNAME, "Oracle"), + Arguments.of(ORACLE_12_DATABASE_ADAPTER_CLASSNAME, "Oracle 12+"), + Arguments.of(PHOENIX_DATABASE_ADAPTER_CLASSNAME, "Phoenix"), + Arguments.of(POSTGRESQL_DATABASE_ADAPTER_CLASSNAME, "PostgreSQL") ); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/pom.xml b/nifi-extension-bundles/nifi-extension-utils/pom.xml index a400f3c9adc03..cca1a5bce34ea 100644 --- a/nifi-extension-bundles/nifi-extension-utils/pom.xml +++ b/nifi-extension-bundles/nifi-extension-utils/pom.xml @@ -48,7 +48,5 @@ nifi-resource-transfer nifi-service-utils nifi-syslog-utils - nifi-database-adapters - nifi-derby-database-adapter diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/pom.xml b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/pom.xml index 1f298ca08ec17..8c7a1cd7c3f88 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/pom.xml +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/pom.xml @@ -61,7 +61,7 @@ org.apache.nifi - nifi-db-adapter-provider-api + nifi-db-adapter-api 2.0.0-SNAPSHOT diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java index c5f85aa8aaab6..65a58100002b0 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java @@ -35,7 +35,6 @@ import org.apache.nifi.components.PropertyDescriptor.Builder; import org.apache.nifi.controller.ConfigurationContext; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.util.StandardValidators; @@ -52,7 +51,7 @@ public class DatabaseParameterProvider extends AbstractParameterProvider impleme .name("db-adapter-provider") .displayName("Database Adapter Provider") .description("The service, that is used for generating database-specific code.") - .identifiesControllerService(DatabaseAdapterProvider.class) + .identifiesControllerService(DatabaseAdapter.class) .required(true) .build(); @@ -219,7 +218,7 @@ private void validateValueNotNull(final String value, final String columnName) { } String getQuery(final ConfigurationContext context, final String tableName, final List columns, final String whereClause) { - final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService(DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService(DatabaseAdapter.class); return dbAdapter.getSelectStatement(tableName, StringUtils.join(columns, ", "), whereClause, null, null, null); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/test/java/org/apache/nifi/parameter/TestDatabaseParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/test/java/org/apache/nifi/parameter/TestDatabaseParameterProvider.java index 6edeccb7a652e..d7b018287a352 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/test/java/org/apache/nifi/parameter/TestDatabaseParameterProvider.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/test/java/org/apache/nifi/parameter/TestDatabaseParameterProvider.java @@ -41,8 +41,8 @@ import java.util.stream.Collectors; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.controller.ConfigurationContext; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.GenericDatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.reporting.InitializationException; @@ -76,8 +76,8 @@ public void init() throws InitializationException { final DatabaseParameterProvider rawProvider = new DatabaseParameterProvider(); initializationContext = new MockParameterProviderInitializationContext("id", "name", mock(ComponentLog.class)); initializationContext.addControllerService(dbcpService, DBCP_SERVICE); - final DatabaseAdapterProvider dbAdapterProvider = new GenericDatabaseAdapterProvider(); - initializationContext.addControllerService(dbAdapterProvider, DATABASE_ADAPTER_PROVIDER.getName()); + final DatabaseAdapter dbAdapter = new GenericDatabaseAdapter(); + initializationContext.addControllerService(dbAdapter, DATABASE_ADAPTER_PROVIDER.getName()); rawProvider.initialize(initializationContext); parameterProvider = spy(rawProvider); // Return the table name @@ -86,7 +86,7 @@ public void init() throws InitializationException { columnBasedProperties = new HashMap<>(); columnBasedProperties.put(DatabaseParameterProvider.DBCP_SERVICE, DBCP_SERVICE); - columnBasedProperties.put(DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + columnBasedProperties.put(DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); columnBasedProperties.put(DatabaseParameterProvider.PARAMETER_GROUPING_STRATEGY, DatabaseParameterProvider.GROUPING_BY_COLUMN.getValue()); columnBasedProperties.put(DatabaseParameterProvider.PARAMETER_GROUP_NAME_COLUMN, "group"); columnBasedProperties.put(DatabaseParameterProvider.PARAMETER_NAME_COLUMN, "name"); @@ -95,7 +95,7 @@ public void init() throws InitializationException { nonColumnBasedProperties = new HashMap<>(); nonColumnBasedProperties.put(DatabaseParameterProvider.DBCP_SERVICE, DBCP_SERVICE); - nonColumnBasedProperties.put(DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + nonColumnBasedProperties.put(DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); nonColumnBasedProperties.put(DatabaseParameterProvider.PARAMETER_GROUPING_STRATEGY, DatabaseParameterProvider.GROUPING_BY_TABLE_NAME.getValue()); nonColumnBasedProperties.put(DatabaseParameterProvider.PARAMETER_NAME_COLUMN, "name"); nonColumnBasedProperties.put(DatabaseParameterProvider.PARAMETER_VALUE_COLUMN, "value"); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml index ed8364df89012..1188ace669144 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml @@ -263,53 +263,12 @@ org.apache.nifi - nifi-database-adapter-api + nifi-db-adapter-api 2.0.0-SNAPSHOT org.apache.nifi - nifi-db-adapter-provider-api - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-generic-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-phoenix-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-mssql-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-mysql-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-oracle-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-postgresql-database-adapter - 2.0.0-SNAPSHOT - test - - - org.apache.nifi - nifi-derby-database-adapter + nifi-derby-db-adapter 2.0.0-SNAPSHOT test diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractDatabaseFetchProcessor.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractDatabaseFetchProcessor.java index a9b95e84b63cd..1bfddfde5dd86 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractDatabaseFetchProcessor.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractDatabaseFetchProcessor.java @@ -75,12 +75,11 @@ import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.flowfile.attributes.FragmentAttributes; -import org.apache.nifi.migration.DatabaseAdapterProviderMigration; +import org.apache.nifi.migration.DatabaseAdapterMigration; import org.apache.nifi.migration.PropertyConfiguration; import org.apache.nifi.processor.AbstractSessionFactoryProcessor; import org.apache.nifi.processor.ProcessContext; @@ -184,11 +183,11 @@ public abstract class AbstractDatabaseFetchProcessor extends AbstractSessionFact // The delimiter to use when referencing qualified names (such as table@!@column in the state map) protected static final String NAMESPACE_DELIMITER = "@!@"; - public static final PropertyDescriptor DATABASE_ADAPTER_PROVIDER = new Builder() + public static final PropertyDescriptor DATABASE_ADAPTER = new Builder() .name("db-adapter-provider") .displayName("Database Adapter Provider") .description("The service, that is used for generating database-specific code.") - .identifiesControllerService(DatabaseAdapterProvider.class) + .identifiesControllerService(DatabaseAdapter.class) .required(true) .build(); @@ -225,7 +224,7 @@ protected Collection customValidate(ValidationContext validati @Override public void migrateProperties(final PropertyConfiguration config) { super.migrateProperties(config); - DatabaseAdapterProviderMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, "db-fetch-db-type"); + DatabaseAdapterMigration.migrateProperties(config, DATABASE_ADAPTER, "db-fetch-db-type"); } public void setup(final ProcessContext context) { @@ -248,8 +247,7 @@ public void setup(final ProcessContext context, boolean shouldCleanCache, FlowFi final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue(); final String sqlQuery = context.getProperty(SQL_QUERY).evaluateAttributeExpressions().getValue(); - final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); try (final Connection con = dbcpService.getConnection(flowFile == null ? Collections.emptyMap() : flowFile.getAttributes()); final Statement st = con.createStatement()) { diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractQueryDatabaseTable.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractQueryDatabaseTable.java index 1244d1a5eacf9..2f6877b28775e 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractQueryDatabaseTable.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractQueryDatabaseTable.java @@ -16,6 +16,27 @@ */ package org.apache.nifi.processors.standard; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.annotation.lifecycle.OnScheduled; import org.apache.nifi.annotation.lifecycle.OnStopped; @@ -25,7 +46,7 @@ import org.apache.nifi.components.ValidationResult; import org.apache.nifi.components.state.Scope; import org.apache.nifi.components.state.StateMap; -import org.apache.nifi.db.DatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.expression.AttributeExpression; import org.apache.nifi.expression.ExpressionLanguageScope; @@ -37,33 +58,10 @@ import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.db.DatabaseAdapter; import org.apache.nifi.processors.standard.sql.SqlWriter; import org.apache.nifi.util.StopWatch; import org.apache.nifi.util.db.JdbcCommon; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - public abstract class AbstractQueryDatabaseTable extends AbstractDatabaseFetchProcessor { @@ -217,8 +215,7 @@ protected Collection customValidate(ValidationContext validati final Boolean propertyAutoCommit = validationContext.getProperty(AUTO_COMMIT).evaluateAttributeExpressions().asBoolean(); final Integer fetchSize = validationContext.getProperty(FETCH_SIZE).evaluateAttributeExpressions().asInteger(); - final DatabaseAdapter dbAdapter = validationContext.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter dbAdapter = validationContext.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); final Boolean adapterAutoCommit = dbAdapter == null ? null : dbAdapter.getAutoCommitForReads(fetchSize).orElse(null); @@ -229,7 +226,7 @@ protected Collection customValidate(ValidationContext validati .input(String.valueOf(propertyAutoCommit)) .explanation(String.format("'%s' must be set to '%s' because '%s' %s requires it to be '%s'", AUTO_COMMIT.getDisplayName(), adapterAutoCommit, - dbAdapter.getName(), DATABASE_ADAPTER_PROVIDER.getDisplayName(), adapterAutoCommit)) + dbAdapter.getName(), DATABASE_ADAPTER.getDisplayName(), adapterAutoCommit)) .build()); } @@ -260,8 +257,7 @@ public void onTrigger(final ProcessContext context, final ProcessSessionFactory final ComponentLog logger = getLogger(); final DBCPService dbcpService = context.getProperty(DBCP_SERVICE).asControllerService(DBCPService.class); - final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions().getValue(); final String columnNames = context.getProperty(COLUMN_NAMES).evaluateAttributeExpressions().getValue(); final String sqlQuery = context.getProperty(SQL_QUERY).evaluateAttributeExpressions().getValue(); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java index 9436bb8d24f7c..44f82b48dfeaa 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java @@ -16,6 +16,25 @@ */ package org.apache.nifi.processors.standard; +import java.io.IOException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.annotation.behavior.DynamicProperty; import org.apache.nifi.annotation.behavior.InputRequirement; @@ -35,7 +54,7 @@ import org.apache.nifi.components.ValidationResult; import org.apache.nifi.components.state.Scope; import org.apache.nifi.components.state.StateMap; -import org.apache.nifi.db.DatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.expression.AttributeExpression; import org.apache.nifi.expression.ExpressionLanguageScope; @@ -47,27 +66,6 @@ import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.db.DatabaseAdapter; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; @TriggerSerially @@ -180,7 +178,7 @@ public GenerateTableFetch() { final List pds = new ArrayList<>(); pds.add(DBCP_SERVICE); - pds.add(DATABASE_ADAPTER_PROVIDER); + pds.add(DATABASE_ADAPTER); pds.add(TABLE_NAME); pds.add(COLUMN_NAMES); pds.add(MAX_VALUE_COLUMN_NAMES); @@ -265,8 +263,7 @@ public void onTrigger(final ProcessContext context, final ProcessSessionFactory final ComponentLog logger = getLogger(); final DBCPService dbcpService = context.getProperty(DBCP_SERVICE).asControllerService(DBCPService.class); - final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter dbAdapter = context.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions(fileToProcess).getValue(); final String columnNames = context.getProperty(COLUMN_NAMES).evaluateAttributeExpressions(fileToProcess).getValue(); final String maxValueColumnNames = context.getProperty(MAX_VALUE_COLUMN_NAMES).evaluateAttributeExpressions(fileToProcess).getValue(); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java index 92fae0157eb1b..4d98d6da7b8bb 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java @@ -71,12 +71,11 @@ import org.apache.nifi.components.ValidationResult; import org.apache.nifi.db.ColumnDescription; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; import org.apache.nifi.db.TableSchema; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.migration.DatabaseAdapterProviderMigration; +import org.apache.nifi.migration.DatabaseAdapterMigration; import org.apache.nifi.migration.PropertyConfiguration; import org.apache.nifi.processor.AbstractProcessor; import org.apache.nifi.processor.ProcessContext; @@ -393,7 +392,7 @@ public class PutDatabaseRecord extends AbstractProcessor { .name("db-adapter-provider") .displayName("Database Adapter Provider") .description("The service, that is used for generating database-specific code.") - .identifiesControllerService(DatabaseAdapterProvider.class) + .identifiesControllerService(DatabaseAdapter.class) .required(true) .build(); @@ -442,7 +441,7 @@ public class PutDatabaseRecord extends AbstractProcessor { @Override public void migrateProperties(final PropertyConfiguration config) { super.migrateProperties(config); - DatabaseAdapterProviderMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, "db-type"); + DatabaseAdapterMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, "db-type"); } @Override @@ -459,8 +458,7 @@ protected List getSupportedPropertyDescriptors() { protected Collection customValidate(ValidationContext validationContext) { Collection validationResults = new ArrayList<>(super.customValidate(validationContext)); - DatabaseAdapter databaseAdapter = validationContext.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + DatabaseAdapter databaseAdapter = validationContext.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService(DatabaseAdapter.class); String statementType = validationContext.getProperty(STATEMENT_TYPE).getValue(); if ((UPSERT_TYPE.equals(statementType) && !databaseAdapter.supportsUpsert()) || (INSERT_IGNORE_TYPE.equals(statementType) && !databaseAdapter.supportsInsertIgnore())) { @@ -509,7 +507,7 @@ private boolean isMaxBatchSizeHardcodedToZero(ValidationContext validationContex @OnScheduled public void onScheduled(final ProcessContext context) { - databaseAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService(DatabaseAdapterProvider.class).getAdapter(); + databaseAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService(DatabaseAdapter.class); final int tableSchemaCacheSize = context.getProperty(TABLE_SCHEMA_CACHE_SIZE).asInteger(); schemaCache = Caffeine.newBuilder() diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTable.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTable.java index 267b7ae95407a..b66dcaf49b294 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTable.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTable.java @@ -97,7 +97,7 @@ public QueryDatabaseTable() { final List pds = new ArrayList<>(); pds.add(DBCP_SERVICE); - pds.add(DATABASE_ADAPTER_PROVIDER); + pds.add(DATABASE_ADAPTER); pds.add(new PropertyDescriptor.Builder() .fromPropertyDescriptor(TABLE_NAME) .description("The name of the database table to be queried. When a custom query is used, this property is used to alias the query and appears as an attribute on the FlowFile.") diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecord.java index 62245a38b075a..1fd59d3594b29 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecord.java @@ -195,7 +195,7 @@ public QueryDatabaseTableRecord() { final List pds = new ArrayList<>(); pds.add(DBCP_SERVICE); - pds.add(DATABASE_ADAPTER_PROVIDER); + pds.add(DATABASE_ADAPTER); pds.add(new PropertyDescriptor.Builder() .fromPropertyDescriptor(TABLE_NAME) .description("The name of the database table to be queried. When a custom query is used, this property is used to alias the query and appears as an attribute on the FlowFile.") diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java index f11f1e523e925..0be8a3c359edc 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java @@ -46,7 +46,6 @@ import org.apache.nifi.components.Validator; import org.apache.nifi.db.ColumnDescription; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; import org.apache.nifi.db.TableNotFoundException; import org.apache.nifi.db.TableSchema; import org.apache.nifi.dbcp.DBCPService; @@ -54,7 +53,7 @@ import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.migration.DatabaseAdapterProviderMigration; +import org.apache.nifi.migration.DatabaseAdapterMigration; import org.apache.nifi.migration.PropertyConfiguration; import org.apache.nifi.processor.AbstractProcessor; import org.apache.nifi.processor.ProcessContext; @@ -235,11 +234,11 @@ public class UpdateDatabaseTable extends AbstractProcessor { .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); - static final PropertyDescriptor DATABASE_ADAPTER_PROVIDER = new Builder() + static final PropertyDescriptor DATABASE_ADAPTER = new Builder() .name("db-adapter-provider") .displayName("Database Adapter Provider") .description("The service, that is used for generating database-specific code.") - .identifiesControllerService(DatabaseAdapterProvider.class) + .identifiesControllerService(DatabaseAdapter.class) .required(true) .build(); @@ -266,7 +265,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { final List pds = new ArrayList<>(); pds.add(RECORD_READER); pds.add(DBCP_SERVICE); - pds.add(DATABASE_ADAPTER_PROVIDER); + pds.add(DATABASE_ADAPTER); pds.add(CATALOG_NAME); pds.add(SCHEMA_NAME); pds.add(TABLE_NAME); @@ -284,7 +283,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { @Override public void migrateProperties(final PropertyConfiguration config) { super.migrateProperties(config); - DatabaseAdapterProviderMigration.migrateProperties(config, DATABASE_ADAPTER_PROVIDER, "db-type"); + DatabaseAdapterMigration.migrateProperties(config, DATABASE_ADAPTER, "db-type"); } @Override @@ -308,8 +307,7 @@ protected Collection customValidate(final ValidationContext va .explanation("Record Writer must be set if 'Update Field Names' is true").valid(false).build()); } - final DatabaseAdapter databaseAdapter = validationContext.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter databaseAdapter = validationContext.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); final boolean createIfNotExists = CREATE_IF_NOT_EXISTS.getValue().equals(validationContext.getProperty(CREATE_TABLE).getValue()); if (createIfNotExists && !databaseAdapter.supportsCreateTableIfNotExists()) { validationResults.add(new ValidationResult.Builder().subject(CREATE_TABLE.getDisplayName()) @@ -373,8 +371,7 @@ public void onTrigger(final ProcessContext context, final ProcessSession session throw new ProcessException("Record Writer must be set if 'Update Field Names' is true"); } final DBCPService dbcpService = context.getProperty(DBCP_SERVICE).asControllerService(DBCPService.class); - final DatabaseAdapter databaseAdapter = context.getProperty(DATABASE_ADAPTER_PROVIDER).asControllerService( - DatabaseAdapterProvider.class).getAdapter(); + final DatabaseAdapter databaseAdapter = context.getProperty(DATABASE_ADAPTER).asControllerService(DatabaseAdapter.class); try (final Connection connection = dbcpService.getConnection(flowFile.getAttributes())) { final boolean quoteTableName = context.getProperty(QUOTE_TABLE_IDENTIFIER).asBoolean(); final boolean quoteColumnNames = context.getProperty(QUOTE_COLUMN_IDENTIFIERS).asBoolean(); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordIT.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordIT.java index 6f9b876b5bc56..cb0587d19a6a0 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordIT.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordIT.java @@ -32,8 +32,8 @@ import java.time.Month; import java.util.HashMap; import java.util.Map; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.PostgreSQLDatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.PostgreSQLDatabaseAdapter; import org.apache.nifi.dbcp.DBCPConnectionPool; import org.apache.nifi.dbcp.utils.DBCPProperties; import org.apache.nifi.json.JsonTreeReader; @@ -83,9 +83,9 @@ public void setup() throws InitializationException, SQLException { runner = TestRunners.newTestRunner(PutDatabaseRecord.class); - final DatabaseAdapterProvider dbAdapterProvider = new PostgreSQLDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); + final DatabaseAdapter dbAdapter = new PostgreSQLDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); final DBCPConnectionPool connectionPool = new DBCPConnectionPool(); runner.addControllerService("connectionPool", connectionPool); @@ -105,7 +105,7 @@ public void setup() throws InitializationException, SQLException { runner.setProperty(PutDatabaseRecord.DBCP_SERVICE, "connectionPool"); runner.setProperty(PutDatabaseRecord.TABLE_NAME, "person"); - runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); runner.setProperty(PutDatabaseRecord.STATEMENT_TYPE, "INSERT"); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java index 64d6899d3ec7f..0942817a25e05 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java @@ -60,8 +60,8 @@ import org.apache.commons.dbcp2.DelegatingConnection; import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.GenericDatabaseAdapter; import org.apache.nifi.db.TableSchema; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.processor.exception.ProcessException; @@ -191,16 +191,16 @@ public static void shutdownDatabase() throws Exception { private void setRunner(TestCase testCase) throws InitializationException { processor = new PutDatabaseRecord(); - final DatabaseAdapterProvider dbAdapterProvider = new GenericDatabaseAdapterProvider(); + final DatabaseAdapter dbAdapter = new GenericDatabaseAdapter(); //Mock the DBCP Controller Service so we can control the Results dbcp = spy(new DBCPServiceSimpleImpl(DB_LOCATION)); final Map dbcpProperties = new HashMap<>(); runner = TestRunners.newTestRunner(processor); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, "dbAdapter"); runner.addControllerService(DBCP_SERVICE_ID, dbcp, dbcpProperties); runner.enableControllerService(dbcp); runner.setProperty(PutDatabaseRecord.DBCP_SERVICE, DBCP_SERVICE_ID); @@ -236,10 +236,10 @@ public void testSetAutoCommitFalseFailure() throws InitializationException, SQLE dbcp = new DBCPServiceAutoCommitTest(DB_LOCATION); final Map dbcpProperties = new HashMap<>(); runner = TestRunners.newTestRunner(processor); - final DatabaseAdapterProvider dbAdapterProvider = new GenericDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + final DatabaseAdapter dbAdapter = new GenericDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); runner.addControllerService(DBCP_SERVICE_ID, dbcp, dbcpProperties); runner.enableControllerService(dbcp); runner.setProperty(PutDatabaseRecord.DBCP_SERVICE, DBCP_SERVICE_ID); @@ -283,10 +283,10 @@ public void testInsertNonRequiredColumnsUnmatchedField() throws InitializationEx final Map dbcpProperties = new HashMap<>(); runner = TestRunners.newTestRunner(processor); - final DatabaseAdapterProvider dbAdapterProvider = new GenericDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + final DatabaseAdapter dbAdapter = new GenericDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); runner.addControllerService(DBCP_SERVICE_ID, dbcp, dbcpProperties); runner.enableControllerService(dbcp); runner.setProperty(PutDatabaseRecord.DBCP_SERVICE, DBCP_SERVICE_ID); @@ -2156,10 +2156,10 @@ public void testInsertEnum() throws InitializationException, ProcessException, S dbcp = spy(new DBCPServiceSimpleImpl(DB_LOCATION, false)); // Use H2 runner = TestRunners.newTestRunner(processor); - final DatabaseAdapterProvider dbAdapterProvider = new GenericDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + final DatabaseAdapter dbAdapter = new GenericDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(PutDatabaseRecord.DATABASE_ADAPTER_PROVIDER, dbAdapter.getIdentifier()); runner.addControllerService(DBCP_SERVICE_ID, dbcp, new HashMap<>()); runner.enableControllerService(dbcp); runner.setProperty(PutDatabaseRecord.DBCP_SERVICE, DBCP_SERVICE_ID); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableIT.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableIT.java index 5da3b26285b36..8c603954dc726 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableIT.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableIT.java @@ -19,8 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.PostgreSQLDatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.PostgreSQLDatabaseAdapter; import org.apache.nifi.dbcp.DBCPConnectionPool; import org.apache.nifi.dbcp.utils.DBCPProperties; import org.apache.nifi.reporting.InitializationException; @@ -48,8 +48,8 @@ public static void cleanUpAfterClass() { } @Override - public DatabaseAdapterProvider createDatabaseAdapterProvider() { - return new PostgreSQLDatabaseAdapterProvider(); + public DatabaseAdapter createDatabaseAdapter() { + return new PostgreSQLDatabaseAdapter(); } @Override diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordIT.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordIT.java index 502f7bac2586e..ce139bc407baa 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordIT.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordIT.java @@ -19,8 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.PostgreSQLDatabaseAdapterProvider; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.PostgreSQLDatabaseAdapter; import org.apache.nifi.dbcp.DBCPConnectionPool; import org.apache.nifi.dbcp.utils.DBCPProperties; import org.apache.nifi.reporting.InitializationException; @@ -48,8 +48,8 @@ public static void cleanUpAfterClass() { } @Override - public DatabaseAdapterProvider createDatabaseAdapterProvider() { - return new PostgreSQLDatabaseAdapterProvider(); + public DatabaseAdapter createDatabaseAdapter() { + return new PostgreSQLDatabaseAdapter(); } @Override diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordTest.java index 660d2e91ec309..3a6b55be160cf 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordTest.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableRecordTest.java @@ -44,13 +44,11 @@ import org.apache.nifi.components.state.StateManager; import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; -import org.apache.nifi.db.impl.GenericDatabaseAdapter; -import org.apache.nifi.db.impl.MSSQLDatabaseAdapter; -import org.apache.nifi.db.impl.MySQLDatabaseAdapter; -import org.apache.nifi.db.impl.OracleDatabaseAdapter; -import org.apache.nifi.db.impl.PhoenixDatabaseAdapter; +import org.apache.nifi.db.GenericDatabaseAdapter; +import org.apache.nifi.db.LegacyOracleDatabaseAdapter; +import org.apache.nifi.db.MSSQL2012DatabaseAdapter; +import org.apache.nifi.db.MySQLDatabaseAdapter; +import org.apache.nifi.db.PhoenixDatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.reporting.InitializationException; @@ -111,14 +109,14 @@ public static void cleanUpAfterClass() throws Exception { System.clearProperty("derby.stream.error.file"); } - public DatabaseAdapterProvider createDatabaseAdapterProvider() { - return new GenericDatabaseAdapterProvider(); + public DatabaseAdapter createDatabaseAdapter() { + return new GenericDatabaseAdapter(); } - public void createDbAdapterProviderControllerService() throws InitializationException { - final DatabaseAdapterProvider dbAdapterProvider = createDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); + public void createDbAdapterControllerService() throws InitializationException { + final DatabaseAdapter dbAdapter = createDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); } public void createDbcpControllerService() throws InitializationException { @@ -132,8 +130,8 @@ public void createDbcpControllerService() throws InitializationException { public void setup() throws InitializationException, IOException { processor = new MockQueryDatabaseTableRecord(); runner = TestRunners.newTestRunner(processor); - createDbAdapterProviderControllerService(); - runner.setProperty(QueryDatabaseTableRecord.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + createDbAdapterControllerService(); + runner.setProperty(QueryDatabaseTableRecord.DATABASE_ADAPTER, "dbAdapter"); createDbcpControllerService(); runner.setProperty(QueryDatabaseTableRecord.DBCP_SERVICE, "dbcp"); runner.getStateManager().clear(Scope.CLUSTER); @@ -190,13 +188,13 @@ public void testGetQuery() throws Exception { assertEquals("SELECT * FROM `myTable` WHERE id > 509 AND `DATE-CREATED` >= '2016-03-07 12:34:56'", query); // Square brackets can be used to escape Microsoft SQL Server column and table names. - dbAdapter = new MSSQLDatabaseAdapter(); + dbAdapter = new MSSQL2012DatabaseAdapter(); processor.putColumnType(AbstractDatabaseFetchProcessor.getStateKey("[myTable]", "[DATE-CREATED]", dbAdapter), Types.TIMESTAMP); query = processor.getQuery(dbAdapter, "[myTable]", null, Arrays.asList("id", "[DATE-CREATED]"), null, stateManager.getState(Scope.CLUSTER).toMap()); assertEquals("SELECT * FROM [myTable] WHERE id > 509 AND [DATE-CREATED] >= '2016-03-07 12:34:56'", query); // Test Oracle strategy - dbAdapter = new OracleDatabaseAdapter(); + dbAdapter = new LegacyOracleDatabaseAdapter(); query = processor.getQuery(dbAdapter, "myTable", null, Arrays.asList("id", "DATE_CREATED"), "type = \"CUSTOMER\"", stateManager.getState(Scope.CLUSTER).toMap()); assertEquals("SELECT * FROM myTable WHERE id > 509 AND DATE_CREATED >= timestamp '2016-03-07 12:34:56' AND (type = \"CUSTOMER\")", query); @@ -690,17 +688,11 @@ public void testWithRuntimeException() throws SQLException, InitializationExcept runner.setProperty(QueryDatabaseTableRecord.TABLE_NAME, "TEST_NULL_INT"); runner.setProperty(AbstractDatabaseFetchProcessor.MAX_VALUE_COLUMN_NAMES, "id"); - final DatabaseAdapter throwingDbAdapter = new GenericDatabaseAdapter() { - @Override - public String getName() { - throw new RuntimeException("test"); - } - }; - final DatabaseAdapterProvider provider = spy(createDatabaseAdapterProvider()); - when(provider.getAdapter()).thenReturn(throwingDbAdapter); + final DatabaseAdapter provider = spy(createDatabaseAdapter()); + when(provider.getName()).thenThrow(new RuntimeException("test")); runner.addControllerService("ThrowingDbAdapter", provider); runner.enableControllerService(provider); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, provider.getIdentifier()); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, provider.getIdentifier()); runner.run(); @@ -1463,23 +1455,11 @@ public void testWithExceptionAfterSomeRowsProcessed() throws SQLException, Initi runner.setProperty(AbstractDatabaseFetchProcessor.MAX_VALUE_COLUMN_NAMES, "id"); // Override adapter with one that fails after the first row is processed - final DatabaseAdapter throwingDbAdapter = new GenericDatabaseAdapter() { - boolean fail = false; - - @Override - public String getName() { - if (!fail) { - fail = true; - return super.getName(); - } - throw new RuntimeException("test"); - } - }; - final DatabaseAdapterProvider provider = spy(createDatabaseAdapterProvider()); - when(provider.getAdapter()).thenReturn(throwingDbAdapter); + final DatabaseAdapter provider = spy(createDatabaseAdapter()); + when(provider.getName()).thenCallRealMethod().thenThrow(new RuntimeException("test")); runner.addControllerService("ThrowingDbAdapter", provider); runner.enableControllerService(provider); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, provider.getIdentifier()); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, provider.getIdentifier()); runner.run(); assertTrue(runner.getFlowFilesForRelationship(QueryDatabaseTableRecord.REL_SUCCESS).isEmpty()); @@ -1487,7 +1467,7 @@ public String getName() { runner.getStateManager().assertStateNotSet("test_null_int@!@id", Scope.CLUSTER); // Restore original (working) adapter and run again - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.run(); assertFalse(runner.getFlowFilesForRelationship(QueryDatabaseTableRecord.REL_SUCCESS).isEmpty()); runner.getStateManager().assertStateEquals("test_null_int@!@id", "2", Scope.CLUSTER); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java index a4426235826ae..dd7140a6d65da 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/QueryDatabaseTableTest.java @@ -51,13 +51,11 @@ import org.apache.nifi.components.state.StateManager; import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; -import org.apache.nifi.db.impl.GenericDatabaseAdapter; -import org.apache.nifi.db.impl.MSSQLDatabaseAdapter; -import org.apache.nifi.db.impl.MySQLDatabaseAdapter; -import org.apache.nifi.db.impl.OracleDatabaseAdapter; -import org.apache.nifi.db.impl.PhoenixDatabaseAdapter; +import org.apache.nifi.db.GenericDatabaseAdapter; +import org.apache.nifi.db.MSSQL2012DatabaseAdapter; +import org.apache.nifi.db.MySQLDatabaseAdapter; +import org.apache.nifi.db.LegacyOracleDatabaseAdapter; +import org.apache.nifi.db.PhoenixDatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.reporting.InitializationException; @@ -115,8 +113,8 @@ public static void cleanUpAfterClass() throws Exception { System.clearProperty("derby.stream.error.file"); } - public DatabaseAdapterProvider createDatabaseAdapterProvider() { - return new GenericDatabaseAdapterProvider(); + public DatabaseAdapter createDatabaseAdapter() { + return new GenericDatabaseAdapter(); } public void createDbcpControllerService() throws InitializationException { @@ -127,9 +125,9 @@ public void createDbcpControllerService() throws InitializationException { } public void createDbAdapterControllerService() throws InitializationException { - final DatabaseAdapterProvider dbAdapterProvider = createDatabaseAdapterProvider(); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); + final DatabaseAdapter dbAdapter = createDatabaseAdapter(); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); } @BeforeEach @@ -139,7 +137,7 @@ public void setup() throws InitializationException, IOException { createDbcpControllerService(); runner.setProperty(QueryDatabaseTable.DBCP_SERVICE, "dbcp"); createDbAdapterControllerService(); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.getStateManager().clear(Scope.CLUSTER); } @@ -151,7 +149,7 @@ public void teardown() throws IOException { @Test public void testGetQuery() throws Exception { - dbAdapter = createDatabaseAdapterProvider().getAdapter(); + dbAdapter = createDatabaseAdapter(); String query = processor.getQuery(dbAdapter, "myTable", null, null, null, null); assertEquals("SELECT * FROM myTable", query); query = processor.getQuery(dbAdapter, "myTable", "col1,col2", null, null, null); @@ -188,13 +186,13 @@ public void testGetQuery() throws Exception { assertEquals("SELECT * FROM `myTable` WHERE id > 509 AND `DATE-CREATED` >= '2016-03-07 12:34:56'", query); // Square brackets can be used to escape Microsoft SQL Server column and table names. - dbAdapter = new MSSQLDatabaseAdapter(); + dbAdapter = new MSSQL2012DatabaseAdapter(); processor.putColumnType(processor.getStateKey("[myTable]", "[DATE-CREATED]", dbAdapter), Types.TIMESTAMP); query = processor.getQuery(dbAdapter, "[myTable]", null, Arrays.asList("id", "[DATE-CREATED]"), null, stateManager.getState(Scope.CLUSTER).toMap()); assertEquals("SELECT * FROM [myTable] WHERE id > 509 AND [DATE-CREATED] >= '2016-03-07 12:34:56'", query); // Test Oracle strategy - dbAdapter = new OracleDatabaseAdapter(); + dbAdapter = new LegacyOracleDatabaseAdapter(); query = processor.getQuery(dbAdapter, "myTable", null, Arrays.asList("id", "DATE_CREATED"), "type = \"CUSTOMER\"", stateManager.getState(Scope.CLUSTER).toMap()); assertEquals("SELECT * FROM myTable WHERE id > 509 AND DATE_CREATED >= timestamp '2016-03-07 12:34:56' AND (type = \"CUSTOMER\")", query); @@ -702,17 +700,11 @@ public void testWithRuntimeException() throws SQLException, InitializationExcept runner.setProperty(QueryDatabaseTable.TABLE_NAME, "TEST_NULL_INT"); runner.setProperty(AbstractDatabaseFetchProcessor.MAX_VALUE_COLUMN_NAMES, "id"); - final DatabaseAdapter throwingDbAdapter = new GenericDatabaseAdapter() { - @Override - public String getName() { - throw new DataFileWriter.AppendWriteException(null); - } - }; - final DatabaseAdapterProvider provider = spy(createDatabaseAdapterProvider()); - when(provider.getAdapter()).thenReturn(throwingDbAdapter); + final DatabaseAdapter provider = spy(createDatabaseAdapter()); + when(provider.getName()).thenThrow(new DataFileWriter.AppendWriteException(null)); runner.addControllerService("ThrowingDbAdapter", provider); runner.enableControllerService(provider); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, provider.getIdentifier()); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, provider.getIdentifier()); runner.run(); @@ -1508,11 +1500,11 @@ public String getName() { throw new DataFileWriter.AppendWriteException(null); } }; - final DatabaseAdapterProvider provider = spy(createDatabaseAdapterProvider()); - when(provider.getAdapter()).thenReturn(throwingDbAdapter); + final DatabaseAdapter provider = spy(createDatabaseAdapter()); + when(provider.getName()).thenCallRealMethod().thenThrow(new DataFileWriter.AppendWriteException(null)); runner.addControllerService("ThrowingDbAdapter", provider); runner.enableControllerService(provider); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, provider.getIdentifier()); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, provider.getIdentifier()); runner.run(); assertTrue(runner.getFlowFilesForRelationship(QueryDatabaseTable.REL_SUCCESS).isEmpty()); @@ -1520,11 +1512,10 @@ public String getName() { runner.getStateManager().assertStateNotSet("test_null_int@!@id", Scope.CLUSTER); // Restore original (working) adapter and run again - final DatabaseAdapterProvider provider2 = spy(createDatabaseAdapterProvider()); - when(provider.getAdapter()).thenReturn(new GenericDatabaseAdapter()); + final DatabaseAdapter provider2 = spy(createDatabaseAdapter()); runner.addControllerService("DbAdapter", provider2); runner.enableControllerService(provider2); - runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER_PROVIDER, provider2.getIdentifier()); + runner.setProperty(QueryDatabaseTable.DATABASE_ADAPTER, provider2.getIdentifier()); runner.run(); assertFalse(runner.getFlowFilesForRelationship(QueryDatabaseTable.REL_SUCCESS).isEmpty()); runner.getStateManager().assertStateEquals("test_null_int@!@id", "2", Scope.CLUSTER); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateTableFetch.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateTableFetch.java index d20bb5fbd0b3d..81a5767cab8be 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateTableFetch.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateTableFetch.java @@ -17,7 +17,7 @@ package org.apache.nifi.processors.standard; -import static org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor.DATABASE_ADAPTER_PROVIDER; +import static org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor.DATABASE_ADAPTER; import static org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor.FRAGMENT_COUNT; import static org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor.FRAGMENT_ID; import static org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor.FRAGMENT_INDEX; @@ -49,9 +49,8 @@ import org.apache.nifi.components.state.Scope; import org.apache.nifi.components.state.StateManager; import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; -import org.apache.nifi.db.impl.DerbyDatabaseAdapter; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.DerbyDatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.reporting.InitializationException; @@ -112,21 +111,20 @@ public static void cleanUpAfterClass() throws Exception { @BeforeEach public void setUp() throws Exception { processor = new GenerateTableFetch(); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); //Mock the DBCP Controller Service so we can control the Results dbcp = spy(new DBCPServiceSimpleImpl()); final Map dbcpProperties = new HashMap<>(); runner = TestRunners.newTestRunner(processor); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(GenerateTableFetch.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(GenerateTableFetch.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", dbcp, dbcpProperties); runner.enableControllerService(dbcp); runner.setProperty(GenerateTableFetch.DBCP_SERVICE, "dbcp"); - runner.setProperty(DATABASE_ADAPTER_PROVIDER, dbAdapterProvider.getIdentifier()); + runner.setProperty(DATABASE_ADAPTER, dbAdapter.getIdentifier()); } @Test diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestUpdateDatabaseTable.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestUpdateDatabaseTable.java index 77f939573529b..4fc9a3776f007 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestUpdateDatabaseTable.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestUpdateDatabaseTable.java @@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; import java.io.File; import java.sql.Connection; @@ -31,9 +30,8 @@ import java.util.HashMap; import java.util.Map; import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.DatabaseAdapterProvider; -import org.apache.nifi.db.GenericDatabaseAdapterProvider; -import org.apache.nifi.db.impl.DerbyDatabaseAdapter; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.db.DerbyDatabaseAdapter; import org.apache.nifi.dbcp.DBCPService; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.serialization.record.MockRecordParser; @@ -127,11 +125,10 @@ public void testCreateTable() throws Exception { runner.setProperty(UpdateDatabaseTable.CREATE_TABLE, UpdateDatabaseTable.CREATE_IF_NOT_EXISTS); runner.setProperty(UpdateDatabaseTable.QUOTE_TABLE_IDENTIFIER, "false"); runner.setProperty(UpdateDatabaseTable.QUOTE_COLUMN_IDENTIFIERS, "true"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); @@ -198,11 +195,10 @@ public void testAddColumnToExistingTable() throws Exception { runner.setProperty(UpdateDatabaseTable.CREATE_TABLE, UpdateDatabaseTable.FAIL_IF_NOT_EXISTS); runner.setProperty(UpdateDatabaseTable.QUOTE_TABLE_IDENTIFIER, "true"); runner.setProperty(UpdateDatabaseTable.QUOTE_COLUMN_IDENTIFIERS, "false"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); @@ -271,11 +267,10 @@ public void testAddExistingColumnTranslateFieldNames() throws Exception { runner.setProperty(UpdateDatabaseTable.TRANSLATE_FIELD_NAMES, "true"); runner.setProperty(UpdateDatabaseTable.QUOTE_TABLE_IDENTIFIER, "true"); runner.setProperty(UpdateDatabaseTable.QUOTE_COLUMN_IDENTIFIERS, "false"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); @@ -340,11 +335,10 @@ public void testAddExistingColumnNoTranslateFieldNames() throws Exception { runner.setProperty(UpdateDatabaseTable.TRANSLATE_FIELD_NAMES, "false"); runner.setProperty(UpdateDatabaseTable.QUOTE_TABLE_IDENTIFIER, "true"); runner.setProperty(UpdateDatabaseTable.QUOTE_COLUMN_IDENTIFIERS, "false"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); @@ -425,11 +419,10 @@ public void testAddColumnToExistingTableUpdateFieldNames() throws Exception { runner.enableControllerService(writerFactory); runner.setProperty(UpdateDatabaseTable.RECORD_WRITER_FACTORY, "mock-writer-factory"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); @@ -472,11 +465,10 @@ public void testCreateTableNonDefaultSchema() throws Exception { runner.setProperty(UpdateDatabaseTable.CREATE_TABLE, UpdateDatabaseTable.CREATE_IF_NOT_EXISTS); runner.setProperty(UpdateDatabaseTable.QUOTE_TABLE_IDENTIFIER, "false"); runner.setProperty(UpdateDatabaseTable.QUOTE_COLUMN_IDENTIFIERS, "true"); - final DatabaseAdapterProvider dbAdapterProvider = spy(new GenericDatabaseAdapterProvider()); - when(dbAdapterProvider.getAdapter()).thenReturn(new DerbyDatabaseAdapter()); - runner.addControllerService("dbAdapterProvider", dbAdapterProvider); - runner.enableControllerService(dbAdapterProvider); - runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER_PROVIDER, "dbAdapterProvider"); + final DatabaseAdapter dbAdapter = spy(new DerbyDatabaseAdapter()); + runner.addControllerService("dbAdapter", dbAdapter); + runner.enableControllerService(dbAdapter); + runner.setProperty(UpdateDatabaseTable.DATABASE_ADAPTER, "dbAdapter"); runner.addControllerService("dbcp", service); runner.enableControllerService(service); runner.setProperty(UpdateDatabaseTable.DBCP_SERVICE, "dbcp"); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/META-INF/services/org.apache.nifi.processors.standard.db.DatabaseAdapter b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/META-INF/services/org.apache.nifi.processors.standard.db.DatabaseAdapter index 91ca55d4fc0c2..62e5018d4e385 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/META-INF/services/org.apache.nifi.processors.standard.db.DatabaseAdapter +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/META-INF/services/org.apache.nifi.processors.standard.db.DatabaseAdapter @@ -12,4 +12,4 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -org.apache.nifi.db.impl.DerbyDatabaseAdapter +org.apache.nifi.db.DerbyDatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/pom.xml similarity index 91% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/pom.xml rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/pom.xml index c4e6e80a156cf..50bd24e4480f7 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/pom.xml @@ -16,10 +16,10 @@ 4.0.0 org.apache.nifi - nifi-database-adapters + nifi-standard-services 2.0.0-SNAPSHOT - nifi-database-adapter-api + nifi-db-adapter-api jar diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/ColumnDescription.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/ColumnDescription.java similarity index 100% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/ColumnDescription.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/ColumnDescription.java diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java similarity index 97% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java index 28e7f2fe6d7e4..bc483f92a285a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapter.java @@ -34,11 +34,16 @@ import java.util.List; import java.util.Optional; import java.util.Set; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.ControllerService; /** * Interface for RDBMS/JDBC-specific code. */ -public interface DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter"}) +@CapabilityDescription("Adapter for a specific SQL dialect.") +public interface DatabaseAdapter extends ControllerService { String getName(); diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java similarity index 81% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java index 0ee486fb54a98..be225c7fee09a 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/DatabaseAdapterProvider.java @@ -16,15 +16,12 @@ */ package org.apache.nifi.db; -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.controller.ControllerService; /** * Definition for Database Adapter Provider Service. */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider"}) -@CapabilityDescription("Provides an adapter for a specific SQL dialect.") +@Deprecated public interface DatabaseAdapterProvider extends ControllerService { /** diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/TableNotFoundException.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/TableNotFoundException.java similarity index 100% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/TableNotFoundException.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/TableNotFoundException.java diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/TableSchema.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/TableSchema.java similarity index 100% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-database-adapter-api/src/main/java/org/apache/nifi/db/TableSchema.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-api/src/main/java/org/apache/nifi/db/TableSchema.java diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/pom.xml similarity index 96% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/pom.xml rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/pom.xml index 1bf38816ae015..21dda3361153b 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/pom.xml @@ -16,7 +16,7 @@ 4.0.0 org.apache.nifi - nifi-db-adapter-provider-bundle + nifi-db-adapter-bundle 2.0.0-SNAPSHOT diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/LICENSE b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/LICENSE similarity index 100% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/LICENSE rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/LICENSE diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/NOTICE b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/NOTICE similarity index 100% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/NOTICE rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter-nar/src/main/resources/META-INF/NOTICE diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/pom.xml similarity index 88% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/pom.xml rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/pom.xml index 214953defa9de..2e740e9b4338b 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/pom.xml @@ -16,16 +16,17 @@ 4.0.0 org.apache.nifi - nifi-database-adapters + nifi-db-adapter-bundle 2.0.0-SNAPSHOT - nifi-mssql-database-adapter + nifi-db-adapter jar + org.apache.nifi - nifi-database-adapter-api + nifi-db-adapter-api 2.0.0-SNAPSHOT diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/java/org/apache/nifi/db/impl/GenericDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapter.java similarity index 87% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/java/org/apache/nifi/db/impl/GenericDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapter.java index 167209d3afd75..a3e009b911d6d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-generic-database-adapter/src/main/java/org/apache/nifi/db/impl/GenericDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapter.java @@ -14,15 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; -import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; /** * A generic database adapter that generates ANSI SQL. */ -public class GenericDatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "generic"}) +@CapabilityDescription("Adapter for a generic SQL dialect, that is understood by most databases.") +public class GenericDatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { @Override public String getName() { return "Generic"; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/OracleDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapter.java similarity index 95% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/OracleDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapter.java index 13fb29d8fb216..29945a52b4116 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/OracleDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -37,15 +37,17 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.TableSchema; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; /** * A DatabaseAdapter that generates Oracle-compliant SQL. */ -public class OracleDatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "oracle", "legacy"}) +@CapabilityDescription("Adapter for Legacy Oracle SQL dialect.") +public class LegacyOracleDatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { @Override public String getName() { return "Oracle"; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQL2008DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapter.java similarity index 91% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQL2008DatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapter.java index fac7914ea4219..85dd9b73bde3d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQL2008DatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapter.java @@ -14,14 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.util.StringUtils; /** * A database adapter that generates MS SQL Compatible SQL for version 2008. */ -public class MSSQL2008DatabaseAdapter extends MSSQLDatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "mssql", "2008", "legacy"}) +@CapabilityDescription("Adapter for Microsoft SQL 2008 dialect.") +public class MSSQL2008DatabaseAdapter extends MSSQL2012DatabaseAdapter { @Override public String getName() { return "MS SQL 2008"; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapter.java similarity index 92% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapter.java index dc539a2164ef5..0c5dc146704ab 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/java/org/apache/nifi/db/impl/MSSQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapter.java @@ -14,19 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; /** * A database adapter that generates MS SQL Compatible SQL. */ -public class MSSQLDatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "mssql", "2012"}) +@CapabilityDescription("Adapter for Microsoft SQL 2012+ dialect.") +public class MSSQL2012DatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { @Override public String getName() { return "MS SQL 2012+"; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/java/org/apache/nifi/db/impl/MySQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapter.java similarity index 96% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/java/org/apache/nifi/db/impl/MySQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapter.java index cb9275566135f..5f597a0c0711f 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/main/java/org/apache/nifi/db/impl/MySQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -34,12 +34,15 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import org.apache.nifi.db.ColumnDescription; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.util.StringUtils; /** * A generic database adapter that generates MySQL compatible SQL. */ +@Tags({"sql", "database", "syntax", "dialect", "adapter", "mysql"}) +@CapabilityDescription("Adapter for a MySQL dialect.") public class MySQLDatabaseAdapter extends GenericDatabaseAdapter { @Override public String getName() { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/Oracle12DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapter.java similarity index 96% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/Oracle12DatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapter.java index aff38f427cd57..40607c1cd7dd3 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/main/java/org/apache/nifi/db/impl/Oracle12DatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -39,12 +39,14 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.TableSchema; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; -public class Oracle12DatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "oracle", "12"}) +@CapabilityDescription("Adapter for Oracle 12+ SQL dialect.") +public class Oracle12DatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { @Override public String getName() { return "Oracle 12+"; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/java/org/apache/nifi/db/impl/PhoenixDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapter.java similarity index 95% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/java/org/apache/nifi/db/impl/PhoenixDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapter.java index be00a63ffdc2e..754f52f16a113 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/java/org/apache/nifi/db/impl/PhoenixDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -38,14 +38,17 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; /** * A Apache Phoenix database adapter that generates ANSI SQL. */ -public final class PhoenixDatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "phoenix"}) +@CapabilityDescription("Adapter for a PhoenixSQL dialect.") +public final class PhoenixDatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { public static final String NAME = "Phoenix"; @Override diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/java/org/apache/nifi/db/impl/PostgreSQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapter.java similarity index 96% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/java/org/apache/nifi/db/impl/PostgreSQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapter.java index bbe5386fc62c5..3882cb1ac9e5a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/main/java/org/apache/nifi/db/impl/PostgreSQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -35,9 +35,12 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import org.apache.nifi.db.ColumnDescription; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.util.StringUtils; +@Tags({"sql", "database", "syntax", "dialect", "adapter", "postgresql"}) +@CapabilityDescription("Adapter for a PostgreSQL dialect.") public class PostgreSQLDatabaseAdapter extends GenericDatabaseAdapter { @Override public String getName() { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService similarity index 69% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService index 3038680059379..528d74f52c279 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService @@ -12,5 +12,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -org.apache.nifi.db.impl.MSSQLDatabaseAdapter -org.apache.nifi.db.impl.MSSQL2008DatabaseAdapter +org.apache.nifi.db.GenericDatabaseAdapter +org.apache.nifi.db.MSSQL2008DatabaseAdapter +org.apache.nifi.db.MSSQL2012DatabaseAdapter +org.apache.nifi.db.MySQLDatabaseAdapter +org.apache.nifi.db.LegacyOracleDatabaseAdapter +org.apache.nifi.db.Oracle12DatabaseAdapter +org.apache.nifi.db.PhoenixDatabaseAdapter +org.apache.nifi.db.PostgreSQLDatabaseAdapter diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracleDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestLegacyOracleDatabaseAdapter.java similarity index 96% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracleDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestLegacyOracleDatabaseAdapter.java index a36fa80c4ad6b..6d324dbace47a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracleDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestLegacyOracleDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -24,14 +24,11 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.TableSchema; import org.junit.jupiter.api.Test; -public class TestOracleDatabaseAdapter { +public class TestLegacyOracleDatabaseAdapter { - private final DatabaseAdapter db = new OracleDatabaseAdapter(); + private final DatabaseAdapter db = new LegacyOracleDatabaseAdapter(); @Test public void testGeneration() { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQL2008DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2008DatabaseAdapter.java similarity index 98% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQL2008DatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2008DatabaseAdapter.java index 31ee77b84ca55..69fa52928a946 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQL2008DatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2008DatabaseAdapter.java @@ -14,12 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.apache.nifi.db.DatabaseAdapter; import org.junit.jupiter.api.Test; public class TestMSSQL2008DatabaseAdapter { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2012DatabaseAdapter.java similarity index 97% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2012DatabaseAdapter.java index dafdb92751bd9..f37e738343f22 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mssql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMSSQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMSSQL2012DatabaseAdapter.java @@ -14,16 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.apache.nifi.db.DatabaseAdapter; import org.junit.jupiter.api.Test; -public class TestMSSQLDatabaseAdapter { - final DatabaseAdapter db = new MSSQLDatabaseAdapter(); +public class TestMSSQL2012DatabaseAdapter { + final DatabaseAdapter db = new MSSQL2012DatabaseAdapter(); @Test public void testGeneration() { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMySQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMySQLDatabaseAdapter.java similarity index 99% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMySQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMySQLDatabaseAdapter.java index 43f2b8ab0e3f6..a7b6891e2d87d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-mysql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestMySQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestMySQLDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracle12DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestOracle12DatabaseAdapter.java similarity index 98% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracle12DatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestOracle12DatabaseAdapter.java index 79134c17253b9..426a1dceffe0e 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/src/test/java/org/apache/nifi/db/impl/TestOracle12DatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestOracle12DatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -25,9 +25,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.TableSchema; import org.junit.jupiter.api.Test; public class TestOracle12DatabaseAdapter { diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPhoenixDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPhoenixDatabaseAdapter.java similarity index 99% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPhoenixDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPhoenixDatabaseAdapter.java index 77907f26ea14f..ad6176921800d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPhoenixDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPhoenixDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPostgreSQLDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPostgreSQLDatabaseAdapter.java similarity index 99% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPostgreSQLDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPostgreSQLDatabaseAdapter.java index f9829184a56be..4c00cfcac6d5d 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-postgresql-database-adapter/src/test/java/org/apache/nifi/db/impl/TestPostgreSQLDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-db-adapter/src/test/java/org/apache/nifi/db/TestPostgreSQLDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/pom.xml similarity index 88% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/pom.xml rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/pom.xml index 673233604f7a0..a87717a1f6e9f 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-oracle-database-adapter/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/pom.xml @@ -16,16 +16,17 @@ 4.0.0 org.apache.nifi - nifi-database-adapters + nifi-db-adapter-bundle 2.0.0-SNAPSHOT - nifi-oracle-database-adapter + nifi-derby-db-adapter jar + org.apache.nifi - nifi-database-adapter-api + nifi-db-adapter-api 2.0.0-SNAPSHOT diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/java/org/apache/nifi/db/impl/DerbyDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapter.java similarity index 94% rename from nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/java/org/apache/nifi/db/impl/DerbyDatabaseAdapter.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapter.java index d8f7f59646acd..1fd489e8fd98a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-derby-database-adapter/src/main/java/org/apache/nifi/db/impl/DerbyDatabaseAdapter.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapter.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.db.impl; +package org.apache.nifi.db; import static java.sql.Types.CHAR; import static java.sql.Types.CLOB; @@ -31,15 +31,17 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -import org.apache.nifi.db.ColumnDescription; -import org.apache.nifi.db.DatabaseAdapter; -import org.apache.nifi.db.TableSchema; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.controller.AbstractControllerService; import org.apache.nifi.util.StringUtils; /** * An implementation of DatabaseAdapter for Derby (used for testing). */ -public class DerbyDatabaseAdapter implements DatabaseAdapter { +@Tags({"sql", "database", "syntax", "dialect", "adapter", "derby"}) +@CapabilityDescription("Adapter for Derby SQL dialect.") +public class DerbyDatabaseAdapter extends AbstractControllerService implements DatabaseAdapter { @Override public String getName() { diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapterProvider.java similarity index 60% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapterProvider.java rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapterProvider.java index 24b91a2dd36e6..9755eaa77ea80 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MySQLDatabaseAdapterProvider.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/java/org/apache/nifi/db/DerbyDatabaseAdapterProvider.java @@ -16,20 +16,14 @@ */ package org.apache.nifi.db; -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.MySQLDatabaseAdapter; - /** - * Provider implementation for MySQL dialect. + * Provider implementation for Derby SQL dialect. */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "mysql"}) -@CapabilityDescription("Provides an adapter for a MySQL dialect.") -public class MySQLDatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { +@Deprecated +public class DerbyDatabaseAdapterProvider extends DerbyDatabaseAdapter implements DatabaseAdapterProvider { @Override public DatabaseAdapter getAdapter() { - return new MySQLDatabaseAdapter(); + return this; } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService similarity index 94% rename from nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService index 68356813fe725..f6e63885e5a7b 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-adapters/nifi-phoenix-database-adapter/src/main/resources/META-INF/services/org.apache.nifi.db.DatabaseAdapter +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/nifi-derby-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService @@ -12,4 +12,4 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -org.apache.nifi.db.impl.PhoenixDatabaseAdapter +org.apache.nifi.db.DerbyDatabaseAdapterProvider diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/pom.xml similarity index 93% rename from nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/pom.xml rename to nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/pom.xml index 58fb1e9a7273d..1a9ce314007b6 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-bundle/pom.xml @@ -20,10 +20,11 @@ 2.0.0-SNAPSHOT - nifi-db-adapter-provider-bundle + nifi-db-adapter-bundle pom nifi-db-adapter-nar nifi-db-adapter + nifi-derby-db-adapter diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/pom.xml deleted file mode 100644 index 2df5ca25f1fb7..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-api/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-standard-services - 2.0.0-SNAPSHOT - - - nifi-db-adapter-provider-api - jar - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/pom.xml deleted file mode 100644 index 91b542a052be7..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - 4.0.0 - - org.apache.nifi - nifi-db-adapter-provider-bundle - 2.0.0-SNAPSHOT - - - nifi-db-adapter - jar - - - - org.apache.nifi - nifi-db-adapter-provider-api - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-database-adapter-api - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-generic-database-adapter - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-mssql-database-adapter - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-mysql-database-adapter - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-oracle-database-adapter - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-phoenix-database-adapter - 2.0.0-SNAPSHOT - - - org.apache.nifi - nifi-postgresql-database-adapter - 2.0.0-SNAPSHOT - - - diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapterProvider.java deleted file mode 100644 index ab7f6d3d41024..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/GenericDatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.GenericDatabaseAdapter; - -/** - * Provider implementation for Generic SQL dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "generic"}) -@CapabilityDescription("Provides an adapter for a generic SQL dialect, that is understood by most databases.") -public class GenericDatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new GenericDatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapterProvider.java deleted file mode 100644 index 5b55085faac82..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/LegacyOracleDatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.OracleDatabaseAdapter; - -/** - * Provider implementation for Legacy Oracle SQL dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "oracle", "legacy"}) -@CapabilityDescription("Provides an adapter for Legacy Oracle SQL dialect.") -public class LegacyOracleDatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new OracleDatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapterProvider.java deleted file mode 100644 index 1136ada32f74a..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2008DatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.MSSQL2008DatabaseAdapter; - -/** - * Provider implementation for Microsoft SQL 2008 dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "mssql", "2008", "legacy"}) -@CapabilityDescription("Provides an adapter for Microsoft SQL 2008 dialect.") -public class MSSQL2008DatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new MSSQL2008DatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapterProvider.java deleted file mode 100644 index 0849c117f2922..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/MSSQL2012DatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.MSSQLDatabaseAdapter; - -/** - * Provider implementation for Microsoft SQL 2012+ dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "mssql", "2012"}) -@CapabilityDescription("Provides an adapter for Microsoft SQL 2012+ dialect.") -public class MSSQL2012DatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new MSSQLDatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapterProvider.java deleted file mode 100644 index 9f3b1001c7a85..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/Oracle12DatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.Oracle12DatabaseAdapter; - -/** - * Provider implementation for Oracle SQL 12+ dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "oracle", "12"}) -@CapabilityDescription("Provides an adapter for Oracle 12+ SQL dialect.") -public class Oracle12DatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new Oracle12DatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapterProvider.java deleted file mode 100644 index 942e79219fed7..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PhoenixDatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.PhoenixDatabaseAdapter; - -/** - * Provider implementation for Phoenix SQL dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "phoenix"}) -@CapabilityDescription("Provides an adapter for a PhoenixSQL dialect.") -public class PhoenixDatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new PhoenixDatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapterProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapterProvider.java deleted file mode 100644 index 5ea4a629d4168..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/java/org/apache/nifi/db/PostgreSQLDatabaseAdapterProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.db; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.db.impl.PostgreSQLDatabaseAdapter; - -/** - * Provider implementation for PostgreSQL dialect. - */ -@Tags({"sql", "database", "syntax", "dialect", "adapter", "provider", "postgresql"}) -@CapabilityDescription("Provides an adapter for a PostgreSQL dialect.") -public class PostgreSQLDatabaseAdapterProvider extends AbstractControllerService implements DatabaseAdapterProvider { - - @Override - public DatabaseAdapter getAdapter() { - return new PostgreSQLDatabaseAdapter(); - } -} diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService b/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService deleted file mode 100644 index 11e62585d0aec..0000000000000 --- a/nifi-extension-bundles/nifi-standard-services/nifi-db-adapter-provider-bundle/nifi-db-adapter/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -org.apache.nifi.db.GenericDatabaseAdapterProvider -org.apache.nifi.db.MSSQL2008DatabaseAdapterProvider -org.apache.nifi.db.MSSQL2012DatabaseAdapterProvider -org.apache.nifi.db.MySQLDatabaseAdapterProvider -org.apache.nifi.db.LegacyOracleDatabaseAdapterProvider -org.apache.nifi.db.Oracle12DatabaseAdapterProvider -org.apache.nifi.db.PhoenixDatabaseAdapterProvider -org.apache.nifi.db.PostgreSQLDatabaseAdapterProvider diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml b/nifi-extension-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml index 73ab53d87786d..c2aea08d1ce00 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml @@ -61,7 +61,7 @@ org.apache.nifi - nifi-db-adapter-provider-api + nifi-db-adapter-api 2.0.0-SNAPSHOT compile diff --git a/nifi-extension-bundles/nifi-standard-services/pom.xml b/nifi-extension-bundles/nifi-standard-services/pom.xml index 8fe98bc5cf446..92053feec4837 100644 --- a/nifi-extension-bundles/nifi-standard-services/pom.xml +++ b/nifi-extension-bundles/nifi-standard-services/pom.xml @@ -57,7 +57,7 @@ nifi-web-client-provider-bundle nifi-file-resource-service-api nifi-file-resource-service-bundle - nifi-db-adapter-provider-api - nifi-db-adapter-provider-bundle + nifi-db-adapter-api + nifi-db-adapter-bundle