diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/pom.xml b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/pom.xml new file mode 100644 index 000000000000..0d5fe96b02fd --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/pom.xml @@ -0,0 +1,158 @@ + + + + 4.0.0 + + org.apache.nifi + nifi-parquet-bundle + 2.7.0-SNAPSHOT + + nifi-parquet-content-viewer + war + + true + ${project.build.directory}/standard-content-viewer-ui-working-directory + + + + org.apache.nifi + nifi-framework-api + 2.7.0-SNAPSHOT + provided + + + org.apache.nifi + nifi-content-viewer-utils + 2.7.0-SNAPSHOT + + + org.apache.nifi + nifi-web-servlet-shared + 2.7.0-SNAPSHOT + + + org.apache.nifi + nifi-frontend + 2.7.0-SNAPSHOT + + + org.glassfish.jersey.core + jersey-common + + + org.apache.parquet + parquet-common + ${parquet.version} + provided + + + org.apache.parquet + parquet-hadoop + ${parquet.version} + provided + + + org.apache.parquet + parquet-avro + ${parquet.version} + provided + + + org.apache.hadoop + hadoop-common + ${hadoop.version} + provided + + + log4j + log4j + + + org.slf4j + slf4j-reload4j + + + org.slf4j + slf4j-log4j12 + + + commons-logging + commons-logging + + + + + org.apache.nifi + nifi-parquet-shared + 2.7.0-SNAPSHOT + provided + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-standard-content-viewer-ui + prepare-package + + unpack-dependencies + + + org.apache.nifi + nifi-frontend + true + false + ${standard-content-viewer.ui.working.dir} + standard-content-viewer/**/* + + + + + + + maven-war-plugin + + + + ${standard-content-viewer.ui.working.dir}/standard-content-viewer + **/* + WEB-INF/classes/static + + + src/main/webapp/META-INF + META-INF + + nifi-content-viewer + + false + + + WEB-INF/lib/nifi-frontend*.jar + + + + + diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/content/viewer/ParquetServletContextListener.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/content/viewer/ParquetServletContextListener.java new file mode 100644 index 000000000000..18e914706635 --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/content/viewer/ParquetServletContextListener.java @@ -0,0 +1,71 @@ +/* + * 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.parquet.web.content.viewer; + +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.annotation.WebListener; +import org.apache.nifi.web.servlet.filter.QueryStringToFragmentFilter; +import org.apache.nifi.parquet.web.controller.ParquetContentViewerController; +import org.eclipse.jetty.ee11.servlet.DefaultServlet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.EnumSet; + +/** + * Servlet Context Listener supporting registration of Filters + */ +@WebListener +public class ParquetServletContextListener implements ServletContextListener { + private static final String API_CONTENT_MAPPING = "/api/content"; + + private static final int LOAD_ON_STARTUP_ENABLED = 1; + + private static final String DIR_ALLOWED_PARAMETER = "dirAllowed"; + + private static final String BASE_RESOURCE_PARAMETER = "baseResource"; + + private static final String BASE_RESOURCE_DIRECTORY = "WEB-INF/classes/static"; + + private static final String DEFAULT_MAPPING = "/"; + + private static final Logger logger = LoggerFactory.getLogger(ParquetServletContextListener.class); + + @Override + public void contextInitialized(final ServletContextEvent sce) { + final ServletContext servletContext = sce.getServletContext(); + final FilterRegistration.Dynamic filter = servletContext.addFilter(QueryStringToFragmentFilter.class.getSimpleName(), QueryStringToFragmentFilter.class); + filter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, DEFAULT_MAPPING); + + final ServletRegistration.Dynamic servlet = servletContext.addServlet(ParquetContentViewerController.class.getSimpleName(), ParquetContentViewerController.class); + servlet.addMapping(API_CONTENT_MAPPING); + servlet.setLoadOnStartup(LOAD_ON_STARTUP_ENABLED); + + final ServletRegistration.Dynamic defaultServlet = servletContext.addServlet(DefaultServlet.class.getSimpleName(), DefaultServlet.class); + defaultServlet.addMapping(DEFAULT_MAPPING); + defaultServlet.setInitParameter(DIR_ALLOWED_PARAMETER, Boolean.FALSE.toString()); + defaultServlet.setInitParameter(BASE_RESOURCE_PARAMETER, BASE_RESOURCE_DIRECTORY); + defaultServlet.setLoadOnStartup(LOAD_ON_STARTUP_ENABLED); + + logger.info("Parquet Content Viewer Initialized"); + } +} diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/controller/ParquetContentViewerController.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/controller/ParquetContentViewerController.java new file mode 100644 index 000000000000..79b647d52df3 --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/java/org/apache/nifi/parquet/web/controller/ParquetContentViewerController.java @@ -0,0 +1,192 @@ +/* + * 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.parquet.web.controller; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.apache.avro.Schema; +import org.apache.avro.generic.GenericData; +import org.apache.avro.generic.GenericRecord; +import org.apache.commons.io.output.ByteArrayOutputStream; +import org.apache.hadoop.conf.Configuration; +import org.apache.nifi.authorization.AccessDeniedException; +import org.apache.nifi.web.ContentAccess; +import org.apache.nifi.web.ContentRequestContext; +import org.apache.nifi.web.DownloadableContent; +import org.apache.nifi.web.HttpServletContentRequestContext; +import org.apache.nifi.web.ResourceNotFoundException; +import org.apache.parquet.avro.AvroParquetReader; +import org.apache.parquet.hadoop.ParquetReader; +import org.apache.parquet.io.InputFile; +import org.apache.nifi.parquet.shared.NifiParquetInputFile; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class ParquetContentViewerController extends HttpServlet { + private static final Logger logger = LoggerFactory.getLogger(ParquetContentViewerController.class); + private static final ObjectMapper mapper = new ObjectMapper(); + private static final long MAX_CONTENT_SIZE = 1024 * 1024 * 2; // 10MB + private static final int BUFFER_SIZE = 8 * 1024; // 8KB + + private static final byte NEWLINE = '\n'; + private static final byte COMMA = ','; + private static final byte START_ARRAY = '['; + private static final byte END_ARRAY = ']'; + + @Override + public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException { + final ContentRequestContext requestContext = new HttpServletContentRequestContext(request); + + final ServletContext servletContext = request.getServletContext(); + final ContentAccess contentAccess = (ContentAccess) servletContext.getAttribute("nifi-content-access"); + // get the content + final DownloadableContent downloadableContent; + try { + downloadableContent = contentAccess.getContent(requestContext); + } catch (final ResourceNotFoundException e) { + logger.warn("Content not found", e); + response.sendError(HttpURLConnection.HTTP_NOT_FOUND, "Content not found"); + return; + } catch (final AccessDeniedException e) { + logger.warn("Content access denied", e); + response.sendError(HttpURLConnection.HTTP_FORBIDDEN, "Content access denied"); + return; + } catch (final Exception e) { + logger.warn("Content retrieval failed", e); + response.sendError(HttpURLConnection.HTTP_INTERNAL_ERROR, "Content retrieval failed"); + return; + } + + response.setStatus(HttpServletResponse.SC_OK); + + try { + // Convert InputStream to a seekable InputStream + final byte[] data = getInputStreamBytes(downloadableContent.getContent()); + + if (data.length == 0) { + response.sendError(HttpURLConnection.HTTP_INTERNAL_ERROR, "Content size is too large to display."); + return; + } + + final Configuration conf = new Configuration(); + + // Allow older deprecated schemas + conf.setBoolean("parquet.avro.readInt96AsFixed", true); + + final InputFile inputFile = new NifiParquetInputFile(new ByteArrayInputStream(data), data.length); + try ( + ParquetReader reader = AvroParquetReader.builder(inputFile) + .withConf(conf) + .build(); + OutputStream outputStream = response.getOutputStream()) { + writeRecords(outputStream, reader); + } + } catch (final Throwable t) { + logger.warn("Unable to format FlowFile content", t); + response.sendError(HttpURLConnection.HTTP_INTERNAL_ERROR, "Unable to format FlowFile content"); + } + } + + private void writeRecords(final OutputStream outputStream, final ParquetReader reader) throws IOException { + // Format and write out each record + GenericRecord record; + boolean firstRecord = true; + final ObjectWriter objectWriter = mapper.writerWithDefaultPrettyPrinter(); + + outputStream.write(START_ARRAY); + outputStream.write(NEWLINE); + while ((record = reader.read()) != null) { + if (firstRecord) { + firstRecord = false; + } else { + outputStream.write(COMMA); + outputStream.write(NEWLINE); + } + + final Object mappedRecord = recordToMap(record); + final byte[] serializedRecord = objectWriter.writeValueAsBytes(mappedRecord); + outputStream.write(serializedRecord); + } + outputStream.write(NEWLINE); + outputStream.write(END_ARRAY); + } + + private static Object recordToMap(final Object obj) { + switch (obj) { + case GenericRecord record -> { + final Map map = new LinkedHashMap<>(); + for (final Schema.Field field : record.getSchema().getFields()) { + map.put(field.name(), recordToMap(record.get(field.name()))); + } + return map; + } + case Collection coll -> { + final List list = new ArrayList<>(); + for (Object elem : coll) { + list.add(recordToMap(elem)); + } + return list; + } + case GenericData.EnumSymbol enumSymbol -> { + return enumSymbol.toString(); + } + case org.apache.avro.util.Utf8 utf8 -> { + return utf8.toString(); + } + case null, default -> { + return obj; + } + } + } + + private byte[] getInputStreamBytes(final InputStream inputStream) throws IOException { + try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + final byte[] buffer = new byte[BUFFER_SIZE]; + long totalRead = 0; + + while (totalRead < MAX_CONTENT_SIZE) { + int bytesRead = inputStream.read(buffer, 0, BUFFER_SIZE); + if (bytesRead == -1) { + break; + } + outputStream.write(buffer, 0, bytesRead); + totalRead += bytesRead; + } + + // Return empty array if inputStream has more data beyond maxBytes + if (totalRead >= MAX_CONTENT_SIZE && inputStream.read() != -1) { + return new byte[0]; + } + + return outputStream.toByteArray(); + } + } +} diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/LICENSE b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/LICENSE new file mode 100644 index 000000000000..d85e3099c956 --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/LICENSE @@ -0,0 +1,212 @@ + + 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. + +APACHE NIFI SUBCOMPONENTS: + +The Apache NiFi project contains subcomponents with separate copyright +notices and license terms. Your use of the source code for the these +subcomponents is subject to the terms and conditions of the following +licenses. + +For the binary distribution of nifi-parquet-content-viewer see its 3rdpartylicenses.txt +for additional license and notice information. \ No newline at end of file diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/NOTICE b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/NOTICE new file mode 100644 index 000000000000..08cd9ad37e8a --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/resources/META-INF/NOTICE @@ -0,0 +1,42 @@ +nifi-web-docs +Copyright 2014-2025 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +For the binary distribution of nifi-standard-content-viewer see its 3rdpartylicenses.txt +for additional license and notice information. + +=========================================== +Apache Software License v2 +=========================================== + +The following binary components are provided under the Apache Software License v2 + + (ASLv2) Apache Avro + The following NOTICE information applies: + Apache Avro + Copyright 2009-2017 The Apache Software Foundation + + (ASLv2) Apache Parquet + The following NOTICE information applies: + Apache Parquet MR (Incubating) + Copyright 2014 The Apache Software Foundation + + This product includes software developed at + The Apache Software Foundation (http://www.apache.org/). + + (ASLv2) Apache Commons IO + The following NOTICE information applies: + Apache Commons IO + Copyright 2002-2016 The Apache Software Foundation + +Other open source components: + + (CDDL 1.1) (GPL2 w/ CPE) Jakarta Servlet API + (CDDL 1.1) (GPL2 w/ CPE) jersey-common (org.glassfish.jersey.core:jersey-common:jar:3.1.10 - https://jersey.github.io/) + + ## FastDoubleParser + jackson-core bundles a shaded copy of FastDoubleParser . + That code is available under an MIT license + under the following copyright. diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/webapp/META-INF/nifi-content-viewer b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/webapp/META-INF/nifi-content-viewer new file mode 100644 index 000000000000..a9205dcf98e0 --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-content-viewer/src/main/webapp/META-INF/nifi-content-viewer @@ -0,0 +1,15 @@ +# 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. +parquet=application/vnd.apache.parquet \ No newline at end of file diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-nar/pom.xml b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-nar/pom.xml index 1e57fc353f45..9127b832ec00 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-nar/pom.xml +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-nar/pom.xml @@ -37,5 +37,11 @@ 2.7.0-SNAPSHOT nar + + org.apache.nifi + nifi-parquet-content-viewer + 2.7.0-SNAPSHOT + war + diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/pom.xml b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/pom.xml index 92127042e5b9..d9b338f95bef 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/pom.xml +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/pom.xml @@ -62,23 +62,10 @@ - - - com.nimbusds - nimbus-jose-jwt - ${nimbus-jose-jwt.version} - - - com.fasterxml.jackson.core - jackson-databind - - org.apache.parquet parquet-avro - 1.16.0 + ${parquet.version} org.xerial.snappy @@ -112,11 +99,15 @@ org.apache.nifi nifi-kerberos-user-service-api - org.apache.nifi nifi-mock-record-utils + + org.apache.nifi + nifi-parquet-shared + 2.7.0-SNAPSHOT + diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/ParquetRecordReader.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/ParquetRecordReader.java index 0ed4680c4b5d..d0aa17e826bf 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/ParquetRecordReader.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/record/ParquetRecordReader.java @@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.nifi.avro.AvroTypeUtil; import org.apache.nifi.parquet.filter.OffsetRecordFilter; -import org.apache.nifi.parquet.stream.NifiParquetInputFile; +import org.apache.nifi.parquet.shared.NifiParquetInputFile; import org.apache.nifi.parquet.utils.ParquetAttribute; import org.apache.nifi.serialization.RecordReader; import org.apache.nifi.serialization.record.MapRecord; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetOffsets.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetOffsets.java index df72e2840c74..eab06425ae7c 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetOffsets.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetOffsets.java @@ -35,7 +35,7 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.parquet.stream.NifiParquetInputFile; +import org.apache.nifi.parquet.shared.NifiParquetInputFile; import org.apache.nifi.parquet.utils.ParquetAttribute; import org.apache.nifi.processor.AbstractProcessor; import org.apache.nifi.processor.ProcessContext; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetRowGroupOffsets.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetRowGroupOffsets.java index a89bcfe7488f..0c693a934907 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetRowGroupOffsets.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/CalculateParquetRowGroupOffsets.java @@ -31,7 +31,7 @@ import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.parquet.stream.NifiParquetInputFile; +import org.apache.nifi.parquet.shared.NifiParquetInputFile; import org.apache.nifi.parquet.utils.ParquetAttribute; import org.apache.nifi.processor.AbstractProcessor; import org.apache.nifi.processor.ProcessContext; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/pom.xml b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/pom.xml new file mode 100644 index 000000000000..80858127d0c5 --- /dev/null +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.apache.nifi + nifi-parquet-bundle + 2.7.0-SNAPSHOT + + + nifi-parquet-shared + + + + org.apache.parquet + parquet-common + ${parquet.version} + compile + + + + \ No newline at end of file diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetInputFile.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiParquetInputFile.java similarity index 97% rename from nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetInputFile.java rename to nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiParquetInputFile.java index 98e8cf3f75c8..7224668ac682 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetInputFile.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiParquetInputFile.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.parquet.stream; +package org.apache.nifi.parquet.shared; import org.apache.nifi.stream.io.ByteCountingInputStream; import org.apache.parquet.io.InputFile; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiSeekableInputStream.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiSeekableInputStream.java similarity index 98% rename from nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiSeekableInputStream.java rename to nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiSeekableInputStream.java index 89d2cc0c3272..f3e348be51cf 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiSeekableInputStream.java +++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-shared/src/main/java/org/apache/nifi/parquet/shared/NifiSeekableInputStream.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.parquet.stream; +package org.apache.nifi.parquet.shared; import org.apache.nifi.stream.io.ByteCountingInputStream; import org.apache.nifi.stream.io.StreamUtils; diff --git a/nifi-extension-bundles/nifi-parquet-bundle/pom.xml b/nifi-extension-bundles/nifi-parquet-bundle/pom.xml index 87bd359ad6bd..d2f8500fef9b 100644 --- a/nifi-extension-bundles/nifi-parquet-bundle/pom.xml +++ b/nifi-extension-bundles/nifi-parquet-bundle/pom.xml @@ -26,8 +26,13 @@ nifi-parquet-processors + nifi-parquet-content-viewer + nifi-parquet-shared nifi-parquet-nar + + 1.16.0 + @@ -36,6 +41,43 @@ commons-beanutils 1.11.0 + + + org.apache.hadoop + hadoop-common + ${hadoop.version} + provided + + + org.apache.hadoop + hadoop-auth + ${hadoop.version} + provided + + + org.apache.avro + avro + ${avro.version} + provided + + + com.nimbusds + nimbus-jose-jwt + ${nimbus-jose-jwt.version} + provided + + + org.apache.httpcomponents + httpcore + ${org.apache.httpcomponents.httpcore.version} + provided + + + org.apache.httpcomponents + httpclient + ${org.apache.httpcomponents.httpclient.version} + provided +