You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2023/02/21 21:50:25 UTC
[nifi] branch main updated: NIFI-11208 Removed Hortonworks Schema Registry
This is an automated email from the ASF dual-hosted git repository.
mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 0fa1060297 NIFI-11208 Removed Hortonworks Schema Registry
0fa1060297 is described below
commit 0fa1060297805177dcc98a0d274ade8859f26f7c
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Tue Feb 21 10:53:16 2023 -0600
NIFI-11208 Removed Hortonworks Schema Registry
Signed-off-by: Matthew Burgess <ma...@apache.org>
This closes #6980
---
NOTICE | 5 -
nifi-assembly/pom.xml | 6 -
.../nifi-hwx-schema-registry-nar/pom.xml | 34 --
.../src/main/resources/META-INF/LICENSE | 233 --------
.../src/main/resources/META-INF/NOTICE | 125 ----
.../nifi-hwx-schema-registry-service/pom.xml | 126 ----
.../hortonworks/HortonworksSchemaRegistry.java | 632 ---------------------
.../hortonworks/KerberosUserLogin.java | 69 ---
.../SchemaRegistryClientWithKerberosPassword.java | 104 ----
.../org.apache.nifi.controller.ControllerService | 16 -
.../hortonworks/HortonworksSchemaRegistryTest.java | 107 ----
.../hortonworks/TestHortonworksSchemaRegistry.java | 175 ------
.../src/test/resources/empty-schema.avsc | 6 -
.../nifi-hwx-schema-registry-bundle/pom.xml | 50 --
nifi-nar-bundles/nifi-standard-services/pom.xml | 1 -
15 files changed, 1689 deletions(-)
diff --git a/NOTICE b/NOTICE
index ffc00b29fa..8150bd7c84 100644
--- a/NOTICE
+++ b/NOTICE
@@ -122,11 +122,6 @@ This product includes derived works from Apache Commons Id (ASLv2 licensed)
and
nifi-commons/nifi-uuid5/src/main/java/org/apache/nifi/uuid5/Uuid5Util.java
-This includes derived works from Cloudera Schema Registry available under Apache Software License V2 (https://github.com/hortonworks/registry)
- Cloudera Schema Registry
- Copyright 2016-2019 Cloudera, Inc.
- The code can be found in nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/com/hortonworks/registries/schemaregistry/client/SchemaRegistryClient.java
-
This includes derived works from Apache Kafka available under Apache Software License V2
Copyright 2021 The Apache Software Foundation.
The derived work is adapted from
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index e4f16e93d2..093bba00e3 100644
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -756,12 +756,6 @@ language governing permissions and limitations under the License. -->
<version>2.0.0-SNAPSHOT</version>
<type>nar</type>
</dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-hwx-schema-registry-nar</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <type>nar</type>
- </dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-redis-service-api-nar</artifactId>
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/pom.xml b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/pom.xml
deleted file mode 100644
index f57c0686fb..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/pom.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-hwx-schema-registry-bundle</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
- <artifactId>nifi-hwx-schema-registry-nar</artifactId>
- <packaging>nar</packaging>
- <dependencies>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-standard-services-api-nar</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <type>nar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-hwx-schema-registry-service</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index ca0bdb3a86..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,233 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
-
- The binary distribution of this product bundles 'ParaNamer'
- which is available under a BSD style license.
-
- Copyright (c) 2006 Paul Hammant & ThoughtWorks Inc
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 9320582165..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-nar/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,125 +0,0 @@
-nifi-hwx-schema-registry-nar
-Copyright 2017-2020 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-===========================================
-Apache Software License v2
-===========================================
-
-The following binary components are provided under the Apache Software License v2
-
- (ASLv2) Hortonworks Schema Registry
- The following NOTICE information applies:
- Hortonworks Schema Registry
- Copyright 2016-2017 Hortonworks, Inc.
-
- (ASLv2) Apache Commons IO
- The following NOTICE information applies:
- Apache Commons IO
- Copyright 2002-2016 The Apache Software Foundation
-
- (ASLv2) Apache Commons Lang
- The following NOTICE information applies:
- Apache Commons Lang
- Copyright 2001-2015 The Apache Software Foundation
-
- (ASLv2) Apache Avro
- The following NOTICE information applies:
- Apache Avro
- Copyright 2009-2017 The Apache Software Foundation
-
- (ASLv2) Apache Commons Compress
- The following NOTICE information applies:
- Apache Commons Compress
- Copyright 2002-2017 The Apache Software Foundation
-
- The files in the package org.apache.commons.compress.archivers.sevenz
- were derived from the LZMA SDK, version 9.20 (C/ and CPP/7zip/),
- which has been placed in the public domain:
-
- "LZMA SDK is placed in the public domain." (http://www.7-zip.org/sdk.html)
-
- (ASLv2) Apache Commons Lang
- The following NOTICE information applies:
- Apache Commons Lang
- Copyright 2001-2015 The Apache Software Foundation
-
- This product includes software from the Spring Framework,
- under the Apache License 2.0 (see: StringUtils.containsWhitespace())
-
- (ASLv2) Guava
- The following NOTICE information applies:
- Guava
- Copyright 2015 The Guava Authors
-
- (ASLv2) Jackson JSON processor
- The following NOTICE information applies:
- # Jackson JSON processor
-
- Jackson is a high-performance, Free/Open Source JSON processing library.
- It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
- been in development since 2007.
- It is currently developed by a community of developers, as well as supported
- commercially by FasterXML.com.
-
- ## Licensing
-
- Jackson core and extension components may licensed under different licenses.
- To find the details that apply to this artifact see the accompanying LICENSE file.
- For more information, including possible other licensing options, contact
- FasterXML.com (http://fasterxml.com).
-
- ## Credits
-
- A list of contributors may be found from CREDITS file, which is included
- in some artifacts (usually source distributions); but is always available
- from the source code management (SCM) system project uses.
-
- (ASLv2) Snappy Java
- The following NOTICE information applies:
- This product includes software developed by Google
- Snappy: http://code.google.com/p/snappy/ (New BSD License)
-
- This product includes software developed by Apache
- PureJavaCrc32C from apache-hadoop-common http://hadoop.apache.org/
- (Apache 2.0 license)
-
- This library containd statically linked libstdc++. This inclusion is allowed by
- "GCC RUntime Library Exception"
- http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
-
- (ASLv2) Spring Framework (Aop, Beans, Context, Core, Expression)
- The following NOTICE information applies:
- Spring Framework
- Copyright (c) 2002-2017 Pivotal, Inc.
-
-
-************************
-Common Development and Distribution License 1.1
-************************
-
-The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details.
-
- (CDDL 1.1) (GPL2 w/ CPE) ServiceLocator Default Implementation (org.glassfish.hk2:hk2-locator:jar:2.4.0-b25 - https://hk2.java.net/hk2-locator)
- (CDDL 1.1) (GPL2 w/ CPE) HK2 API module (org.glassfish.hk2:hk2-api:jar:2.4.0-b25 - https://hk2.java.net/hk2-api)
- (CDDL 1.1) (GPL2 w/ CPE) HK2 Implementation Utilities (org.glassfish.hk2:hk2-utils:jar:2.4.0-b25 - https://hk2.java.net/hk2-utils)
- (CDDL 1.1) (GPL2 w/ CPE) javax.annotation API (javax.annotation:javax.annotation-api:jar:1.2 - http://jcp.org/en/jsr/detail?id=250)
- (CDDL 1.1) (GPL2 w/ CPE) javax.inject:1 as OSGi bundle (org.glassfish.hk2.external:javax.inject:jar:2.4.0-b25 - https://hk2.java.net/external/javax.inject)
- (CDDL 1.1) (GPL2 w/ CPE) javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:jar:2.0.1 - http://jax-rs-spec.java.net)
- (CDDL 1.1) (GPL2 w/ CPE) jersey-client (org.glassfish.jersey.core:jersey-client:jar:2.22.1 - https://jersey.github.io/)
- (CDDL 1.1) (GPL2 w/ CPE) jersey-common (org.glassfish.jersey.core:jersey-common:jar:2.22.1 - https://jersey.github.io/)
- (CDDL 1.1) (GPL2 w/ CPE) jersey-guava (org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.22.1 - https://jersey.github.io/)
- (CDDL 1.1) (GPL2 w/ CPE) jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:jar:2.22.1 - https://jersey.github.io/)
- (CDDL 1.1) (GPL2 w/ CPE) MIME Streaming Extension (org.jvnet.mimepull:mimepull:jar:1.9.3 - http://mimepull.java.net)
- (CDDL 1.1) (GPL2 w/ CPE) aopalliance version 1.0 repackaged as a module (org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b25 - https://hk2.java.net/external/aopalliance-repackaged)
-
-
-*****************
-Public Domain
-*****************
-
-The following binary components are provided to the 'Public Domain'. See project link for details.
-
- (Public Domain) XZ for Java (org.tukaani:xz:jar:1.5 - http://tukaani.org/xz/java.html
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/pom.xml b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/pom.xml
deleted file mode 100644
index 12c6b1889d..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-hwx-schema-registry-bundle</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nifi-hwx-schema-registry-service</artifactId>
- <packaging>jar</packaging>
- <dependencies>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-utils</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-security-kerberos</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-record</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-avro-record-utils</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-schema-registry-service-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-ssl-context-service-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-kerberos-credentials-service-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro</artifactId>
- </dependency>
-
- <!-- Schema Registry Client-->
- <dependency>
- <groupId>com.hortonworks.registries</groupId>
- <artifactId>schema-registry-client</artifactId>
- <version>${hwx.registry.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-crypto</artifactId>
- </dependency>
- <dependency>
- <groupId>com.github.stephenc.findbugs</groupId>
- <artifactId>findbugs-annotations</artifactId>
- <version>1.3.9-1</version>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-multipart</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-mock</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
- <exclude>src/test/resources/empty-schema.avsc</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistry.java b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistry.java
deleted file mode 100644
index 610463c12b..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistry.java
+++ /dev/null
@@ -1,632 +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.schemaregistry.hortonworks;
-
-import com.hortonworks.registries.schemaregistry.SchemaIdVersion;
-import com.hortonworks.registries.schemaregistry.SchemaMetadata;
-import com.hortonworks.registries.schemaregistry.SchemaMetadataInfo;
-import com.hortonworks.registries.schemaregistry.SchemaVersionInfo;
-import com.hortonworks.registries.schemaregistry.SchemaVersionKey;
-import com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient;
-import com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException;
-import org.apache.avro.Schema;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
-import org.apache.nifi.annotation.documentation.DeprecationNotice;
-import org.apache.nifi.annotation.documentation.Tags;
-import org.apache.nifi.annotation.lifecycle.OnDisabled;
-import org.apache.nifi.annotation.lifecycle.OnEnabled;
-import org.apache.nifi.avro.AvroTypeUtil;
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.components.ValidationContext;
-import org.apache.nifi.components.ValidationResult;
-import org.apache.nifi.controller.AbstractControllerService;
-import org.apache.nifi.controller.ConfigurationContext;
-import org.apache.nifi.expression.ExpressionLanguageScope;
-import org.apache.nifi.kerberos.KerberosCredentialsService;
-import org.apache.nifi.processor.util.StandardValidators;
-import org.apache.nifi.reporting.InitializationException;
-import org.apache.nifi.schema.access.SchemaField;
-import org.apache.nifi.schemaregistry.services.SchemaRegistry;
-import org.apache.nifi.serialization.record.RecordSchema;
-import org.apache.nifi.serialization.record.SchemaIdentifier;
-import org.apache.nifi.ssl.SSLContextService;
-import org.apache.nifi.util.Tuple;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.OptionalInt;
-import java.util.OptionalLong;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-
-@Tags({"schema", "registry", "avro", "hortonworks", "hwx"})
-@CapabilityDescription("Provides a Schema Registry Service that interacts with a Hortonworks Schema Registry, available at https://github.com/hortonworks/registry")
-@DeprecationNotice(reason = "This controller service is deprecated and will be removed in NiFi 2.x.")
-public class HortonworksSchemaRegistry extends AbstractControllerService implements SchemaRegistry {
- private static final Set<SchemaField> schemaFields = EnumSet.of(SchemaField.SCHEMA_NAME,
- SchemaField.SCHEMA_BRANCH_NAME,
- SchemaField.SCHEMA_TEXT,
- SchemaField.SCHEMA_TEXT_FORMAT,
- SchemaField.SCHEMA_IDENTIFIER,
- SchemaField.SCHEMA_VERSION,
- SchemaField.SCHEMA_VERSION_ID);
-
- private static final String CLIENT_SSL_PROPERTY_PREFIX = "schema.registry.client.ssl";
-
- private final ConcurrentMap<Tuple<SchemaIdentifier, String>, RecordSchema> schemaNameToSchemaMap = new ConcurrentHashMap<>();
- private final ConcurrentMap<Tuple<String, String>, Tuple<SchemaVersionInfo, Long>> schemaVersionByNameCache = new ConcurrentHashMap<>();
- private final ConcurrentMap<SchemaVersionKey, Tuple<SchemaVersionInfo, Long>> schemaVersionByKeyCache = new ConcurrentHashMap<>();
-
- private volatile long versionInfoCacheNanos;
-
- static final PropertyDescriptor URL = new PropertyDescriptor.Builder()
- .name("url")
- .displayName("Schema Registry URL")
- .description("URL of the schema registry that this Controller Service should connect to, including version. For example, http://localhost:9090/api/v1")
- .addValidator(StandardValidators.URL_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .required(true)
- .build();
-
- static final PropertyDescriptor CACHE_SIZE = new PropertyDescriptor.Builder()
- .name("cache-size")
- .displayName("Cache Size")
- .description("Specifies how many Schemas should be cached from the Hortonworks Schema Registry")
- .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
- .defaultValue("1000")
- .required(true)
- .build();
-
- static final PropertyDescriptor CACHE_EXPIRATION = new PropertyDescriptor.Builder()
- .name("cache-expiration")
- .displayName("Cache Expiration")
- .description("Specifies how long a Schema that is cached should remain in the cache. Once this time period elapses, a "
- + "cached version of a schema will no longer be used, and the service will have to communicate with the "
- + "Hortonworks Schema Registry again in order to obtain the schema.")
- .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
- .defaultValue("1 hour")
- .required(true)
- .build();
-
- static final PropertyDescriptor SSL_CONTEXT_SERVICE = new PropertyDescriptor.Builder()
- .name("ssl-context-service")
- .displayName("SSL Context Service")
- .description("Specifies the SSL Context Service to use for communicating with Schema Registry.")
- .required(false)
- .identifiesControllerService(SSLContextService.class)
- .build();
-
- static final PropertyDescriptor KERBEROS_CREDENTIALS_SERVICE = new PropertyDescriptor.Builder()
- .name("kerberos-credentials-service")
- .displayName("Kerberos Credentials Service")
- .description("Specifies the Kerberos Credentials Controller Service that should be used for authenticating with Kerberos")
- .identifiesControllerService(KerberosCredentialsService.class)
- .required(false)
- .build();
-
- static final PropertyDescriptor KERBEROS_PRINCIPAL = new PropertyDescriptor.Builder()
- .name("kerberos-principal")
- .displayName("Kerberos Principal")
- .description("The kerberos principal to authenticate with when not using the kerberos credentials service")
- .defaultValue(null)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .build();
-
- static final PropertyDescriptor KERBEROS_PASSWORD = new PropertyDescriptor.Builder()
- .name("kerberos-password")
- .displayName("Kerberos Password")
- .description("The password for the kerberos principal when not using the kerberos credentials service")
- .defaultValue(null)
- .required(false)
- .sensitive(true)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .build();
-
- static final PropertyDescriptor BASIC_AUTH_USERNAME = new PropertyDescriptor.Builder()
- .name("basic-auth-username")
- .displayName("Basic Authentication Username")
- .description("The username to use for basic authentication when the Schema Registry is behind a proxy such as Apache Knox.")
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .dependsOn(SSL_CONTEXT_SERVICE)
- .build();
-
- static final PropertyDescriptor BASIC_AUTH_PASSWORD = new PropertyDescriptor.Builder()
- .name("basic-auth-password")
- .displayName("Basic Authentication Password")
- .description("The password to use for basic authentication when the Schema Registry is behind a proxy such as Apache Knox.")
- .sensitive(true)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .dependsOn(SSL_CONTEXT_SERVICE)
- .build();
-
- private volatile boolean usingKerberosWithPassword = false;
- private volatile SchemaRegistryClient schemaRegistryClient;
- private volatile boolean initialized;
- private volatile Map<String, Object> schemaRegistryConfig;
-
- @Override
- protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) {
- final List<ValidationResult> results = new ArrayList<>();
-
- final String kerberosPrincipal = validationContext.getProperty(KERBEROS_PRINCIPAL).evaluateAttributeExpressions().getValue();
- final String kerberosPassword = validationContext.getProperty(KERBEROS_PASSWORD).getValue();
-
- final String basicAuthUsername = validationContext.getProperty(BASIC_AUTH_USERNAME).evaluateAttributeExpressions().getValue();
-
- final KerberosCredentialsService kerberosCredentialsService = validationContext.getProperty(KERBEROS_CREDENTIALS_SERVICE)
- .asControllerService(KerberosCredentialsService.class);
-
- if (kerberosCredentialsService != null && !StringUtils.isBlank(kerberosPrincipal) && !StringUtils.isBlank(kerberosPassword)) {
- results.add(new ValidationResult.Builder()
- .subject(KERBEROS_CREDENTIALS_SERVICE.getDisplayName())
- .valid(false)
- .explanation("kerberos principal/password and kerberos credential service cannot be configured at the same time")
- .build());
- }
-
- if (!StringUtils.isBlank(kerberosPrincipal) && StringUtils.isBlank(kerberosPassword)) {
- results.add(new ValidationResult.Builder()
- .subject(KERBEROS_PASSWORD.getDisplayName())
- .valid(false)
- .explanation("kerberos password is required when specifying a kerberos principal")
- .build());
- }
-
- if (StringUtils.isBlank(kerberosPrincipal) && !StringUtils.isBlank(kerberosPassword)) {
- results.add(new ValidationResult.Builder()
- .subject(KERBEROS_PRINCIPAL.getDisplayName())
- .valid(false)
- .explanation("kerberos principal is required when specifying a kerberos password")
- .build());
- }
-
- if ((validationContext.getProperty(BASIC_AUTH_USERNAME).isSet() || validationContext.getProperty(BASIC_AUTH_PASSWORD).isSet())
- && !validationContext.getProperty(SSL_CONTEXT_SERVICE).isSet()) {
- results.add(new ValidationResult.Builder()
- .subject(BASIC_AUTH_USERNAME.getDisplayName())
- .valid(false)
- .explanation("SSL Context Service must be set when using basic authentication")
- .build());
- }
-
- if ((!StringUtils.isBlank(kerberosPrincipal) || kerberosCredentialsService != null ) && !StringUtils.isBlank(basicAuthUsername)) {
- results.add(new ValidationResult.Builder()
- .subject(BASIC_AUTH_USERNAME.getDisplayName())
- .valid(false)
- .explanation("kerberos- and basic authentication cannot be configured at the same time")
- .build());
- }
-
- return results;
- }
-
- @OnEnabled
- public void enable(final ConfigurationContext context) throws InitializationException {
- schemaRegistryConfig = new HashMap<>();
-
- versionInfoCacheNanos = context.getProperty(CACHE_EXPIRATION).asTimePeriod(TimeUnit.NANOSECONDS);
-
- // The below properties may or may not need to be exposed to the end
- // user. We just need to watch usage patterns to see if sensible default
- // can satisfy NiFi requirements
- String urlValue = context.getProperty(URL).evaluateAttributeExpressions().getValue();
- if (urlValue == null || urlValue.trim().isEmpty()) {
- throw new IllegalArgumentException("'Schema Registry URL' must not be null or empty.");
- }
-
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL.name(), urlValue);
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.CLASSLOADER_CACHE_SIZE.name(), 10);
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.CLASSLOADER_CACHE_EXPIRY_INTERVAL_SECS.name(), context.getProperty(CACHE_EXPIRATION).asTimePeriod(TimeUnit.SECONDS).intValue());
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.SCHEMA_VERSION_CACHE_SIZE.name(), context.getProperty(CACHE_SIZE).asInteger());
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.SCHEMA_VERSION_CACHE_EXPIRY_INTERVAL_SECS.name(), context.getProperty(CACHE_EXPIRATION).asTimePeriod(TimeUnit.SECONDS).intValue());
- Map<String, String> sslProperties = buildSslProperties(context);
- if (!sslProperties.isEmpty()) {
- schemaRegistryConfig.put(CLIENT_SSL_PROPERTY_PREFIX, sslProperties);
- }
-
- final String kerberosPrincipal = context.getProperty(KERBEROS_PRINCIPAL).evaluateAttributeExpressions().getValue();
- final String kerberosPassword = context.getProperty(KERBEROS_PASSWORD).getValue();
-
- final KerberosCredentialsService kerberosCredentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE)
- .asControllerService(KerberosCredentialsService.class);
-
- if (kerberosCredentialsService != null) {
- final String principal = kerberosCredentialsService.getPrincipal();
- final String keytab = kerberosCredentialsService.getKeytab();
- final String jaasConfigString = getKeytabJaasConfig(principal, keytab);
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.SASL_JAAS_CONFIG.name(), jaasConfigString);
- usingKerberosWithPassword = false;
- } else if (!StringUtils.isBlank(kerberosPrincipal) && !StringUtils.isBlank(kerberosPassword)) {
- schemaRegistryConfig.put(SchemaRegistryClientWithKerberosPassword.SCHEMA_REGISTRY_CLIENT_KERBEROS_PRINCIPAL, kerberosPrincipal);
- schemaRegistryConfig.put(SchemaRegistryClientWithKerberosPassword.SCHEMA_REGISTRY_CLIENT_KERBEROS_PASSWORD, kerberosPassword);
- schemaRegistryConfig.put(SchemaRegistryClientWithKerberosPassword.SCHEMA_REGISTRY_CLIENT_NIFI_COMP_LOGGER, getLogger());
- usingKerberosWithPassword = true;
- }
-
- if (context.getProperty(BASIC_AUTH_USERNAME).isSet()) {
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.AUTH_USERNAME.name(), context.getProperty(BASIC_AUTH_USERNAME).getValue());
- }
-
- if (context.getProperty(BASIC_AUTH_PASSWORD).isSet()) {
- schemaRegistryConfig.put(SchemaRegistryClient.Configuration.AUTH_PASSWORD.name(), context.getProperty(BASIC_AUTH_PASSWORD).getValue());
- }
- }
-
- private String getKeytabJaasConfig(final String principal, final String keytab) {
- return "com.sun.security.auth.module.Krb5LoginModule required "
- + "useTicketCache=false "
- + "renewTicket=true "
- + "useKeyTab=true "
- + "keyTab=\"" + keytab + "\" "
- + "principal=\"" + principal + "\";";
- }
-
- private Map<String, String> buildSslProperties(final ConfigurationContext context) {
- final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
- final Map<String, String> propertiesBuilder = new HashMap<>();
- if (sslContextService != null) {
- propertiesBuilder.put("protocol", sslContextService.getSslAlgorithm());
- if (sslContextService.isKeyStoreConfigured()) {
- propertiesBuilder.put("keyStorePath", sslContextService.getKeyStoreFile());
- propertiesBuilder.put("keyStorePassword", sslContextService.getKeyStorePassword());
- propertiesBuilder.put("keyStoreType", sslContextService.getKeyStoreType());
- if (sslContextService.getKeyPassword() != null) {
- propertiesBuilder.put("keyPassword", sslContextService.getKeyPassword());
- }
- }
- if (sslContextService.isTrustStoreConfigured()) {
- propertiesBuilder.put("trustStorePath", sslContextService.getTrustStoreFile());
- propertiesBuilder.put("trustStorePassword", sslContextService.getTrustStorePassword());
- propertiesBuilder.put("trustStoreType", sslContextService.getTrustStoreType());
- }
- }
- return Collections.unmodifiableMap(propertiesBuilder);
- }
-
- @OnDisabled
- public void close() {
- if (schemaRegistryClient != null) {
- schemaRegistryClient.close();
- }
-
- initialized = false;
- usingKerberosWithPassword = false;
- }
-
-
- @Override
- protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- final List<PropertyDescriptor> properties = new ArrayList<>();
- properties.add(URL);
- properties.add(CACHE_SIZE);
- properties.add(CACHE_EXPIRATION);
- properties.add(SSL_CONTEXT_SERVICE);
- properties.add(KERBEROS_CREDENTIALS_SERVICE);
- properties.add(KERBEROS_PRINCIPAL);
- properties.add(KERBEROS_PASSWORD);
- properties.add(BASIC_AUTH_USERNAME);
- properties.add(BASIC_AUTH_PASSWORD);
- return properties;
- }
-
-
- protected synchronized SchemaRegistryClient getClient() {
- if (!initialized) {
- if (usingKerberosWithPassword) {
- schemaRegistryClient = new SchemaRegistryClientWithKerberosPassword(schemaRegistryConfig);
- } else {
- schemaRegistryClient = new SchemaRegistryClient(schemaRegistryConfig);
- }
- initialized = true;
- }
-
- return schemaRegistryClient;
- }
-
- private SchemaVersionInfo getLatestSchemaVersionInfo(final SchemaRegistryClient client, final String schemaName, final String branchName)
- throws org.apache.nifi.schema.access.SchemaNotFoundException {
- try {
- // Try to fetch the SchemaVersionInfo from the cache.
- final Tuple<String, String> nameAndBranch = new Tuple<>(schemaName, branchName);
- final Tuple<SchemaVersionInfo, Long> timestampedVersionInfo = schemaVersionByNameCache.get(nameAndBranch);
-
- // Determine if the timestampedVersionInfo is expired
- boolean fetch = false;
- if (timestampedVersionInfo == null) {
- fetch = true;
- } else {
- final long minTimestamp = System.nanoTime() - versionInfoCacheNanos;
- fetch = timestampedVersionInfo.getValue() < minTimestamp;
- }
-
- // If not expired, use what we got from the cache
- if (!fetch) {
- return timestampedVersionInfo.getKey();
- }
-
- // schema version info was expired or not found in cache. Fetch from schema registry
- final SchemaVersionInfo versionInfo;
- if (StringUtils.isBlank(branchName)) {
- versionInfo = client.getLatestSchemaVersionInfo(schemaName);
- } else {
- versionInfo = client.getLatestSchemaVersionInfo(branchName, schemaName);
- }
-
- if (versionInfo == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with name '" + schemaName + "'");
- }
-
- // Store new version in cache.
- final Tuple<SchemaVersionInfo, Long> tuple = new Tuple<>(versionInfo, System.nanoTime());
- schemaVersionByNameCache.put(nameAndBranch, tuple);
- return versionInfo;
- } catch (final SchemaNotFoundException e) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException(e);
- }
- }
-
- private SchemaVersionInfo getSchemaVersionInfo(final SchemaRegistryClient client, final SchemaVersionKey key) throws org.apache.nifi.schema.access.SchemaNotFoundException {
- try {
- // Try to fetch the SchemaVersionInfo from the cache.
- final Tuple<SchemaVersionInfo, Long> timestampedVersionInfo = schemaVersionByKeyCache.get(key);
-
- // Determine if the timestampedVersionInfo is expired
- boolean fetch = false;
- if (timestampedVersionInfo == null) {
- fetch = true;
- } else {
- final long minTimestamp = System.nanoTime() - versionInfoCacheNanos;
- fetch = timestampedVersionInfo.getValue() < minTimestamp;
- }
-
- // If not expired, use what we got from the cache
- if (!fetch) {
- return timestampedVersionInfo.getKey();
- }
-
- // schema version info was expired or not found in cache. Fetch from schema registry
- final SchemaVersionInfo versionInfo = client.getSchemaVersionInfo(key);
- if (versionInfo == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with name '" + key.getSchemaName() + "' and version " + key.getVersion());
- }
-
- // Store new version in cache.
- final Tuple<SchemaVersionInfo, Long> tuple = new Tuple<>(versionInfo, System.nanoTime());
- schemaVersionByKeyCache.put(key, tuple);
- return versionInfo;
- } catch (final SchemaNotFoundException e) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException(e);
- }
- }
-
- private RecordSchema retrieveSchemaByName(final SchemaIdentifier schemaIdentifier) throws org.apache.nifi.schema.access.SchemaNotFoundException, IOException {
-
- final SchemaRegistryClient client = getClient();
-
- final SchemaVersionInfo versionInfo;
- final Long schemaId;
-
- final Optional<String> schemaName = schemaIdentifier.getName();
- if (!schemaName.isPresent()) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Name is not present");
- }
-
- final Optional<String> schemaBranchName = schemaIdentifier.getBranch();
- final OptionalInt schemaVersion = schemaIdentifier.getVersion();
-
- try {
- final SchemaMetadataInfo metadataInfo = client.getSchemaMetadataInfo(schemaName.get());
- if (metadataInfo == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with name '" + schemaName + "'");
- }
-
- schemaId = metadataInfo.getId();
- if (schemaId == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with name '" + schemaName + "'");
- }
-
- // possible scenarios are name only, name + branch, or name + version
- if (schemaVersion.isPresent()) {
- final SchemaVersionKey schemaVersionKey = new SchemaVersionKey(schemaName.get(), schemaVersion.getAsInt());
- versionInfo = getSchemaVersionInfo(client, schemaVersionKey);
- } else {
- versionInfo = getLatestSchemaVersionInfo(client, schemaName.get(), schemaBranchName.orElse(null));
- }
-
- if (versionInfo == null || versionInfo.getVersion() == null) {
- final String message = createErrorMessage("Could not find schema", schemaName, schemaBranchName, schemaVersion);
- throw new org.apache.nifi.schema.access.SchemaNotFoundException(message);
- }
-
- } catch (final Exception e) {
- final String message = createErrorMessage("Failed to retrieve schema", schemaName, schemaBranchName, schemaVersion);
- handleException(message, e);
- return null;
- }
-
- final String schemaText = versionInfo.getSchemaText();
-
- final SchemaIdentifier resultSchemaIdentifier = SchemaIdentifier.builder()
- .id(schemaId)
- .name(schemaName.get())
- .branch(schemaBranchName.orElse(null))
- .version(versionInfo.getVersion())
- .schemaVersionId(versionInfo.getId())
- .build();
-
- final Tuple<SchemaIdentifier, String> tuple = new Tuple<>(resultSchemaIdentifier, schemaText);
- return schemaNameToSchemaMap.computeIfAbsent(tuple, t -> {
- final Schema schema = new Schema.Parser().parse(schemaText);
- return AvroTypeUtil.createSchema(schema, schemaText, resultSchemaIdentifier);
- });
- }
-
- private RecordSchema retrieveSchemaByIdAndVersion(final SchemaIdentifier schemaIdentifier) throws org.apache.nifi.schema.access.SchemaNotFoundException, IOException {
- final SchemaRegistryClient client = getClient();
-
- final String schemaName;
- final SchemaVersionInfo versionInfo;
-
- final OptionalLong schemaId = schemaIdentifier.getIdentifier();
- if (!schemaId.isPresent()) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Id is not present");
- }
-
- final OptionalInt version = schemaIdentifier.getVersion();
- if (!version.isPresent()) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema because Schema Version is not present");
- }
-
- try {
- final SchemaMetadataInfo info = client.getSchemaMetadataInfo(schemaId.getAsLong());
- if (info == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with ID '" + schemaId + "' and version '" + version + "'");
- }
-
- final SchemaMetadata metadata = info.getSchemaMetadata();
- schemaName = metadata.getName();
-
- final SchemaVersionKey schemaVersionKey = new SchemaVersionKey(schemaName, version.getAsInt());
- versionInfo = getSchemaVersionInfo(client, schemaVersionKey);
- if (versionInfo == null) {
- throw new org.apache.nifi.schema.access.SchemaNotFoundException("Could not find schema with ID '" + schemaId + "' and version '" + version + "'");
- }
- } catch (final Exception e) {
- handleException("Failed to retrieve schema with ID '" + schemaId + "' and version '" + version + "'", e);
- return null;
- }
-
- final String schemaText = versionInfo.getSchemaText();
-
- final SchemaIdentifier resultSchemaIdentifier = SchemaIdentifier.builder()
- .name(schemaName)
- .id(schemaId.getAsLong())
- .version(version.getAsInt())
- .schemaVersionId(versionInfo.getId())
- .build();
-
- final Tuple<SchemaIdentifier, String> tuple = new Tuple<>(resultSchemaIdentifier, schemaText);
- return schemaNameToSchemaMap.computeIfAbsent(tuple, t -> {
- final Schema schema = new Schema.Parser().parse(schemaText);
- return AvroTypeUtil.createSchema(schema, schemaText, resultSchemaIdentifier);
- });
- }
-
- @Override
- public RecordSchema retrieveSchema(final SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException {
- if (schemaIdentifier.getSchemaVersionId().isPresent()) {
- return retrieveSchemaBySchemaVersionId(schemaIdentifier);
- } else if (schemaIdentifier.getIdentifier().isPresent()) {
- return retrieveSchemaByIdAndVersion(schemaIdentifier);
- } else {
- return retrieveSchemaByName(schemaIdentifier);
- }
- }
-
- private RecordSchema retrieveSchemaBySchemaVersionId(final SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException {
- final SchemaRegistryClient client = getClient();
- final OptionalLong schemaVersionId = schemaIdentifier.getSchemaVersionId();
-
- final SchemaIdVersion svi = new SchemaIdVersion(schemaVersionId.getAsLong());
-
- final String schemaName;
- final SchemaVersionInfo versionInfo;
-
- try {
- versionInfo = client.getSchemaVersionInfo(svi);
- schemaName = versionInfo.getName();
- } catch (final Exception e) {
- handleException("Failed to retrieve schema with Schema Version ID '" + schemaVersionId.getAsLong() + "'", e);
- return null;
- }
-
- final String schemaText = versionInfo.getSchemaText();
-
- final SchemaIdentifier resultSchemaIdentifier = SchemaIdentifier.builder()
- .name(schemaName)
- .id(versionInfo.getSchemaMetadataId())
- .version(versionInfo.getVersion())
- .schemaVersionId(schemaVersionId.getAsLong())
- .build();
-
- final Tuple<SchemaIdentifier, String> tuple = new Tuple<>(resultSchemaIdentifier, schemaText);
- return schemaNameToSchemaMap.computeIfAbsent(tuple, t -> {
- final Schema schema = new Schema.Parser().parse(schemaText);
- return AvroTypeUtil.createSchema(schema, schemaText, resultSchemaIdentifier);
- });
- }
-
- private String createErrorMessage(final String baseMessage, final Optional<String> schemaName, final Optional<String> branchName, final OptionalInt version) {
- final StringBuilder builder = new StringBuilder(baseMessage)
- .append(" with name '")
- .append(schemaName.orElse("null"))
- .append("'");
-
- if (branchName.isPresent()) {
- builder.append(" and branch '").append(branchName.get()).append("'");
- }
-
- if (version.isPresent()) {
- builder.append(" and version '").append(version.getAsInt()).append("'");
- }
-
- return builder.toString();
- }
-
- // The schema registry client wraps all IOExceptions in RuntimeException. So if an IOException occurs, we don't know
- // that it was an IO problem. So we will look through the Exception's cause chain to see if there is an IOException present.
- private void handleException(final String message, final Exception e) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException {
- if (containsIOException(e)) {
- throw new IOException(message, e);
- }
-
- throw new org.apache.nifi.schema.access.SchemaNotFoundException(message, e);
- }
-
- private boolean containsIOException(final Throwable t) {
- if (t == null) {
- return false;
- }
-
- if (t instanceof IOException) {
- return true;
- }
-
- final Throwable cause = t.getCause();
- if (cause == null) {
- return false;
- }
-
- return containsIOException(cause);
- }
-
- @Override
- public Set<SchemaField> getSuppliedSchemaFields() {
- return schemaFields;
- }
-}
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/KerberosUserLogin.java b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/KerberosUserLogin.java
deleted file mode 100644
index aac8960159..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/KerberosUserLogin.java
+++ /dev/null
@@ -1,69 +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.schemaregistry.hortonworks;
-
-import com.hortonworks.registries.auth.Login;
-import org.apache.nifi.logging.ComponentLog;
-import org.apache.nifi.security.krb.KerberosAction;
-import org.apache.nifi.security.krb.KerberosUser;
-
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.util.Map;
-
-/**
- * Implementation of Schema Registry's Login interface that wraps NiFi's KerberosUser API.
- */
-public class KerberosUserLogin implements Login {
-
- private final KerberosUser kerberosUser;
- private final ComponentLog logger;
-
- public KerberosUserLogin(final KerberosUser kerberosUser, final ComponentLog logger) {
- this.kerberosUser = kerberosUser;
- this.logger = logger;
- }
-
- @Override
- public void configure(Map<String, ?> configs, String loginContextName) {
-
- }
-
- @Override
- public LoginContext login() {
- kerberosUser.login();
-
- // the KerberosUser doesn't expose the LoginContext, but SchemaRegistryClient doesn't use
- // the returned context at all, so we just return null here
- return null;
- }
-
- @Override
- public <T> T doAction(PrivilegedAction<T> action) throws LoginException {
- final PrivilegedExceptionAction<T> wrappedAction = () -> action.run();
- final KerberosAction<T> kerberosAction = new KerberosAction<T>(kerberosUser, wrappedAction, logger);
- return kerberosAction.execute();
- }
-
- @Override
- public void close() {
-
- }
-
-}
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/SchemaRegistryClientWithKerberosPassword.java b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/SchemaRegistryClientWithKerberosPassword.java
deleted file mode 100644
index af644a24ff..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/java/org/apache/nifi/schemaregistry/hortonworks/SchemaRegistryClientWithKerberosPassword.java
+++ /dev/null
@@ -1,104 +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.schemaregistry.hortonworks;
-
-import com.hortonworks.registries.auth.Login;
-import com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient;
-import org.apache.nifi.logging.ComponentLog;
-import org.apache.nifi.security.krb.KerberosLoginException;
-import org.apache.nifi.security.krb.KerberosPasswordUser;
-import org.apache.nifi.security.krb.KerberosUser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.security.auth.login.LoginException;
-import java.lang.reflect.Field;
-import java.util.Map;
-
-/**
- * Extend the SchemaRegistryClient so we can override the initialization of the security context and use
- * the KerberosUserLogin implementation that lets us login with a principal/password.
- */
-public class SchemaRegistryClientWithKerberosPassword extends SchemaRegistryClient {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SchemaRegistryClientWithKerberosPassword.class);
-
- public static final String SCHEMA_REGISTRY_CLIENT_KERBEROS_PRINCIPAL = "schema.registry.client.kerberos.principal";
- public static final String SCHEMA_REGISTRY_CLIENT_KERBEROS_PASSWORD = "schema.registry.client.kerberos.password";
- public static final String SCHEMA_REGISTRY_CLIENT_NIFI_COMP_LOGGER = "schema.registry.client.nifi.component.logger";
-
- private KerberosUser kerberosUser;
-
- public SchemaRegistryClientWithKerberosPassword(final Map<String, ?> conf) {
- super(conf);
- }
-
- @Override
- protected void initializeSecurityContext() {
- final String principal = getConfiguration().getValue(SCHEMA_REGISTRY_CLIENT_KERBEROS_PRINCIPAL);
- if (principal == null) {
- throw new IllegalArgumentException("Failed to login because principal is null");
- }
-
- final String password = getConfiguration().getValue(SCHEMA_REGISTRY_CLIENT_KERBEROS_PASSWORD);
- if (password == null) {
- throw new IllegalArgumentException("Failed to login because password is null");
- }
-
- final Object loggerObject = getConfiguration().getValue(SCHEMA_REGISTRY_CLIENT_NIFI_COMP_LOGGER);
- if (loggerObject == null) {
- throw new IllegalArgumentException("Failed to login because component logger is required");
- }
-
- if (!(loggerObject instanceof ComponentLog)) {
- throw new IllegalArgumentException("Failed to login because logger object is not a ComponentLog");
- }
-
- kerberosUser = new KerberosPasswordUser(principal, password);
- Login login = new KerberosUserLogin(kerberosUser, (ComponentLog) loggerObject);
- setLogin(login);
-
- try {
- login.login();
- } catch (final KerberosLoginException | LoginException e) {
- LOGGER.error("Failed to login as principal `{}`", new Object[]{principal}, e);
- }
- }
-
- public void setLogin(Login login) {
- try {
- Field loginField = SchemaRegistryClient.class.getDeclaredField("login");
- loginField.setAccessible(true);
- loginField.set(this, login);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void close() {
- try {
- kerberosUser.logout();
- } catch (Throwable t) {
- LOGGER.error("Error performing logout of principal during close(): " + t.getMessage(), t);
- } finally {
- kerberosUser = null;
- }
-
- super.close();
- }
-}
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
deleted file mode 100644
index 26171c8168..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
+++ /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.schemaregistry.hortonworks.HortonworksSchemaRegistry
\ No newline at end of file
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistryTest.java b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistryTest.java
deleted file mode 100644
index 8954b9e620..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/HortonworksSchemaRegistryTest.java
+++ /dev/null
@@ -1,107 +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.schemaregistry.hortonworks;
-
-import org.apache.nifi.controller.ControllerService;
-import org.apache.nifi.kerberos.KerberosCredentialsService;
-import org.apache.nifi.processor.Processor;
-import org.apache.nifi.reporting.InitializationException;
-import org.apache.nifi.ssl.SSLContextService;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import static org.mockito.Mockito.when;
-
-public class HortonworksSchemaRegistryTest {
- private HortonworksSchemaRegistry testSubject;
-
- private TestRunner runner;
-
- @Mock
- private Processor dummyProcessor;
- @Mock
- private SSLContextService mockSSLContextService;
- @Mock
- private KerberosCredentialsService mockKerberosCredentialsService;
-
- @BeforeEach
- void setUp() throws Exception {
- MockitoAnnotations.openMocks(this);
-
- testSubject = new HortonworksSchemaRegistry();
-
- runner = TestRunners.newTestRunner(dummyProcessor);
- runner.addControllerService("hortonworks-schema-registry", testSubject);
-
- when(mockSSLContextService.getIdentifier()).thenReturn("ssl-controller-service-id");
- when(mockKerberosCredentialsService.getIdentifier()).thenReturn("kerberos-credentials-service-id");
- }
-
- @Test
- void invalidWhenBasicUsernameWithoutSSLContextIsSet() throws Exception {
- runner.setProperty(testSubject, HortonworksSchemaRegistry.URL, "http://unimportant");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.BASIC_AUTH_USERNAME, "username");
-
- runner.assertNotValid(testSubject);
- }
-
- @Test
- void validWhenBasicUsernameWithSSLContextIsSet() throws Exception {
- addAndEnable(mockSSLContextService);
-
- runner.setProperty(testSubject, HortonworksSchemaRegistry.URL, "http://unimportant");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.SSL_CONTEXT_SERVICE, mockSSLContextService.getIdentifier());
- runner.setProperty(testSubject, HortonworksSchemaRegistry.BASIC_AUTH_USERNAME, "basic username");
-
- runner.assertValid(testSubject);
- }
-
- @Test
- void invalidWhenBasicUsernameAndKerberosPrincipalBothSet() throws Exception {
- addAndEnable(mockSSLContextService);
-
- runner.setProperty(testSubject, HortonworksSchemaRegistry.URL, "http://unimportant");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.SSL_CONTEXT_SERVICE, mockSSLContextService.getIdentifier());
- runner.setProperty(testSubject, HortonworksSchemaRegistry.BASIC_AUTH_USERNAME, "basic username");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.KERBEROS_PRINCIPAL, "kerberos principal");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.KERBEROS_PASSWORD, "kerberos password");
-
- runner.assertNotValid(testSubject);
- }
-
- @Test
- void invalidWhenBasicUsernameAndKerberosCredentialsServivceBothSet() throws Exception {
- addAndEnable(mockSSLContextService);
- addAndEnable(mockKerberosCredentialsService);
-
- runner.setProperty(testSubject, HortonworksSchemaRegistry.URL, "http://unimportant");
- runner.setProperty(testSubject, HortonworksSchemaRegistry.SSL_CONTEXT_SERVICE, mockSSLContextService.getIdentifier());
- runner.setProperty(testSubject, HortonworksSchemaRegistry.KERBEROS_CREDENTIALS_SERVICE, mockKerberosCredentialsService.getIdentifier());
- runner.setProperty(testSubject, HortonworksSchemaRegistry.BASIC_AUTH_USERNAME, "basic username");
-
- runner.assertNotValid(testSubject);
- }
-
- private void addAndEnable(ControllerService service) throws InitializationException {
- runner.addControllerService(service.getIdentifier(), service);
- runner.enableControllerService(service);
- }
-}
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/TestHortonworksSchemaRegistry.java b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/TestHortonworksSchemaRegistry.java
deleted file mode 100644
index 40ce020192..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/java/org/apache/nifi/schemaregistry/hortonworks/TestHortonworksSchemaRegistry.java
+++ /dev/null
@@ -1,175 +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.schemaregistry.hortonworks;
-
-import com.hortonworks.registries.schemaregistry.SchemaCompatibility;
-import com.hortonworks.registries.schemaregistry.SchemaMetadata;
-import com.hortonworks.registries.schemaregistry.SchemaMetadataInfo;
-import com.hortonworks.registries.schemaregistry.SchemaVersionInfo;
-import com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient;
-import com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException;
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.controller.ConfigurationContext;
-import org.apache.nifi.serialization.record.RecordSchema;
-import org.apache.nifi.serialization.record.SchemaIdentifier;
-import org.apache.nifi.util.MockConfigurationContext;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.mockito.stubbing.Answer;
-
-import java.lang.reflect.Constructor;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-
-public class TestHortonworksSchemaRegistry {
- private HortonworksSchemaRegistry registry;
- private SchemaRegistryClient client;
-
- private final Map<String, SchemaVersionInfo> schemaVersionInfoMap = new HashMap<>();
- private final Map<String, SchemaMetadataInfo> schemaMetadataInfoMap = new HashMap<>();
-
- @BeforeEach
- public void setup() throws SchemaNotFoundException {
- schemaVersionInfoMap.clear();
- schemaMetadataInfoMap.clear();
-
- client = mock(SchemaRegistryClient.class);
- doAnswer((Answer<SchemaVersionInfo>) invocation -> {
- final String schemaName = invocation.getArgument(0);
- final SchemaVersionInfo info = schemaVersionInfoMap.get(schemaName);
-
- if (info == null) {
- throw new SchemaNotFoundException();
- }
-
- return info;
- }).when(client).getLatestSchemaVersionInfo(any(String.class));
-
- doAnswer((Answer<SchemaMetadataInfo>) invocation -> {
- final String schemaName = invocation.getArgument(0);
- final SchemaMetadataInfo info = schemaMetadataInfoMap.get(schemaName);
-
- if (info == null) {
- throw new SchemaNotFoundException();
- }
-
- return info;
- }).when(client).getSchemaMetadataInfo(any(String.class));
-
- registry = new HortonworksSchemaRegistry() {
- @Override
- protected synchronized SchemaRegistryClient getClient() {
- return client;
- }
- };
- }
-
- @Test
- public void testCacheUsed() throws Exception {
- final String text = new String(Files.readAllBytes(Paths.get("src/test/resources/empty-schema.avsc")));
- final SchemaVersionInfo info = new SchemaVersionInfo(1L, "unit-test", 2, text, System.currentTimeMillis(), "description");
- schemaVersionInfoMap.put("unit-test", info);
-
- final SchemaMetadata metadata = new SchemaMetadata.Builder("unit-test")
- .compatibility(SchemaCompatibility.NONE)
- .evolve(true)
- .schemaGroup("group")
- .type("AVRO")
- .build();
-
- final Constructor<SchemaMetadataInfo> ctr = SchemaMetadataInfo.class.getDeclaredConstructor(SchemaMetadata.class, Long.class, Long.class);
- ctr.setAccessible(true);
-
- final SchemaMetadataInfo schemaMetadataInfo = ctr.newInstance(metadata, 1L, System.currentTimeMillis());
-
- schemaMetadataInfoMap.put("unit-test", schemaMetadataInfo);
-
- final Map<PropertyDescriptor, String> properties = new HashMap<>();
- properties.put(HortonworksSchemaRegistry.URL, "http://localhost:44444");
- properties.put(HortonworksSchemaRegistry.CACHE_EXPIRATION, "5 mins");
- properties.put(HortonworksSchemaRegistry.CACHE_SIZE, "1000");
-
- final ConfigurationContext configurationContext = new MockConfigurationContext(properties, null);
- registry.enable(configurationContext);
-
- for (int i = 0; i < 10000; i++) {
- final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().name("unit-test").build();
- final RecordSchema schema = registry.retrieveSchema(schemaIdentifier);
- assertNotNull(schema);
- }
-
- Mockito.verify(client, Mockito.times(1)).getLatestSchemaVersionInfo(any(String.class));
- }
-
- @Test
- @Disabled("This can be useful for manual testing/debugging, but will keep ignored for now because we don't want automated builds to run this, since it depends on timing")
- public void testCacheExpires() throws Exception {
- final String text = new String(Files.readAllBytes(Paths.get("src/test/resources/empty-schema.avsc")));
- final SchemaVersionInfo info = new SchemaVersionInfo(1L, "unit-test", 2, text, System.currentTimeMillis(), "description");
- schemaVersionInfoMap.put("unit-test", info);
-
- final SchemaMetadata metadata = new SchemaMetadata.Builder("unit-test")
- .compatibility(SchemaCompatibility.NONE)
- .evolve(true)
- .schemaGroup("group")
- .type("AVRO")
- .build();
-
- final Constructor<SchemaMetadataInfo> ctr = SchemaMetadataInfo.class.getDeclaredConstructor(SchemaMetadata.class, Long.class, Long.class);
- ctr.setAccessible(true);
-
- final SchemaMetadataInfo schemaMetadataInfo = ctr.newInstance(metadata, 1L, System.currentTimeMillis());
-
- schemaMetadataInfoMap.put("unit-test", schemaMetadataInfo);
-
- final Map<PropertyDescriptor, String> properties = new HashMap<>();
- properties.put(HortonworksSchemaRegistry.URL, "http://localhost:44444");
- properties.put(HortonworksSchemaRegistry.CACHE_EXPIRATION, "1 sec");
- properties.put(HortonworksSchemaRegistry.CACHE_SIZE, "1000");
-
- final ConfigurationContext configurationContext = new MockConfigurationContext(properties, null);
- registry.enable(configurationContext);
-
- for (int i = 0; i < 2; i++) {
- final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().name("unit-test").build();
- final RecordSchema schema = registry.retrieveSchema(schemaIdentifier);
- assertNotNull(schema);
- }
-
- Mockito.verify(client, Mockito.times(1)).getLatestSchemaVersionInfo(any(String.class));
-
- Thread.sleep(2000L);
-
- for (int i = 0; i < 2; i++) {
- final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().name("unit-test").build();
- final RecordSchema schema = registry.retrieveSchema(schemaIdentifier);
- assertNotNull(schema);
- }
-
- Mockito.verify(client, Mockito.times(2)).getLatestSchemaVersionInfo(any(String.class));
- }
-}
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/resources/empty-schema.avsc b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/resources/empty-schema.avsc
deleted file mode 100644
index 67098d0aff..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/nifi-hwx-schema-registry-service/src/test/resources/empty-schema.avsc
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "unitTest",
- "namespace": "org.apache.nifi",
- "type": "record",
- "fields": []
-}
\ No newline at end of file
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/pom.xml b/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/pom.xml
deleted file mode 100644
index 6940dc25ba..0000000000
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <!--
- 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.
- -->
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-standard-services</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nifi-hwx-schema-registry-bundle</artifactId>
- <packaging>pom</packaging>
-
- <properties>
- <hwx.registry.version>0.9.1</hwx.registry.version>
- </properties>
- <dependencyManagement>
- <dependencies>
- <!-- Override commons-compress -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.21</version>
- </dependency>
- <!-- Override Guava from schema-registry-client -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>31.1-jre</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <modules>
- <module>nifi-hwx-schema-registry-service</module>
- <module>nifi-hwx-schema-registry-nar</module>
- </modules>
-</project>
diff --git a/nifi-nar-bundles/nifi-standard-services/pom.xml b/nifi-nar-bundles/nifi-standard-services/pom.xml
index 260da7422c..714cfe6baf 100644
--- a/nifi-nar-bundles/nifi-standard-services/pom.xml
+++ b/nifi-nar-bundles/nifi-standard-services/pom.xml
@@ -42,7 +42,6 @@
<module>nifi-schema-registry-service-api</module>
<module>nifi-record-serialization-service-api</module>
<module>nifi-record-serialization-services-bundle</module>
- <module>nifi-hwx-schema-registry-bundle</module>
<module>nifi-kerberos-credentials-service-api</module>
<module>nifi-kerberos-credentials-service-bundle</module>
<module>nifi-proxy-configuration-api</module>