You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by js...@apache.org on 2016/06/22 19:02:53 UTC
[5/5] nifi git commit: NIFI-615 - Create a processor to extract WAV
file characteristics. * Create new ExtractMediaMetadata processor using
Apache Tika Detector and Parser. * Refactored nifi-image-bundle,
nifi-image-nar, and nifi-image-processors to nifi
NIFI-615 - Create a processor to extract WAV file characteristics.
* Create new ExtractMediaMetadata processor using Apache Tika Detector and Parser.
* Refactored nifi-image-bundle, nifi-image-nar, and nifi-image-processors to nifi-media-bundle, nifi-media-nar, and nifi-media-processors to reflect broader media related purpose.
* Preserved existing ExtractImageMetadata and ResizeImage processors as well as existing ImageViewerController components to prevent impact on existing uses.
* Resolved collision between ExtractImage and ExtractMedia processors due to common dependency on Noakes' Metadata Extractor project.
- Updated bundle's Tika dependency from 1.7 to 1.8 and Drew Noakes' Metadata Extractor from 2.7.2 to 2.8.0.
- Adjusted ExtractImageMetadata tests for enhanced attribute names in new Noakes' Metadata Extractor version.
* Fix assembly POM to remove duplicate reference to site-to-site nar and change nifi-image-nar reference to nifi-media-nar.
* Note the potential attribute changes on upgrade due to underlying libraries.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/6d7d4a8c
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/6d7d4a8c
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/6d7d4a8c
Branch: refs/heads/0.x
Commit: 6d7d4a8cf4e1585b210e02397cf661a6cc32b1d9
Parents: dec471e
Author: Joe Skora <js...@gmail.com>
Authored: Fri Feb 26 15:33:40 2016 -0500
Committer: Joe Skora <js...@apache.org>
Committed: Wed Jun 22 15:01:42 2016 -0400
----------------------------------------------------------------------
nifi-assembly/NOTICE | 19 +-
nifi-assembly/pom.xml | 7 +-
.../nifi-image-bundle/nifi-image-nar/pom.xml | 47 -
.../src/main/resources/META-INF/LICENSE | 239 ---
.../src/main/resources/META-INF/NOTICE | 16 -
.../nifi-image-processors/pom.xml | 62 -
.../processors/image/ExtractImageMetadata.java | 169 --
.../nifi/processors/image/ResizeImage.java | 198 --
.../org.apache.nifi.processor.Processor | 16 -
.../image/ExtractImageMetadataTest.java | 161 --
.../nifi/processors/image/TestResizeImage.java | 57 -
.../src/test/resources/16color-10x10.bmp | Bin 198 -> 0 bytes
.../src/test/resources/mspaint-8x10.png | Bin 124 -> 0 bytes
.../src/test/resources/notImage.txt | 1 -
.../resources/photoshop-8x12-32colors-alpha.gif | Bin 1243 -> 0 bytes
.../src/test/resources/simple.jpg | Bin 25248 -> 0 bytes
.../nifi-image-bundle/nifi-image-viewer/pom.xml | 52 -
.../apache/nifi/web/ImageViewerController.java | 52 -
.../main/webapp/META-INF/nifi-content-viewer | 17 -
.../src/main/webapp/WEB-INF/jsp/image.jsp | 39 -
.../src/main/webapp/WEB-INF/web.xml | 29 -
nifi-nar-bundles/nifi-image-bundle/pom.xml | 35 -
.../nifi-media-bundle/nifi-image-viewer/pom.xml | 52 +
.../apache/nifi/web/ImageViewerController.java | 52 +
.../main/webapp/META-INF/nifi-content-viewer | 17 +
.../src/main/webapp/WEB-INF/jsp/image.jsp | 39 +
.../src/main/webapp/WEB-INF/web.xml | 29 +
.../nifi-media-bundle/nifi-media-nar/pom.xml | 47 +
.../src/main/resources/META-INF/LICENSE | 239 +++
.../src/main/resources/META-INF/NOTICE | 35 +
.../nifi-media-processors/pom.xml | 74 +
.../processors/image/ExtractImageMetadata.java | 169 ++
.../nifi/processors/image/ResizeImage.java | 198 ++
.../processors/media/ExtractMediaMetadata.java | 251 +++
.../org.apache.nifi.processor.Processor | 17 +
.../image/ExtractImageMetadataTest.java | 161 ++
.../nifi/processors/image/TestResizeImage.java | 57 +
.../media/TestExtractMediaMetadata.java | 456 ++++
.../src/test/resources/16color-10x10.bmp | Bin 0 -> 198 bytes
.../src/test/resources/mspaint-8x10.png | Bin 0 -> 124 bytes
.../src/test/resources/notImage.txt | 1 +
.../resources/photoshop-8x12-32colors-alpha.gif | Bin 0 -> 1243 bytes
.../src/test/resources/simple.jpg | Bin 0 -> 25248 bytes
.../src/test/resources/testMP3id3v1.mp3 | Bin 0 -> 39416 bytes
.../src/test/resources/testVORBIS-corrupt.ogg | Bin 0 -> 4241 bytes
.../src/test/resources/testVORBIS.ogg | Bin 0 -> 4241 bytes
.../src/test/resources/testWAV.wav | Bin 0 -> 3884 bytes
.../src/test/resources/textFile.txt | 1 +
.../src/test/resources/textFileBig.txt | 2023 ++++++++++++++++++
nifi-nar-bundles/nifi-media-bundle/pom.xml | 35 +
nifi-nar-bundles/pom.xml | 2 +-
pom.xml | 2 +-
52 files changed, 3973 insertions(+), 1200 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-assembly/NOTICE
----------------------------------------------------------------------
diff --git a/nifi-assembly/NOTICE b/nifi-assembly/NOTICE
index 1d2e4e9..3c8531e 100644
--- a/nifi-assembly/NOTICE
+++ b/nifi-assembly/NOTICE
@@ -286,8 +286,23 @@ The following binary components are provided under the Apache Software License v
(ASLv2) Apache Tika
The following NOTICE information applies:
- Apache Tika Core
- Copyright 2007-2015 The Apache Software Foundation
+ Apache Tika
+ Copyright 2015 The Apache Software Foundation
+
+ This product includes software developed at
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
+ This software contains code derived from UCAR/Unidata's NetCDF library.
+
+ Tika-server component uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and
+ Grizzly (http://grizzly.java.net/)
+
+ Tika-parsers component uses CDDL/LGPL dual-licensed dependency: jhighlight (https://github.com/codelibs/jhighlight)
+
+ OpenCSV: Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0
+
+ IPTC Photo Metadata descriptions Copyright 2010 International Press Telecommunications Council.
(ASLv2) Apache Jakarta Commons Digester
The following NOTICE information applies:
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index f50f6e8..536a51d 100644
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -244,7 +244,7 @@ language governing permissions and limitations under the License. -->
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
- <artifactId>nifi-image-nar</artifactId>
+ <artifactId>nifi-media-nar</artifactId>
<type>nar</type>
</dependency>
<dependency>
@@ -322,11 +322,6 @@ language governing permissions and limitations under the License. -->
<artifactId>nifi-hive-nar</artifactId>
<type>nar</type>
</dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-site-to-site-reporting-nar</artifactId>
- <type>nar</type>
- </dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-site-to-site-reporting-nar</artifactId>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/pom.xml b/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/pom.xml
deleted file mode 100644
index 153c92b..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/pom.xml
+++ /dev/null
@@ -1,47 +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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-image-bundle</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nifi-image-nar</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>nar</packaging>
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- <source.skip>true</source.skip>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-image-processors</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-image-viewer</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <type>war</type>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 2c3e42f..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,239 +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.
-
-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.
-
-This product bundles 'Adobe XMPCore' which is available under "The BSD license". More
-information can be found here: http://www.adobe.com/devnet/xmp/library/eula-xmp-library-java.html
-
- Copyright (c) 2009, Adobe Systems Incorporated All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * 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.
-
- * Neither the name of Adobe Systems Incorporated, 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 MERCHANT ABILITY 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
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index e1c6736..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-nar/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-nifi-image-nar
-Copyright 2015-2016 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) Metadata-Extractor
- The following NOTICE information applies:
- Metadata-Extractor
- Copyright 2002-2015 Drew Noakes
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/pom.xml b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/pom.xml
deleted file mode 100644
index 3b43066..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/pom.xml
+++ /dev/null
@@ -1,62 +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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-image-bundle</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nifi-image-processors</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-processor-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.drewnoakes</groupId>
- <artifactId>metadata-extractor</artifactId>
- <version>2.7.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
- <exclude>src/test/resources/notImage.txt</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ExtractImageMetadata.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ExtractImageMetadata.java b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ExtractImageMetadata.java
deleted file mode 100644
index b44eccd..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ExtractImageMetadata.java
+++ /dev/null
@@ -1,169 +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.processors.image;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.nifi.annotation.behavior.InputRequirement;
-import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
-import org.apache.nifi.annotation.behavior.SupportsBatching;
-import org.apache.nifi.annotation.behavior.WritesAttribute;
-import org.apache.nifi.annotation.behavior.WritesAttributes;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
-import org.apache.nifi.annotation.documentation.Tags;
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.flowfile.FlowFile;
-import org.apache.nifi.logging.ProcessorLog;
-import org.apache.nifi.processor.AbstractProcessor;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.processor.ProcessSession;
-import org.apache.nifi.processor.ProcessorInitializationContext;
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.io.InputStreamCallback;
-import org.apache.nifi.processor.util.StandardValidators;
-import org.apache.nifi.util.ObjectHolder;
-
-import com.drew.imaging.ImageMetadataReader;
-import com.drew.imaging.ImageProcessingException;
-import com.drew.metadata.Directory;
-import com.drew.metadata.Metadata;
-import com.drew.metadata.Tag;
-
-@InputRequirement(Requirement.INPUT_REQUIRED)
-@Tags({"Exif", "Exchangeable", "image", "file", "format", "JPG", "GIF", "PNG", "BMP", "metadata","IPTC", "XMP"})
-@CapabilityDescription("Extract the image metadata from flowfiles containing images. This processor relies on this "
- + "metadata extractor library https://github.com/drewnoakes/metadata-extractor. It extracts a long list of "
- + "metadata types including but not limited to EXIF, IPTC, XMP and Photoshop fields. For the full list visit "
- + "the library's website."
- + "NOTE: The library being used loads the images into memory so extremely large images may cause problems.")
-@WritesAttributes({@WritesAttribute(attribute = "<directory name>.<tag name>", description = "The extracted image metadata "
- + "will be inserted with the attribute name \"<directory name>.<tag name>\". ")})
-@SupportsBatching
-public class ExtractImageMetadata extends AbstractProcessor {
-
- public static final PropertyDescriptor MAX_NUMBER_OF_ATTRIBUTES = new PropertyDescriptor.Builder()
- .name("Max Number of Attributes")
- .description("Specify the max number of attributes to add to the flowfile. There is no guarantee in what order"
- + " the tags will be processed. By default it will process all of them.")
- .required(false)
- .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
- .build();
-
- public static final Relationship SUCCESS = new Relationship.Builder()
- .name("success")
- .description("Any FlowFile that successfully has image metadata extracted will be routed to success")
- .build();
-
- public static final Relationship FAILURE = new Relationship.Builder()
- .name("failure")
- .description("Any FlowFile that fails to have image metadata extracted will be routed to failure")
- .build();
-
- private Set<Relationship> relationships;
- private List<PropertyDescriptor> properties;
-
- @Override
- protected void init(final ProcessorInitializationContext context) {
-
- final List<PropertyDescriptor> properties = new ArrayList<>();
- properties.add(MAX_NUMBER_OF_ATTRIBUTES);
- this.properties = Collections.unmodifiableList(properties);
-
- final Set<Relationship> relationships = new HashSet<>();
- relationships.add(SUCCESS);
- relationships.add(FAILURE);
- this.relationships = Collections.unmodifiableSet(relationships);
- }
-
- @Override
- public Set<Relationship> getRelationships() {
- return this.relationships;
- }
-
- @Override
- protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- return this.properties;
- }
-
- @Override
- public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
- FlowFile flowfile = session.get();
- if (flowfile == null) {
- return;
- }
-
- final ProcessorLog logger = this.getLogger();
- final ObjectHolder<Metadata> value = new ObjectHolder<>(null);
- final Integer max = context.getProperty(MAX_NUMBER_OF_ATTRIBUTES).asInteger();
-
- try {
- session.read(flowfile, new InputStreamCallback() {
- @Override
- public void process(InputStream in) throws IOException {
- try {
- Metadata imageMetadata = ImageMetadataReader.readMetadata(in);
- value.set(imageMetadata);
- } catch (ImageProcessingException ex) {
- throw new ProcessException(ex);
- }
- }
- });
-
- Metadata metadata = value.get();
- Map<String, String> results = getTags(max, metadata);
-
- // Write the results to an attribute
- if (!results.isEmpty()) {
- flowfile = session.putAllAttributes(flowfile, results);
- }
-
- session.transfer(flowfile, SUCCESS);
- } catch (ProcessException e) {
- logger.error("Failed to extract image metadata from {} due to {}", new Object[]{flowfile, e});
- session.transfer(flowfile, FAILURE);
- }
- }
-
- private Map<String, String> getTags(Integer max, Metadata metadata) {
- Map<String, String> results = new HashMap<>();
- int i =0;
-
- for (Directory directory : metadata.getDirectories()) {
- for (Tag tag : directory.getTags()) {
- results.put(directory.getName() + "." + tag.getTagName(), tag.getDescription());
-
- if(max!=null) {
- i++;
- if (i >= max) {
- return results;
- }
- }
- }
- }
-
- return results;
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
deleted file mode 100644
index 176561f..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
+++ /dev/null
@@ -1,198 +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.processors.image;
-
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReader;
-import javax.imageio.stream.ImageInputStream;
-
-import org.apache.nifi.annotation.behavior.EventDriven;
-import org.apache.nifi.annotation.behavior.InputRequirement;
-import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
-import org.apache.nifi.annotation.behavior.SupportsBatching;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
-import org.apache.nifi.annotation.documentation.Tags;
-import org.apache.nifi.components.AllowableValue;
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.flowfile.FlowFile;
-import org.apache.nifi.processor.AbstractProcessor;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.processor.ProcessSession;
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.io.StreamCallback;
-import org.apache.nifi.processor.util.StandardValidators;
-import org.apache.nifi.util.StopWatch;
-
-@EventDriven
-@SupportsBatching
-@InputRequirement(Requirement.INPUT_REQUIRED)
-@Tags({ "resize", "image", "jpg", "jpeg", "png", "bmp", "wbmp", "gif" })
-@CapabilityDescription("Resizes an image to user-specified dimensions. This Processor uses the image codecs registered with the "
- + "environment that NiFi is running in. By default, this includes JPEG, PNG, BMP, WBMP, and GIF images.")
-public class ResizeImage extends AbstractProcessor {
- static final AllowableValue RESIZE_DEFAULT = new AllowableValue("Default", "Default", "Use the default algorithm");
- static final AllowableValue RESIZE_FAST = new AllowableValue("Scale Fast", "Scale Fast", "Emphasize speed of the scaling over smoothness");
- static final AllowableValue RESIZE_SMOOTH = new AllowableValue("Scale Smooth", "Scale Smooth", "Emphasize smoothness of the scaling over speed");
- static final AllowableValue RESIZE_REPLICATE = new AllowableValue("Replicate Scale Filter", "Replicate Scale Filter", "Use the Replicate Scale Filter algorithm");
- static final AllowableValue RESIZE_AREA_AVERAGING = new AllowableValue("Area Averaging", "Area Averaging", "Use the Area Averaging scaling algorithm");
-
- static final PropertyDescriptor IMAGE_WIDTH = new PropertyDescriptor.Builder()
- .name("Image Width (in pixels)")
- .description("The desired number of pixels for the image's width")
- .required(true)
- .expressionLanguageSupported(true)
- .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
- .build();
- static final PropertyDescriptor IMAGE_HEIGHT = new PropertyDescriptor.Builder()
- .name("Image Height (in pixels)")
- .description("The desired number of pixels for the image's height")
- .required(true)
- .expressionLanguageSupported(true)
- .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
- .build();
- static final PropertyDescriptor SCALING_ALGORITHM = new PropertyDescriptor.Builder()
- .name("Scaling Algorithm")
- .description("Specifies which algorithm should be used to resize the image")
- .required(true)
- .allowableValues(RESIZE_DEFAULT, RESIZE_FAST, RESIZE_SMOOTH, RESIZE_REPLICATE, RESIZE_AREA_AVERAGING)
- .defaultValue(RESIZE_DEFAULT.getValue())
- .build();
-
- static final Relationship REL_SUCCESS = new Relationship.Builder()
- .name("success")
- .description("A FlowFile is routed to this relationship if it is successfully resized")
- .build();
- static final Relationship REL_FAILURE = new Relationship.Builder()
- .name("failure")
- .description("A FlowFile is routed to this relationship if it is not in the specified format")
- .build();
-
- @Override
- protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- final List<PropertyDescriptor> properties = new ArrayList<>();
- properties.add(IMAGE_WIDTH);
- properties.add(IMAGE_HEIGHT);
- properties.add(SCALING_ALGORITHM);
- return properties;
- }
-
- @Override
- public Set<Relationship> getRelationships() {
- final Set<Relationship> relationships = new HashSet<>();
- relationships.add(REL_SUCCESS);
- relationships.add(REL_FAILURE);
- return relationships;
- }
-
- @Override
- public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
- FlowFile flowFile = session.get();
- if (flowFile == null) {
- return;
- }
-
- final int width, height;
- try {
- width = context.getProperty(IMAGE_WIDTH).evaluateAttributeExpressions(flowFile).asInteger();
- height = context.getProperty(IMAGE_HEIGHT).evaluateAttributeExpressions(flowFile).asInteger();
- } catch (final NumberFormatException nfe) {
- getLogger().error("Failed to resize {} due to {}", new Object[] { flowFile, nfe });
- session.transfer(flowFile, REL_FAILURE);
- return;
- }
-
- final String algorithm = context.getProperty(SCALING_ALGORITHM).getValue();
- final int hints;
- if (algorithm.equalsIgnoreCase(RESIZE_DEFAULT.getValue())) {
- hints = Image.SCALE_DEFAULT;
- } else if (algorithm.equalsIgnoreCase(RESIZE_FAST.getValue())) {
- hints = Image.SCALE_FAST;
- } else if (algorithm.equalsIgnoreCase(RESIZE_SMOOTH.getValue())) {
- hints = Image.SCALE_SMOOTH;
- } else if (algorithm.equalsIgnoreCase(RESIZE_REPLICATE.getValue())) {
- hints = Image.SCALE_REPLICATE;
- } else if (algorithm.equalsIgnoreCase(RESIZE_AREA_AVERAGING.getValue())) {
- hints = Image.SCALE_AREA_AVERAGING;
- } else {
- throw new AssertionError("Invalid Scaling Algorithm: " + algorithm);
- }
-
- final StopWatch stopWatch = new StopWatch(true);
- try {
- flowFile = session.write(flowFile, new StreamCallback() {
- @Override
- public void process(final InputStream rawIn, final OutputStream out) throws IOException {
- try (final BufferedInputStream in = new BufferedInputStream(rawIn)) {
- final ImageInputStream iis = ImageIO.createImageInputStream(in);
- if (iis == null) {
- throw new ProcessException("FlowFile is not in a valid format");
- }
-
- final Iterator<ImageReader> readers = ImageIO.getImageReaders(iis);
- if (!readers.hasNext()) {
- throw new ProcessException("FlowFile is not in a valid format");
- }
-
- final ImageReader reader = readers.next();
- final String formatName = reader.getFormatName();
- reader.setInput(iis, true);
- final BufferedImage image = reader.read(0);
-
- final Image scaledImage = image.getScaledInstance(width, height, hints);
- final BufferedImage scaledBufferedImg;
- if (scaledImage instanceof BufferedImage) {
- scaledBufferedImg = (BufferedImage) scaledImage;
- } else {
- scaledBufferedImg = new BufferedImage(scaledImage.getWidth(null), scaledImage.getHeight(null), image.getType());
- final Graphics2D graphics = scaledBufferedImg.createGraphics();
- try {
- graphics.drawImage(scaledImage, 0, 0, null);
- } finally {
- graphics.dispose();
- }
- }
-
- ImageIO.write(scaledBufferedImg, formatName, out);
- }
- }
- });
-
- session.getProvenanceReporter().modifyContent(flowFile, stopWatch.getElapsed(TimeUnit.MILLISECONDS));
- session.transfer(flowFile, REL_SUCCESS);
- } catch (final ProcessException pe) {
- getLogger().error("Failed to resize {} due to {}", new Object[] { flowFile, pe });
- session.transfer(flowFile, REL_FAILURE);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
deleted file mode 100644
index 224cb54..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
+++ /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.processors.image.ExtractImageMetadata
-org.apache.nifi.processors.image.ResizeImage
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/ExtractImageMetadataTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/ExtractImageMetadataTest.java b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/ExtractImageMetadataTest.java
deleted file mode 100644
index cf31e15..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/ExtractImageMetadataTest.java
+++ /dev/null
@@ -1,161 +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.processors.image;
-
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.util.MockFlowFile;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-
-public class ExtractImageMetadataTest {
- private static String BMP_HEADER = "BMP Header.";
- private static String JPEG_HEADER = "JPEG.";
- private static String GIF_HEADER = "GIF Header.";
- private static String PNG_HEADER = "PNG.";
-
- private TestRunner testRunner;
-
- @Before
- public void init() {
- testRunner = TestRunners.newTestRunner(ExtractImageMetadata.class);
- }
-
- @Test
- public void testFailedExtraction() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow("src/test/resources/notImage.txt", ExtractImageMetadata.FAILURE,null);
- }
-
- @Test
- public void testExtractJPG() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow("src/test/resources/simple.jpg", ExtractImageMetadata.SUCCESS,null);
- Map<String, String> attributes = flowFile.getAttributes();
-
- assertEquals("800 pixels", attributes.get(JPEG_HEADER + "Image Width"));
- assertEquals("600 pixels", attributes.get(JPEG_HEADER + "Image Height"));
- assertEquals("8 bits", attributes.get(JPEG_HEADER + "Data Precision"));
- assertEquals("Baseline", attributes.get(JPEG_HEADER + "Compression Type"));
- assertEquals("3", attributes.get(JPEG_HEADER + "Number of Components"));
- assertEquals("Y component: Quantization table 0, Sampling factors 2 horiz/2 vert",
- attributes.get(JPEG_HEADER + "Component 1"));
- assertEquals("Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert",
- attributes.get(JPEG_HEADER + "Component 2"));
- assertEquals("Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert",
- attributes.get(JPEG_HEADER + "Component 3"));
- }
-
- @Test
- public void testExtractGIF() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow(
- "src/test/resources/photoshop-8x12-32colors-alpha.gif", ExtractImageMetadata.SUCCESS,null);
- Map<String, String> attributes = flowFile.getAttributes();
-
- assertEquals("8", attributes.get(GIF_HEADER + "Image Width"));
- assertEquals("12", attributes.get(GIF_HEADER + "Image Height"));
- assertEquals("true", attributes.get(GIF_HEADER + "Has Global Color Table"));
- assertEquals("32", attributes.get(GIF_HEADER + "Color Table Size"));
- assertEquals("8", attributes.get(GIF_HEADER + "Transparent Color Index"));
- assertEquals("89a", attributes.get(GIF_HEADER + "GIF Format Version"));
- assertEquals("5", attributes.get(GIF_HEADER + "Bits per Pixel"));
- assertEquals("false", attributes.get(GIF_HEADER + "Is Color Table Sorted"));
- }
-
- @Test
- public void testExtractPNG() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow("src/test/resources/mspaint-8x10.png", ExtractImageMetadata.SUCCESS, null);
- Map<String, String> attributes = flowFile.getAttributes();
-
- assertEquals("8", attributes.get(PNG_HEADER + "Image Width"));
- assertEquals("12", attributes.get(PNG_HEADER + "Image Height"));
- assertEquals("0.45455", attributes.get(PNG_HEADER + "Image Gamma"));
- assertEquals("Deflate", attributes.get(PNG_HEADER + "Compression Type"));
- assertEquals("No Interlace", attributes.get(PNG_HEADER + "Interlace Method"));
- assertEquals("Perceptual", attributes.get(PNG_HEADER + "sRGB Rendering Intent"));
- assertEquals("Adaptive", attributes.get(PNG_HEADER + "Filter Method"));
- assertEquals("8", attributes.get(PNG_HEADER + "Bits Per Sample"));
- assertEquals("True Color", attributes.get(PNG_HEADER + "Color Type"));
- }
- @Test
- public void testExtractBMP() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow("src/test/resources/16color-10x10.bmp", ExtractImageMetadata.SUCCESS, null);
- Map<String, String> attributes = flowFile.getAttributes();
-
- assertEquals("10", attributes.get(BMP_HEADER+"Image Width"));
- assertEquals("10", attributes.get(BMP_HEADER+"Image Height"));
- assertEquals("4", attributes.get(BMP_HEADER+"Bits Per Pixel"));
- assertEquals("None", attributes.get(BMP_HEADER+"Compression"));
- assertEquals("0", attributes.get(BMP_HEADER+"X Pixels per Meter"));
- assertEquals("0", attributes.get(BMP_HEADER+"Y Pixels per Meter"));
- assertEquals("0", attributes.get(BMP_HEADER+"Palette Colour Count"));
- assertEquals("0", attributes.get(BMP_HEADER+"Important Colour Count"));
- assertEquals("1", attributes.get(BMP_HEADER+"Planes"));
- assertEquals("40", attributes.get(BMP_HEADER+"Header Size"));
- }
- @Test
- public void testExtractLimitedAttributesBMP() throws IOException {
- MockFlowFile flowFile = verifyTestRunnerFlow("src/test/resources/16color-10x10.bmp", ExtractImageMetadata.SUCCESS, "5");
- Map<String, String> attributes = flowFile.getAttributes();
-
- assertEquals("10", attributes.get(BMP_HEADER+"Image Width"));
- assertEquals("10", attributes.get(BMP_HEADER+"Image Height"));
- assertEquals("4", attributes.get(BMP_HEADER+"Bits Per Pixel"));
- assertEquals("1", attributes.get(BMP_HEADER+"Planes"));
- assertEquals("40", attributes.get(BMP_HEADER+"Header Size"));
-
-
- assertNull(attributes.get(BMP_HEADER + "Compression"));
- assertNull(attributes.get(BMP_HEADER + "X Pixels per Meter"));
- assertNull(attributes.get(BMP_HEADER + "Y Pixels per Meter"));
- assertNull(attributes.get(BMP_HEADER + "Palette Colour Count"));
- assertNull(attributes.get(BMP_HEADER + "Important Colour Count"));
- }
-
- public MockFlowFile verifyTestRunnerFlow(String pathStr,Relationship rel, String max) throws IOException {
- Path path = Paths.get(pathStr);
- testRunner.enqueue(path);
- if(max != null) {
- testRunner.setProperty(ExtractImageMetadata.MAX_NUMBER_OF_ATTRIBUTES, max);
- }
-
- testRunner.run();
- testRunner.assertAllFlowFilesTransferred(rel, 1);
-
-
- MockFlowFile flowFile = testRunner.getFlowFilesForRelationship(rel).get(0);
- testRunner.assertQueueEmpty();
-
- testRunner.enqueue(flowFile);
- testRunner.clearTransferState();
- testRunner.run();
- testRunner.assertAllFlowFilesTransferred(rel, 1);
-
- flowFile = testRunner.getFlowFilesForRelationship(rel).get(0);
- flowFile.assertContentEquals(new File(pathStr));
- return flowFile;
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/TestResizeImage.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/TestResizeImage.java b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/TestResizeImage.java
deleted file mode 100644
index 53bf17e..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/java/org/apache/nifi/processors/image/TestResizeImage.java
+++ /dev/null
@@ -1,57 +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.processors.image;
-
-import org.apache.nifi.util.MockFlowFile;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.junit.Test;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Paths;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestResizeImage {
-
- @Test
- public void testResize() throws IOException {
- final TestRunner runner = TestRunners.newTestRunner(new ResizeImage());
- runner.setProperty(ResizeImage.IMAGE_HEIGHT, "64");
- runner.setProperty(ResizeImage.IMAGE_WIDTH, "64");
- runner.setProperty(ResizeImage.SCALING_ALGORITHM, ResizeImage.RESIZE_SMOOTH);
-
- runner.enqueue(Paths.get("src/test/resources/simple.jpg"));
- runner.run();
-
- runner.assertAllFlowFilesTransferred(ResizeImage.REL_SUCCESS, 1);
- final MockFlowFile mff = runner.getFlowFilesForRelationship(ResizeImage.REL_SUCCESS).get(0);
- final byte[] data = mff.toByteArray();
-
- final BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
- assertEquals(64, img.getWidth());
- assertEquals(64, img.getHeight());
- final File out = new File("target/simple.jpg");
- ImageIO.write(img, "JPG", out);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/16color-10x10.bmp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/16color-10x10.bmp b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/16color-10x10.bmp
deleted file mode 100644
index 26206f4..0000000
Binary files a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/16color-10x10.bmp and /dev/null differ
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/mspaint-8x10.png
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/mspaint-8x10.png b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/mspaint-8x10.png
deleted file mode 100644
index 9e74690..0000000
Binary files a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/mspaint-8x10.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/notImage.txt
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/notImage.txt b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/notImage.txt
deleted file mode 100644
index 6738fd1..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/notImage.txt
+++ /dev/null
@@ -1 +0,0 @@
-This file is not an image and is used for testing the image metadata extractor.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/photoshop-8x12-32colors-alpha.gif
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/photoshop-8x12-32colors-alpha.gif b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/photoshop-8x12-32colors-alpha.gif
deleted file mode 100644
index 0f6183d..0000000
Binary files a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/photoshop-8x12-32colors-alpha.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/simple.jpg
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/simple.jpg b/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/simple.jpg
deleted file mode 100644
index 18da837..0000000
Binary files a/nifi-nar-bundles/nifi-image-bundle/nifi-image-processors/src/test/resources/simple.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/pom.xml b/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/pom.xml
deleted file mode 100755
index 7f3ba18..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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 http://maven.apache.org/maven-v4_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-image-bundle</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>nifi-image-viewer</artifactId>
- <description>NiFi image viewer</description>
- <packaging>war</packaging>
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- <source.skip>true</source.skip>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>javax.servlet.jsp-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>javax.el-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp.jstl</groupId>
- <artifactId>javax.servlet.jsp.jstl-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java b/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
deleted file mode 100755
index a3ba1cd..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
+++ /dev/null
@@ -1,52 +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.web;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-@WebServlet(name = "ImageViewer", urlPatterns = {"/view-content"})
-public class ImageViewerController extends HttpServlet {
-
- /**
- * Handles generating markup for viewing an image.
- *
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- final ViewableContent content = (ViewableContent) request.getAttribute(ViewableContent.CONTENT_REQUEST_ATTRIBUTE);
-
- // handle images
- if ("image/png".equals(content.getContentType()) || "image/jpeg".equals(content.getContentType()) || "image/gif".equals(content.getContentType())) {
- // defer to the jsp
- request.getRequestDispatcher("/WEB-INF/jsp/image.jsp").include(request, response);
- } else {
- final PrintWriter out = response.getWriter();
- out.println("Unexpected content type: " + content.getContentType());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer b/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
deleted file mode 100755
index 71cf2a2..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
+++ /dev/null
@@ -1,17 +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.
-image/png
-image/jpeg
-image/gif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp b/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
deleted file mode 100755
index 9dc5e3c..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
+++ /dev/null
@@ -1,39 +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.
---%>
-<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
-<script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script>
-<style>
- #image-holder {
- position: absolute;
- right: 50px;
- bottom: 50px;
- left: 100px;
- top: 100px;
- border: 1px solid #aaa;
- overflow: auto;
- background-color: #fff;
- padding: 4px;
- }
-</style>
-<div id="image-holder"></div>
-<script type="text/javascript">
- $(document).ready(function() {
- var ref = $('#ref').text();
- var imgElement = $('<img/>').attr('src', ref);
- $('#image-holder').append(imgElement);
- });
-</script>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml b/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
deleted file mode 100755
index bccf333..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,29 +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.
--->
-<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
- <display-name>nifi-image-viewer</display-name>
- <servlet>
- <servlet-name>ImageViewer</servlet-name>
- <servlet-class>org.apache.nifi.web.ImageViewerController</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>ImageViewer</servlet-name>
- <url-pattern>/view-content</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>view-content</welcome-file>
- </welcome-file-list>
-</web-app>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-image-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-image-bundle/pom.xml b/nifi-nar-bundles/nifi-image-bundle/pom.xml
deleted file mode 100644
index 324622a..0000000
--- a/nifi-nar-bundles/nifi-image-bundle/pom.xml
+++ /dev/null
@@ -1,35 +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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-nar-bundles</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nifi-image-bundle</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <modules>
- <module>nifi-image-processors</module>
- <module>nifi-image-nar</module>
- <module>nifi-image-viewer</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/pom.xml b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/pom.xml
new file mode 100755
index 0000000..ce92c40
--- /dev/null
+++ b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 http://maven.apache.org/maven-v4_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-media-bundle</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>nifi-image-viewer</artifactId>
+ <description>NiFi image viewer</description>
+ <packaging>war</packaging>
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <source.skip>true</source.skip>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>javax.servlet.jsp-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>javax.el-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp.jstl</groupId>
+ <artifactId>javax.servlet.jsp.jstl-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
new file mode 100755
index 0000000..a3ba1cd
--- /dev/null
+++ b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/java/org/apache/nifi/web/ImageViewerController.java
@@ -0,0 +1,52 @@
+/*
+ * 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.web;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebServlet(name = "ImageViewer", urlPatterns = {"/view-content"})
+public class ImageViewerController extends HttpServlet {
+
+ /**
+ * Handles generating markup for viewing an image.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ final ViewableContent content = (ViewableContent) request.getAttribute(ViewableContent.CONTENT_REQUEST_ATTRIBUTE);
+
+ // handle images
+ if ("image/png".equals(content.getContentType()) || "image/jpeg".equals(content.getContentType()) || "image/gif".equals(content.getContentType())) {
+ // defer to the jsp
+ request.getRequestDispatcher("/WEB-INF/jsp/image.jsp").include(request, response);
+ } else {
+ final PrintWriter out = response.getWriter();
+ out.println("Unexpected content type: " + content.getContentType());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
new file mode 100755
index 0000000..71cf2a2
--- /dev/null
+++ b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/META-INF/nifi-content-viewer
@@ -0,0 +1,17 @@
+# 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.
+image/png
+image/jpeg
+image/gif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
new file mode 100755
index 0000000..9dc5e3c
--- /dev/null
+++ b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/jsp/image.jsp
@@ -0,0 +1,39 @@
+<%--
+ 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.
+--%>
+<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
+<script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script>
+<style>
+ #image-holder {
+ position: absolute;
+ right: 50px;
+ bottom: 50px;
+ left: 100px;
+ top: 100px;
+ border: 1px solid #aaa;
+ overflow: auto;
+ background-color: #fff;
+ padding: 4px;
+ }
+</style>
+<div id="image-holder"></div>
+<script type="text/javascript">
+ $(document).ready(function() {
+ var ref = $('#ref').text();
+ var imgElement = $('<img/>').attr('src', ref);
+ $('#image-holder').append(imgElement);
+ });
+</script>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/6d7d4a8c/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..bccf333
--- /dev/null
+++ b/nifi-nar-bundles/nifi-media-bundle/nifi-image-viewer/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <display-name>nifi-image-viewer</display-name>
+ <servlet>
+ <servlet-name>ImageViewer</servlet-name>
+ <servlet-class>org.apache.nifi.web.ImageViewerController</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ImageViewer</servlet-name>
+ <url-pattern>/view-content</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>view-content</welcome-file>
+ </welcome-file-list>
+</web-app>