diff --git a/nifi-nar-maven-plugin/pom.xml b/nifi-nar-maven-plugin/pom.xml
index 7ba2d7c002..46dd33319d 100644
--- a/nifi-nar-maven-plugin/pom.xml
+++ b/nifi-nar-maven-plugin/pom.xml
@@ -15,142 +15,22 @@
-->
4.0.0
-
- org.apache
- apache
- 16
+ org.apache.nifi
+ nifi-parent
+ 1.0.0-incubating-SNAPSHOT
- org.apache.nifinifi-nar-maven-plugin1.0.1-incubating-SNAPSHOTmaven-pluginApache NiFi Nar Plugin. It is currently a part of the Apache Incubator.
- http://nifi.incubator.apache.org
-
- Apache NiFi (incubating)
- http://nifi.incubator.apache.org/
-
-
-
- Apache License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0
-
-
-
-
- Dev
- dev-subscribe@nifi.incubator.apache.org
- dev-unsubscribe@nifi.incubator.apache.org
- dev@nifi.incubator.apache.org
- http://mail-archives.apache.org/mod_mbox/incubator-nifi-dev
-
-
- Commits
- commits-subscribe@nifi.incubator.apache.org
- commits-unsubscribe@nifi.incubator.apache.org
- commits@nifi.incubator.apache.org
- http://mail-archives.apache.org/mod_mbox/incubator-nifi-commits
-
-
-
- scm:git:git://git.apache.org/incubator-nifi.git
- scm:git:https://git-wip-us.apache.org/repos/asf/incubator-nifi.git
- https://git-wip-us.apache.org/repos/asf?p=incubator-nifi.git
- HEAD
-
-
- JIRA
- https://issues.apache.org/jira/browse/NIFI
-
-
- 1.7
- 1.7
- 3.0.5
- UTF-8
- UTF-8
-
-
- ${maven.min-version}
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.2
-
- true
- true
- true
- true
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 2.7
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.18
-
- -Xmx1G
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.5.2
-
- gnu
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.4
-
-
- org.apache.maven.plugins
- maven-site-plugin
- 3.4
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.3.2
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.1
-
- false
- true
- private
- UTF-8
- true
- 1.7
- -J-Xmx512m
-
- org.apache.maven.pluginsmaven-release-plugin
- 2.5.1
-
- true
- apache-release
- true
- deploy
- @{project.artifactId}-@{project.version}
- false
- true
- default
@@ -163,24 +43,9 @@
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.5
-
-
+
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.5
- true
-
- repository.apache.org
- https://repository.apache.org/
-
- org.apache.maven.pluginsmaven-plugin-plugin
@@ -201,20 +66,9 @@
-
- org.apache.rat
- apache-rat-plugin
-
-
- nb-configuration.xml
- nbactions.xml
- DEPENDENCIES
-
-
-
-
+
-
+ org.apache.mavenmaven-plugin-api
@@ -240,27 +94,4 @@
3.3
-
-
-
- check-licenses
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
-
- check
-
- verify
-
-
-
-
-
-
-
diff --git a/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java b/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java
index da03182b92..0e3290208e 100644
--- a/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java
+++ b/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java
@@ -290,8 +290,8 @@ public class NarMojo extends AbstractMojo {
*/
@Parameter(property = "overWriteIfNewer", required = false, defaultValue = "true")
protected boolean overWriteIfNewer;
-
- @Parameter( property = "projectBuildDirectory", required = false, defaultValue = "${project.build.directory}")
+
+ @Parameter(property = "projectBuildDirectory", required = false, defaultValue = "${project.build.directory}")
protected File projectBuildDirectory;
/**
diff --git a/nifi-parent/DISCLAIMER b/nifi-parent/DISCLAIMER
new file mode 100644
index 0000000000..0f8e7a1ecc
--- /dev/null
+++ b/nifi-parent/DISCLAIMER
@@ -0,0 +1,15 @@
+Apache NiFi is an effort undergoing incubation at the Apache Software
+Foundation (ASF), sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be
+fully endorsed by the ASF.
+
+For more information about the incubation status of the Apache NiFi project
+you can go to the following page:
+
+http://nifi.incubator.apache.org/
diff --git a/nifi-parent/LICENSE b/nifi-parent/LICENSE
new file mode 100644
index 0000000000..7a4a3ea242
--- /dev/null
+++ b/nifi-parent/LICENSE
@@ -0,0 +1,202 @@
+
+ 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.
\ No newline at end of file
diff --git a/nifi-parent/NOTICE b/nifi-parent/NOTICE
new file mode 100644
index 0000000000..76a23fbb6d
--- /dev/null
+++ b/nifi-parent/NOTICE
@@ -0,0 +1,5 @@
+Apache NiFi
+Copyright 2014-2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/nifi-parent/README.md b/nifi-parent/README.md
new file mode 100644
index 0000000000..a7dd1ede34
--- /dev/null
+++ b/nifi-parent/README.md
@@ -0,0 +1,65 @@
+
+# Apache NiFi Parent
+
+Apache NiFi Parent provides a nice aggregation of shared concerns for all NiFi Poms to follow
+
+## Table of Contents
+
+- [Getting Started](#getting-started)
+- [License](#license)
+- [Disclaimer](#disclaimer)
+
+## Getting Started
+
+- Build the nifi-parent module. Then you can go to the 'nifi-nar-maven-plugin'
+directory and follow its instructions and finally the 'nifi' directory. Building
+the nifi-parent and nifi-nar-maven-plugin should be rarely necessary as these
+will be released infrequently by comparison to the 'nifi' tree.
+
+## Documentation
+
+See http://nifi.incubator.apache.org/ for the latest documentation.
+
+## License
+
+Except as otherwise noted this software is licensed under the
+[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
+
+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.
+
+## Disclaimer
+
+Apache NiFi is an effort undergoing incubation at the Apache Software
+Foundation (ASF), sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be
+fully endorsed by the ASF.
+
diff --git a/nifi-parent/pom.xml b/nifi-parent/pom.xml
new file mode 100644
index 0000000000..2e888c51e9
--- /dev/null
+++ b/nifi-parent/pom.xml
@@ -0,0 +1,396 @@
+
+
+
+ 4.0.0
+
+ org.apache
+ apache
+ 16
+
+
+ org.apache.nifi
+ nifi-parent
+ 1.0.0-incubating-SNAPSHOT
+ pom
+ The nifi-parent enables each apache nifi project to ensure consistent approaches and DRY
+ http://nifi.incubator.apache.org
+
+ Apache NiFi(incubating) Project
+ http://nifi.incubator.apache.org/
+
+
+
+ Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+
+ Dev
+ dev-subscribe@nifi.incubator.apache.org
+ dev-unsubscribe@nifi.incubator.apache.org
+ dev@nifi.incubator.apache.org
+ http://mail-archives.apache.org/mod_mbox/incubator-nifi-dev
+
+
+ Commits
+ commits-subscribe@nifi.incubator.apache.org
+ commits-unsubscribe@nifi.incubator.apache.org
+ commits@nifi.incubator.apache.org
+ http://mail-archives.apache.org/mod_mbox/incubator-nifi-commits
+
+
+
+ ${maven.min-version}
+
+
+ scm:git:git://git.apache.org/incubator-nifi.git
+ scm:git:https://git-wip-us.apache.org/repos/asf/incubator-nifi.git
+ https://git-wip-us.apache.org/repos/asf?p=incubator-nifi.git
+ HEAD
+
+
+ JIRA
+ https://issues.apache.org/jira/browse/NIFI
+
+
+ 1.7
+ 1.7
+ 3.0.5
+ UTF-8
+ UTF-8
+ 2014
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.2
+
+ true
+ true
+ true
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.5
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.9
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.7
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.18
+
+ true
+ -Xmx1G
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.5.2
+
+ gnu
+
+
+
+ org.codehaus.mojo
+ jaxb2-maven-plugin
+ 1.6
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.4
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.4
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.3.2
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.5
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.1
+
+ false
+ true
+ private
+ UTF-8
+ true
+ 1.7
+ -J-Xmx512m
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5.1
+
+ true
+ apache-release
+ true
+ deploy
+ @{project.artifactId}-@{project.version}
+ false
+ true
+
+
+
+ default
+
+ perform
+
+
+ nifi-parent/pom.xml
+
+
+
+
+
+ org.codehaus.mojo
+ rpm-maven-plugin
+ 2.1.1
+
+
+ org.antlr
+ antlr3-maven-plugin
+ 3.5.2
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.15
+
+
+ com.puppycrawl.tools
+ checkstyle
+ 6.5
+
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.5
+ true
+
+ repository.apache.org
+ https://repository.apache.org/
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+
+
+ enforce-maven
+
+ enforce
+
+
+
+
+
+ org.apache.maven.plugins:maven-surefire-plugin
+ org.apache.maven.plugins:maven-failsafe-plugin
+ org.apache.maven.plugins:maven-surefire-report-plugin
+
+
+
+ ${maven.min-version}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ warning
+ true
+ **/HelpMojo.java,**/generated-sources
+
+
+
+ org.apache.rat
+ apache-rat-plugin
+
+
+ nb-configuration.xml
+ nbactions.xml
+ DEPENDENCIES
+
+
+
+
+
+ org.apache.maven.doxia
+ doxia-core
+ 1.6
+
+
+ xerces
+ xercesImpl
+
+
+
+
+
+
+ check-licenses
+
+ check
+
+
+
+
+
+
+
+
+ checkstyle
+
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ check-style
+
+ check
+
+
+
+
+
+
+
+
+
diff --git a/nifi/LICENSE b/nifi/LICENSE
index 50150e3537..59075cdb25 100644
--- a/nifi/LICENSE
+++ b/nifi/LICENSE
@@ -455,3 +455,25 @@ This product bundles 'json2.js' which is available in the 'public domain'.
This product bundles 'reset.css' which is available in the 'public domain'.
For details see http://meyerweb.com/eric/tools/css/reset/
+This product bundles HexViewJS available under an MIT License
+
+ Copyright (c) 2010 Nick McVeity
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperties.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperties.java
index 6dbc86d792..902f5e9459 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperties.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperties.java
@@ -25,18 +25,13 @@ import java.lang.annotation.Target;
/**
* Indicates that a component has more than one dynamic property
- *
- * @author
*
*/
@Documented
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface DynamicProperties {
- /**
- * A list of the dynamic properties supported by a component
- * @return A list of the dynamic properties supported by a component
- */
+
public DynamicProperty[] value();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperty.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperty.java
index 07f349c388..dbb34b6b49 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperty.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicProperty.java
@@ -28,40 +28,19 @@ import org.apache.nifi.components.ConfigurableComponent;
/**
* An annotation that may be placed on a {@link ConfigurableComponent} to
* indicate that it supports a dynamic property.
- *
- * @author
*
*/
@Documented
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface DynamicProperty {
- /**
- * A description of what the name of the dynamic property may be
- *
- * @return A description of what the name of the dynamic property may be
- */
+
public String name();
- /**
- * Indicates whether or not the dynamic property supports expression
- * language
- *
- * @return whether or not the dynamic property supports expression
- * language
- */
public boolean supportsExpressionLanguage() default false;
-
- /**
- * A description of what the value of the dynamic property may be
- * @return a description of what the value of the dynamic property may be
- */
+
public String value();
-
- /**
- * Provides a description of what the meaning of the property is, and what the expected values are
- * @return a description of what the meaning of the property is, and what the expected values are
- */
+
public String description();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicRelationship.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicRelationship.java
index df0799fb6a..4129201b79 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicRelationship.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/DynamicRelationship.java
@@ -31,26 +31,15 @@ import org.apache.nifi.processor.Relationship;
* Annotation to indicate that a {@link Processor} supports dynamic
* relationship. A dynamic {@link Relationship} is one where the relationship is
* generated based on a user defined {@link PropertyDescriptor}
- *
- * @author
*
*/
@Documented
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface DynamicRelationship {
- /**
- * Describes the name(s) of the dynamic relationship(s)
- *
- * @return a description of the name(s) of the dynamic relationship(s)
- */
+
public String name();
- /**
- * Describes the data that should be routed to the dynamic relationship(s)
- *
- * @return a description the data that should be routed to the dynamic relationship(s)
- */
public String description();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttribute.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttribute.java
index d17ec2fed3..fb9e2abf91 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttribute.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttribute.java
@@ -24,27 +24,18 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor}
- * indicating that this processor reads a specific FlowFile attribute.
- *
- * @author
+ * Annotation that may be placed on a
+ * {@link org.apache.nifi.processor.Processor Processor} indicating that this
+ * processor reads a specific FlowFile attribute.
*
*/
-
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ReadsAttribute {
- /**
- * The FlowFile attribute that is being read
- * @return
- */
+
public String attribute();
-
- /**
- * The description of how the attribute is being used
- * @return
- */
+
public String description() default "";
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttributes.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttributes.java
index dfa3513edf..2610e1c6e4 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttributes.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/ReadsAttributes.java
@@ -16,7 +16,6 @@
*/
package org.apache.nifi.annotation.behavior;
-import org.apache.nifi.annotation.behavior.ReadsAttribute;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -25,10 +24,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor}
- * indicating that this processor reads specific FlowFile attributes.
- *
- * @author
+ * Annotation that may be placed on a
+ * {@link org.apache.nifi.processor.Processor Processor} indicating that this
+ * processor reads specific FlowFile attributes.
*
*/
@Documented
@@ -36,9 +34,6 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ReadsAttributes {
- /**
- * A list of attributes that may be read
- * @return
- */
+
public ReadsAttribute[] value();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/SideEffectFree.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/SideEffectFree.java
index f32acc37db..bd1e07d69a 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/SideEffectFree.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/SideEffectFree.java
@@ -24,18 +24,17 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
- * implementation can use to indicate that its
- * operations on FlowFiles can be safely repeated across process sessions. If a
- * processor has this annotation and it allows the framework to manage session
- * commit and rollback then the framework may elect to cascade a
- * {@link org.apache.nifi.processor.ProcessSession ProcessSession} given to this
- * processor's onTrigger method to the
- * onTrigger method of another processor. It can do this knowing that if
- * something fails along a series of processors using this same session that it
- * can all be safely rolled back without any ill effects on external services
- * which could not be rolled back and thus all the processes could be safely
- * repeated (implied idempotent behavior).
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
+ * implementation can use to indicate that its operations on FlowFiles can be
+ * safely repeated across process sessions. If a processor has this annotation
+ * and it allows the framework to manage session commit and rollback then the
+ * framework may elect to cascade a
+ * {@link org.apache.nifi.processor.ProcessSession ProcessSession} given to this
+ * processor's onTrigger method to the onTrigger method of another processor. It
+ * can do this knowing that if something fails along a series of processors
+ * using this same session that it can all be safely rolled back without any ill
+ * effects on external services which could not be rolled back and thus all the
+ * processes could be safely repeated (implied idempotent behavior).
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerSerially.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerSerially.java
index 7bf7d0b62f..f2f100bca6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerSerially.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerSerially.java
@@ -24,11 +24,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
- * implementation can use to indicate that the
- * Processor is not safe for concurrent execution of its onTrigger()
- * method. By default, Processors are assumed to be safe for concurrent
- * execution.
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
+ * implementation can use to indicate that the Processor is not safe for
+ * concurrent execution of its onTrigger() method. By default, Processors are
+ * assumed to be safe for concurrent execution.
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenAnyDestinationAvailable.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenAnyDestinationAvailable.java
index 803aa2f904..8f4da55708 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenAnyDestinationAvailable.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenAnyDestinationAvailable.java
@@ -25,11 +25,10 @@ import java.lang.annotation.Target;
/**
* Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
- * implementation can use to indicate that the
- * Processor is to be triggered if any of its destinations has available space
- * for incoming FlowFiles. By default, Processors are triggered only when all
- * destinations report that they have available space (i.e., none of the outgoing
- * Connections is full).
+ * implementation can use to indicate that the Processor is to be triggered if
+ * any of its destinations has available space for incoming FlowFiles. By
+ * default, Processors are triggered only when all destinations report that they
+ * have available space (i.e., none of the outgoing Connections is full).
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenEmpty.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenEmpty.java
index fed9b34823..0506c089ba 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenEmpty.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/TriggerWhenEmpty.java
@@ -24,13 +24,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
- * implementation can use to indicate that the
- * Processor should still be triggered even when it has no data in its work
- * queue. By default, Processors which have no non-self incoming edges will be
- * triggered even if there is no work in its queue. However, Processors that
- * have non-self incoming edges will only be triggered if they have work in
- * their queue or they present this annotation.
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor}
+ * implementation can use to indicate that the Processor should still be
+ * triggered even when it has no data in its work queue. By default, Processors
+ * which have no non-self incoming edges will be triggered even if there is no
+ * work in its queue. However, Processors that have non-self incoming edges will
+ * only be triggered if they have work in their queue or they present this
+ * annotation.
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttribute.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttribute.java
index 31d05d105b..841cf40e91 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttribute.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttribute.java
@@ -24,28 +24,18 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor}
- * indicating that this processor writes/updates a specific FlowFile attribute.
- *
- * @author
+ * Annotation that may be placed on a
+ * {@link org.apache.nifi.processor.Processor Processor} indicating that this
+ * processor writes/updates a specific FlowFile attribute.
*
*/
-
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface WritesAttribute {
-
- /**
- * The FlowFile attribute that is being created or updated
- * @return
- */
+
public String attribute();
-
- /**
- * A description of what is being written to the FlowFile attribute
- * @return
- */
+
public String description() default "";
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttributes.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttributes.java
index 4b03af9b53..3537e7270e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttributes.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/behavior/WritesAttributes.java
@@ -24,21 +24,16 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor}
- * indicating that this processor writes/updates specific FlowFile attributes.
- *
- * @author
+ * Annotation that may be placed on a
+ * {@link org.apache.nifi.processor.Processor Processor} indicating that this
+ * processor writes/updates specific FlowFile attributes.
*
*/
-
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface WritesAttributes {
- /**
- * A list of FlowFile attributes that may be written or updated
- * @return
- */
+
public WritesAttribute[] value();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/CapabilityDescription.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/CapabilityDescription.java
index d69788a9b1..0bdbbc6023 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/CapabilityDescription.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/CapabilityDescription.java
@@ -24,10 +24,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor},
+ * Annotation that may be placed on a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} allowing for a description to be
- * provided. This description can be provided to a user in logs, UI, etc.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} allowing for a
+ * description to be provided. This description can be provided to a user in
+ * logs, UI, etc.
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/SeeAlso.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/SeeAlso.java
index d664117984..35ca3db704 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/SeeAlso.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/SeeAlso.java
@@ -26,34 +26,19 @@ import java.lang.annotation.Target;
import org.apache.nifi.components.ConfigurableComponent;
/**
- * Annotation that may be placed on a
- * {@link org.apache.nifi.processor.Processor Processor},
+ * Annotation that may be placed on a null {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
* {@link org.apache.nifi.reporting.ReportingTask ReportingTask} that indicates
* this component is related to the components listed.
- *
- * @author
*
*/
-
@Documented
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface SeeAlso {
- /**
- * Classes you want to link to.
- *
- * @return
- */
+
public Class extends ConfigurableComponent>[] value() default {};
- /**
- * Fully qualified class names you want to link to. Use this when the class
- * you want to link to is not in the class path of the component you are
- * linking from.
- *
- * @return
- */
public String[] classNames() default {};
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/Tags.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/Tags.java
index 8bd8f9a051..366dd4c6ae 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/Tags.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/documentation/Tags.java
@@ -24,14 +24,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation that can be applied to a {@link org.apache.nifi.processor.Processor Processor},
+ * Annotation that can be applied to a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} in order to associate
- * tags (keywords) with the component. These tags do not affect the component in
- * any way but serve as additional documentation and can be used to sort/filter
- * Processors.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} in order to
+ * associate tags (keywords) with the component. These tags do not affect the
+ * component in any way but serve as additional documentation and can be used to
+ * sort/filter Processors.
*
- * @author none
*/
@Documented
@Target({ElementType.TYPE})
@@ -39,8 +38,5 @@ import java.lang.annotation.Target;
@Inherited
public @interface Tags {
- /**
- * @return all tag values associated with the given processor
- */
public String[] value();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java
index a1286ea473..b82533552a 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java
@@ -25,24 +25,24 @@ import java.lang.annotation.Target;
/**
*
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask}
- * implementation can use to indicate a method
- * should be called whenever the component is added to the flow. This method
- * will be called once for the entire life of a component instance.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
+ * can use to indicate a method should be called whenever the component is added
+ * to the flow. This method will be called once for the entire life of a
+ * component instance.
*
- *
+ *
*
- * Methods with this annotation are called without any arguments, as all settings
- * and properties can be assumed to be the defaults.
+ * Methods with this annotation are called without any arguments, as all
+ * settings and properties can be assumed to be the defaults.
*
- *
+ *
*
- * If any method annotated with this annotation throws a Throwable, the component
- * will not be added to the flow.
+ * If any method annotated with this annotation throws a Throwable, the
+ * component will not be added to the flow.
*
- * Marker annotation a {@link org.apache.nifi.controller.ControllerService ControllerService}
- * can use to indicate a method should be called whenever the service is disabled.
- *
+ * Marker annotation a
+ * {@link org.apache.nifi.controller.ControllerService ControllerService} can
+ * use to indicate a method should be called whenever the service is disabled.
+ *
*
*
- * Methods using this annotation are permitted to take zero arguments or to take a single
- * argument of type {@link ConfigurationContext}. If a method with this annotation
- * throws a Throwable, a log message and bulletin will be issued for the service, and the
- * service will remain in a 'DISABLING' state. When this occurs, the method with this annotation
- * will be called again after some period of time. This will continue until the method returns
- * without throwing any Throwable. Until that time, the service will remain in a 'DISABLING' state
- * and cannot be enabled again.
+ * Methods using this annotation are permitted to take zero arguments or to take
+ * a single argument of type {@link ConfigurationContext}. If a method with this
+ * annotation throws a Throwable, a log message and bulletin will be issued for
+ * the service, and the service will remain in a 'DISABLING' state. When this
+ * occurs, the method with this annotation will be called again after some
+ * period of time. This will continue until the method returns without throwing
+ * any Throwable. Until that time, the service will remain in a 'DISABLING'
+ * state and cannot be enabled again.
*
- *
+ *
*
- * Note that this annotation will be ignored if applied to a ReportingTask or Processor. For a Controller
- * Service, enabling and disabling are considered lifecycle events, as the action makes them usable or
- * unusable by other components. However, for a Processor and a Reporting
- * Task, these are not lifecycle events but rather a mechanism to allow a component to be excluded when
- * starting or stopping a group of components.
+ * Note that this annotation will be ignored if applied to a ReportingTask or
+ * Processor. For a Controller Service, enabling and disabling are considered
+ * lifecycle events, as the action makes them usable or unusable by other
+ * components. However, for a Processor and a Reporting Task, these are not
+ * lifecycle events but rather a mechanism to allow a component to be excluded
+ * when starting or stopping a group of components.
*
- * Marker annotation a {@link org.apache.nifi.controller.ControllerService ControllerService}
- * can use to indicate a method should be called whenever the service is enabled.
- * Any method that has this annotation will be called every time a user enables the service.
- * Additionally, each time that NiFi is restarted, if NiFi is configured to "auto-resume state"
- * and the service is enabled, the method will be invoked.
+ * Marker annotation a
+ * {@link org.apache.nifi.controller.ControllerService ControllerService} can
+ * use to indicate a method should be called whenever the service is enabled.
+ * Any method that has this annotation will be called every time a user enables
+ * the service. Additionally, each time that NiFi is restarted, if NiFi is
+ * configured to "auto-resume state" and the service is enabled, the method will
+ * be invoked.
*
*
*
- * Methods using this annotation must take either 0 arguments or a single argument of type
+ * Methods using this annotation must take either 0 arguments or a single
+ * argument of type
* {@link org.apache.nifi.controller.ConfigurationContext ConfigurationContext}.
*
- *
+ *
*
- * If a method with this annotation throws a Throwable, a log message and bulletin will be issued
- * for the component. In this event, the service will remain in an 'ENABLING' state and will not be
- * usable. All methods with this annotation will then be called again after a delay. The service will
- * not be made available for use until all methods with this annotation have returned without throwing
- * anything.
- *
- *
- *
- * Note that this annotation will be ignored if applied to a ReportingTask or Processor. For a Controller
- * Service, enabling and disabling are considered lifecycle events, as the action makes them usable or
- * unusable by other components. However, for a Processor and a Reporting
- * Task, these are not lifecycle events but rather a mechanism to allow a component to be excluded when
- * starting or stopping a group of components.
+ * If a method with this annotation throws a Throwable, a log message and
+ * bulletin will be issued for the component. In this event, the service will
+ * remain in an 'ENABLING' state and will not be usable. All methods with this
+ * annotation will then be called again after a delay. The service will not be
+ * made available for use until all methods with this annotation have returned
+ * without throwing anything.
*
*
- *
+ *
+ * Note that this annotation will be ignored if applied to a ReportingTask or
+ * Processor. For a Controller Service, enabling and disabling are considered
+ * lifecycle events, as the action makes them usable or unusable by other
+ * components. However, for a Processor and a Reporting Task, these are not
+ * lifecycle events but rather a mechanism to allow a component to be excluded
+ * when starting or stopping a group of components.
+ *
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
- * can use to indicate a method should be called whenever the component is removed
- * from the flow. This method will be called once for the entire life of a
- * component instance. If the method throw any Throwable, that Throwable will be
- * caught and logged but will not prevent subsequent methods with this annotation
- * or removal of the component from the flow.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
+ * can use to indicate a method should be called whenever the component is
+ * removed from the flow. This method will be called once for the entire life of
+ * a component instance. If the method throw any Throwable, that Throwable will
+ * be caught and logged but will not prevent subsequent methods with this
+ * annotation or removal of the component from the flow.
*
- *
+ *
*
- * Methods with this annotation are permitted to take no arguments or to take a single
- * argument. If using a single argument, that argument must be of type {@link ConfigurationContext}
- * if the component is a ReportingTask or a ControllerService. If the component is a Processor,
- * then the argument must be of type {@link ProcessContext}.
+ * Methods with this annotation are permitted to take no arguments or to take a
+ * single argument. If using a single argument, that argument must be of type
+ * {@link ConfigurationContext} if the component is a ReportingTask or a
+ * ControllerService. If the component is a Processor, then the argument must be
+ * of type {@link ProcessContext}.
*
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor} or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
- * can use to indicate a method should be called whenever the component is scheduled
- * to run. This will be called before any call to 'onTrigger' and will be called once each time
- * a Processor or Reporting Task is scheduled to run. This occurs in one of two ways: either
- * a user clicks to schedule the component to run, or NiFi is restarted with the "auto-resume state"
- * configuration set to true (the default value) and the component is already running.
- *
- *
- *
- * Methods using this annotation must take either 0 arguments or a single argument.
- *
- *
- *
- * If using 1 argument and the component using the annotation is a Processor, that argument must
- * be of type {@link org.apache.nifi.processor.ProcessContext ProcessContext}.
- *
- *
- *
- * If using 1 argument and the component using the annotation is a Reporting Task, that argument must
- * be of type {@link org.apache.nifi.controller.ConfigurationContext ConfigurationContext}.
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor} or
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
+ * can use to indicate a method should be called whenever the component is
+ * scheduled to run. This will be called before any call to 'onTrigger' and will
+ * be called once each time a Processor or Reporting Task is scheduled to run.
+ * This occurs in one of two ways: either a user clicks to schedule the
+ * component to run, or NiFi is restarted with the "auto-resume state"
+ * configuration set to true (the default value) and the component is already
+ * running.
*
*
- * If any method annotated with this annotation throws any Throwable, the framework will wait a while
- * and then attempt to invoke the method again. This will continue until the method succeeds, and the
- * component will then be scheduled to run after this method return successfully.
+ *
+ * Methods using this annotation must take either 0 arguments or a single
+ * argument.
+ *
+ *
+ *
+ * If using 1 argument and the component using the annotation is a Processor,
+ * that argument must be of type
+ * {@link org.apache.nifi.processor.ProcessContext ProcessContext}.
+ *
+ *
+ *
+ * If using 1 argument and the component using the annotation is a Reporting
+ * Task, that argument must be of type
+ * {@link org.apache.nifi.controller.ConfigurationContext ConfigurationContext}.
+ *
+ *
+ * If any method annotated with this annotation throws any Throwable, the
+ * framework will wait a while and then attempt to invoke the method again. This
+ * will continue until the method succeeds, and the component will then be
+ * scheduled to run after this method return successfully.
*
* @author none
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnShutdown.java b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnShutdown.java
index 3d1ce6c642..dd47a31dbb 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnShutdown.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnShutdown.java
@@ -28,21 +28,22 @@ import org.apache.nifi.processor.ProcessContext;
/**
*
- * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
+ * Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService}, or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
- * can use to indicate a method should be called whenever the flow is being shutdown.
- * This will be called at most once for each component in a JVM lifetime.
- * It is not, however, guaranteed that this method will be called on shutdown, as
- * the service may be killed suddenly.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
+ * can use to indicate a method should be called whenever the flow is being
+ * shutdown. This will be called at most once for each component in a JVM
+ * lifetime. It is not, however, guaranteed that this method will be called on
+ * shutdown, as the service may be killed suddenly.
*
- *
+ *
*
- * Methods with this annotation are permitted to take either 0 or 1 argument. If an argument
- * is used, it must be of type {@link ConfigurationContext} if the component is a ReportingTask
- * or Controller Service, or of type {@link ProcessContext} if the component is a Processor.
+ * Methods with this annotation are permitted to take either 0 or 1 argument. If
+ * an argument is used, it must be of type {@link ConfigurationContext} if the
+ * component is a ReportingTask or Controller Service, or of type
+ * {@link ProcessContext} if the component is a Processor.
*
* Marker annotation a {@link org.apache.nifi.processor.Processor Processor} or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask}
- * implementation can use to indicate that a method
- * should be called whenever the component is no longer scheduled to run.
- * Methods marked with this annotation will be invoked each time the component
- * is stopped and will be invoked only after the last thread has returned from
- * the onTrigger method.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
+ * can use to indicate that a method should be called whenever the component is
+ * no longer scheduled to run. Methods marked with this annotation will be
+ * invoked each time the component is stopped and will be invoked only after the
+ * last thread has returned from the onTrigger method.
*
* To indicate that a method should be called immediately when a component is no
- * longer scheduled to run (as opposed to after all threads have returned from the
- * onTrigger method), see the {@link OnUnscheduled} annotation.
+ * longer scheduled to run (as opposed to after all threads have returned from
+ * the onTrigger method), see the {@link OnUnscheduled} annotation.
*
- *
+ *
*
- * Methods with this annotation are permitted to take either 0 or 1 argument. If an argument
- * is used, it must be of type {@link ConfigurationContext} if the component is a ReportingTask
- * or of type {@link ProcessContext} if the component is a Processor.
+ * Methods with this annotation are permitted to take either 0 or 1 argument. If
+ * an argument is used, it must be of type {@link ConfigurationContext} if the
+ * component is a ReportingTask or of type {@link ProcessContext} if the
+ * component is a Processor.
*
* Marker annotation a {@link org.apache.nifi.processor.Processor Processor} or
- * {@link org.apache.nifi.reporting.ReportingTask ReportingTask}
- * should be called whenever the component is no longer scheduled to run.
- * Methods marked with this annotation will be invoked each time the framework
- * is notified to stop scheduling the component. This method is invoked as other
- * threads are potentially running. To invoke a method after all threads have
- * finished processing, see the {@link OnStopped} annotation.
+ * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} should be
+ * called whenever the component is no longer scheduled to run. Methods marked
+ * with this annotation will be invoked each time the framework is notified to
+ * stop scheduling the component. This method is invoked as other threads are
+ * potentially running. To invoke a method after all threads have finished
+ * processing, see the {@link OnStopped} annotation.
*
- *
+ *
*
- * Methods using this annotation must take either 0 arguments or a single argument.
+ * Methods using this annotation must take either 0 arguments or a single
+ * argument.
*
- *
+ *
*
- * If using 1 argument and the component using the annotation is a Processor, that argument must
- * be of type {@link org.apache.nifi.processor.ProcessContext ProcessContext}.
+ * If using 1 argument and the component using the annotation is a Processor,
+ * that argument must be of type
+ * {@link org.apache.nifi.processor.ProcessContext ProcessContext}.
*
- *
+ *
*
- * If using 1 argument and the component using the annotation is a Reporting Task, that argument must
- * be of type {@link org.apache.nifi.controller.ConfigurationContext ConfigurationContext}.
+ * If using 1 argument and the component using the annotation is a Reporting
+ * Task, that argument must be of type
+ * {@link org.apache.nifi.controller.ConfigurationContext ConfigurationContext}.
*
*/
@Documented
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/Authority.java b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/Authority.java
index 823f463644..4502c1196f 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/Authority.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/Authority.java
@@ -34,11 +34,9 @@ public enum Authority {
ROLE_NIFI;
/**
- * Returns the matching role or null if the specified role does not match
- * any roles.
- *
- * @param rawAuthority
- * @return
+ * @param rawAuthority string form of authority
+ * @return the matching role or null if the specified role does not match
+ * any roles
*/
public static Authority valueOfAuthority(String rawAuthority) {
Authority desiredAuthority = null;
@@ -54,9 +52,7 @@ public enum Authority {
}
/**
- * Gets the string value of each authority.
- *
- * @return
+ * @return the string value of each authority
*/
public static Set getRawAuthorities() {
Set authorities = new LinkedHashSet<>();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
index 7754c3502a..723ec33085 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
@@ -31,11 +31,9 @@ import org.apache.nifi.authorization.exception.UnknownIdentityException;
public interface AuthorityProvider {
/**
- * Returns whether the user with the specified DN is known to this authority
- * provider. It is not necessary for the user to have any authorities.
- *
- * @param dn
- * @return
+ * @param dn of the user
+ * @return whether the user with the specified DN is known to this authority
+ * provider. It is not necessary for the user to have any authorities
*/
boolean doesDnExist(String dn) throws AuthorityAccessException;
@@ -43,29 +41,30 @@ public interface AuthorityProvider {
* Get the authorities for the specified user. If the specified user exists
* but does not have any authorities, an empty set should be returned.
*
- * @param dn
- * @return
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ * @param dn of the user to lookup
+ * @return the authorities for the specified user. If the specified user
+ * exists but does not have any authorities, an empty set should be returned
+ * @throws UnknownIdentityException if identity is not known
+ * @throws AuthorityAccessException if unable to access authorities
*/
Set getAuthorities(String dn) throws UnknownIdentityException, AuthorityAccessException;
/**
* Sets the specified authorities for the specified user.
*
- * @param dn
- * @param authorities
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ * @param dn the specified user
+ * @param authorities the new authorities for the user
+ * @throws UnknownIdentityException if identity is not known
+ * @throws AuthorityAccessException if unable to access authorities
*/
void setAuthorities(String dn, Set authorities) throws UnknownIdentityException, AuthorityAccessException;
/**
* Gets the users for the specified authority.
*
- * @param authority
- * @return
- * @throws AuthorityAccessException
+ * @param authority for which to determine membership of
+ * @return all users with the specified authority
+ * @throws AuthorityAccessException if unable to access authorities
*/
Set getUsers(Authority authority) throws AuthorityAccessException;
@@ -73,19 +72,19 @@ public interface AuthorityProvider {
* Revokes the specified user. Its up to the implementor to determine the
* semantics of revocation.
*
- * @param dn
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ * @param dn the dn of the user
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void revokeUser(String dn) throws UnknownIdentityException, AuthorityAccessException;
/**
* Add the specified user.
*
- * @param dn
+ * @param dn of the user
* @param group Optional
- * @throws IdentityAlreadyExistsException
- * @throws AuthorityAccessException
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void addUser(String dn, String group) throws IdentityAlreadyExistsException, AuthorityAccessException;
@@ -93,10 +92,10 @@ public interface AuthorityProvider {
* Gets the group for the specified user. Return null if the user does not
* belong to a group.
*
- * @param dn
- * @return
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ * @param dn the user
+ * @return the group of the given user
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
String getGroupForUser(String dn) throws UnknownIdentityException, AuthorityAccessException;
@@ -104,26 +103,28 @@ public interface AuthorityProvider {
* Revokes all users for a specified group. Its up to the implementor to
* determine the semantics of revocation.
*
- * @param group
- * @throws AuthorityAccessException
+ * @param group to revoke the users of
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void revokeGroup(String group) throws UnknownIdentityException, AuthorityAccessException;
/**
* Adds the specified users to the specified group.
*
- * @param dn
- * @param group
- * @throws AuthorityAccessException
+ * @param dn the set of users to add to the group
+ * @param group to add users to
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void setUsersGroup(Set dn, String group) throws UnknownIdentityException, AuthorityAccessException;
/**
* Ungroups the specified user.
*
- * @param dn
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ * @param dn of the user
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void ungroupUser(String dn) throws UnknownIdentityException, AuthorityAccessException;
@@ -133,41 +134,41 @@ public interface AuthorityProvider {
* does not exist. If an admin revoked this group before calling ungroup, it
* may or may not exist.
*
- * @param group
- * @throws AuthorityAccessException
+ * @param group to ungroup
+ * @throws AuthorityAccessException if unable to access the authorities
*/
void ungroup(String group) throws AuthorityAccessException;
/**
- * Determines whether the user in the specified dnChain should be able to
+ * Determines whether the user in the specified dnChain should be able to
* download the content for the flowfile with the specified attributes.
- *
- * The first dn in the chain is the end user that the request was issued on
+ *
+ * The first dn in the chain is the end user that the request was issued on
* behalf of. The subsequent dn's in the chain represent entities proxying
* the user's request with the last being the proxy that sent the current
* request.
- *
- * @param dnChain
- * @param attributes
- * @return
- * @throws UnknownIdentityException
- * @throws AuthorityAccessException
+ *
+ * @param dnChain of the user
+ * @param attributes of the flowfile being requested
+ * @return the authorization result
+ * @throws UnknownIdentityException if the user is not known
+ * @throws AuthorityAccessException if unable to access the authorities
*/
DownloadAuthorization authorizeDownload(List dnChain, Map attributes) throws UnknownIdentityException, AuthorityAccessException;
-
+
/**
* Called immediately after instance creation for implementers to perform
* additional setup
*
- * @param initializationContext
+ * @param initializationContext in which to initialize
*/
void initialize(AuthorityProviderInitializationContext initializationContext) throws ProviderCreationException;
/**
* Called to configure the AuthorityProvider.
*
- * @param configurationContext
- * @throws ProviderCreationException
+ * @param configurationContext at the time of configuration
+ * @throws ProviderCreationException for any issues configuring the provider
*/
void onConfigured(AuthorityProviderConfigurationContext configurationContext) throws ProviderCreationException;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProviderConfigurationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProviderConfigurationContext.java
index 6765ed4afe..c1ba5dfd80 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProviderConfigurationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProviderConfigurationContext.java
@@ -24,9 +24,7 @@ import java.util.Map;
public interface AuthorityProviderConfigurationContext {
/**
- * The identifier for the authority provider.
- *
- * @return
+ * @return identifier for the authority provider
*/
String getIdentifier();
@@ -41,12 +39,10 @@ public interface AuthorityProviderConfigurationContext {
Map getProperties();
/**
- * Retrieves the value the component currently understands for the given
+ * @param property to lookup the descriptor and value of
+ * @return the value the component currently understands for the given
* PropertyDescriptor. This method does not substitute default
- * PropertyDescriptor values, so the value returned will be null if not set.
- *
- * @param property
- * @return
+ * PropertyDescriptor values, so the value returned will be null if not set
*/
String getProperty(String property);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
index 08695fa91e..02fd839fa0 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
@@ -22,6 +22,7 @@ package org.apache.nifi.authorization;
public class DownloadAuthorization {
private static enum Result {
+
Approved,
Denied;
};
@@ -32,10 +33,11 @@ public class DownloadAuthorization {
private final String explanation;
/**
- * Creates a new DownloadAuthorization with the specified result and explanation.
- *
- * @param result
- * @param explanation
+ * Creates a new DownloadAuthorization with the specified result and
+ * explanation.
+ *
+ * @param result of the authorization
+ * @param explanation for the authorization attempt
*/
private DownloadAuthorization(Result result, String explanation) {
if (Result.Denied.equals(result) && explanation == null) {
@@ -47,38 +49,33 @@ public class DownloadAuthorization {
}
/**
- * Whether or not the download request is approved.
- *
- * @return
+ * @return Whether or not the download request is approved
*/
public boolean isApproved() {
return Result.Approved.equals(result);
}
/**
- * If the download request is denied, the reason why. Null otherwise.
- *
- * @return
+ * @return If the download request is denied, the reason why. Null otherwise
*/
public String getExplanation() {
return explanation;
}
/**
- * Creates a new approved DownloadAuthorization.
- *
- * @return
+ * @return a new approved DownloadAuthorization
*/
public static DownloadAuthorization approved() {
return APPROVED;
}
/**
- * Creates a new denied DownloadAuthorization with the specified explanation.
- *
- * @param explanation
- * @return
- * @throws IllegalArgumentException if explanation is null
+ * Creates a new denied DownloadAuthorization with the specified
+ * explanation.
+ *
+ * @param explanation for why it was denied
+ * @return a new denied DownloadAuthorization with the specified explanation
+ * @throws IllegalArgumentException if explanation is null
*/
public static DownloadAuthorization denied(String explanation) {
return new DownloadAuthorization(Result.Denied, explanation);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/AbstractConfigurableComponent.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/AbstractConfigurableComponent.java
index 6736788a84..1d4e0c200e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/AbstractConfigurableComponent.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/AbstractConfigurableComponent.java
@@ -46,11 +46,9 @@ public abstract class AbstractConfigurableComponent implements ConfigurableCompo
}
/**
- * Returns a PropertyDescriptor for the name specified that is fully
+ * @param descriptorName to lookup the descriptor
+ * @return a PropertyDescriptor for the name specified that is fully
* populated
- *
- * @param descriptorName
- * @return
*/
@Override
public final PropertyDescriptor getPropertyDescriptor(final String descriptorName) {
@@ -141,11 +139,12 @@ public abstract class AbstractConfigurableComponent implements ConfigurableCompo
* method a processor may simply get the latest value whenever it needs it
* and if necessary lazily evaluate it.
*
- * @param descriptor
+ * @param descriptor of the modified property
* @param oldValue non-null property value (previous)
* @param newValue the new property value or if null indicates the property
* was removed
*/
+ @Override
public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) {
}
@@ -168,7 +167,7 @@ public abstract class AbstractConfigurableComponent implements ConfigurableCompo
*
* Default is null.
*
- * @param propertyDescriptorName
+ * @param propertyDescriptorName used to lookup if any property descriptors exist for that name
* @return new property descriptor if supported
*/
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
@@ -186,9 +185,10 @@ public abstract class AbstractConfigurableComponent implements ConfigurableCompo
return Collections.EMPTY_LIST;
}
+ @Override
public final List getPropertyDescriptors() {
final List supported = getSupportedPropertyDescriptors();
- return supported == null ? Collections.emptyList() :new ArrayList<>(supported);
+ return supported == null ? Collections.emptyList() : new ArrayList<>(supported);
}
@Override
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/AllowableValue.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/AllowableValue.java
index 8921340611..a4809616d6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/AllowableValue.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/AllowableValue.java
@@ -33,7 +33,7 @@ public class AllowableValue {
* Constructs a new AllowableValue with the given value and and the same
* display name and no description.
*
- * @param value
+ * @param value that is allowed
*/
public AllowableValue(final String value) {
this(value, value);
@@ -43,8 +43,8 @@ public class AllowableValue {
* Constructs a new AllowableValue with the given value and display name and
* no description
*
- * @param value
- * @param displayName
+ * @param value that is allowed
+ * @param displayName to display for the value
*
* @throws NullPointerException if either argument is null
*/
@@ -56,9 +56,9 @@ public class AllowableValue {
* Constructs a new AllowableValue with the given value, display name, and
* description
*
- * @param value
- * @param displayName
- * @param description
+ * @param value that is valid
+ * @param displayName to show for the value
+ * @param description of the value
*
* @throws NullPointerException if identifier or value is null
*/
@@ -69,40 +69,33 @@ public class AllowableValue {
}
/**
- * Returns the value of this AllowableValue
- *
- * @return
+ * @return the value of this AllowableValue
*/
public String getValue() {
return value;
}
/**
- * Returns a human-readable name for this AllowableValue
- *
- * @return
+ * @return a human-readable name for this AllowableValue
*/
public String getDisplayName() {
return displayName;
}
/**
- * Returns a description for this value, or null if no
+ * @return a description for this value, or null if no
* description was provided
- *
- * @return
*/
public String getDescription() {
return description;
}
/**
- * this is equal to obj of obj is the
+ * @return true if this is equal to obj of obj is the
* same object as this or if obj is an instance of
* AllowableValue and both have the same value, or if
* obj is a String and is equal to
* {@link #getValue() this.getValue()}.
- * @return
*/
@Override
public boolean equals(final Object obj) {
@@ -121,8 +114,7 @@ public class AllowableValue {
}
/**
- * Hash Code is based solely off of the value
- * @return
+ * @return based solely off of the value
*/
@Override
public int hashCode() {
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java
index 24e1f3c9ea..8b56f482a6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java
@@ -27,7 +27,7 @@ public interface ConfigurableComponent {
* not included in the in the purposed configuration, the default value will
* be used.
*
- * @param context
+ * @param context of validation
* @return Collection of validation result objects for any invalid findings
* only. If the collection is empty then the component is valid. Guaranteed
* non-null
@@ -35,11 +35,9 @@ public interface ConfigurableComponent {
Collection validate(ValidationContext context);
/**
- * Returns the PropertyDescriptor with the given name, if it exists;
- * otherwise, returns null.
- *
- * @param name
- * @return
+ * @param name to lookup the descriptor
+ * @return the PropertyDescriptor with the given name, if it exists;
+ * otherwise, returns null
*/
PropertyDescriptor getPropertyDescriptor(String name);
@@ -51,7 +49,7 @@ public interface ConfigurableComponent {
* necessary lazily evaluate it. Any throwable that escapes this method will
* simply be ignored.
*
- * @param descriptor
+ * @param descriptor the descriptor for the property being modified
* @param oldValue the value that was previously set, or null if no value
* was previously set for this property
* @param newValue the new property value or if null indicates the property
@@ -68,10 +66,8 @@ public interface ConfigurableComponent {
List getPropertyDescriptors();
/**
- * Returns the unique identifier that the framework assigned to this
+ * @return the unique identifier that the framework assigned to this
* component
- *
- * @return
*/
String getIdentifier();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
index e62ff7962c..acda6c4bfa 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
@@ -29,7 +29,6 @@ import org.apache.nifi.controller.ControllerService;
* An immutable object for holding information about a type of processor
* property.
*
- * @author unattributed
*/
public final class PropertyDescriptor implements Comparable {
@@ -121,9 +120,9 @@ public final class PropertyDescriptor implements Comparable
* If this descriptor has a set of allowable values then the given value is
* only checked against the allowable values.
*
- * @param input
- * @param context
- * @return
+ * @param input the value to validate
+ * @param context the context of validation
+ * @return the result of validating the input
*/
public ValidationResult validate(final String input, final ValidationContext context) {
ValidationResult lastResult = Validator.INVALID.validate(this.name, input, context);
@@ -142,17 +141,17 @@ public final class PropertyDescriptor implements Comparable
final Set validIdentifiers = context.getControllerServiceLookup().getControllerServiceIdentifiers(controllerServiceDefinition);
if (validIdentifiers != null && validIdentifiers.contains(input)) {
final ControllerService controllerService = context.getControllerServiceLookup().getControllerService(input);
- if ( !context.isValidationRequired(controllerService) ) {
+ if (!context.isValidationRequired(controllerService)) {
return new ValidationResult.Builder()
- .input(input)
- .subject(getName())
- .valid(true)
- .build();
+ .input(input)
+ .subject(getName())
+ .valid(true)
+ .build();
}
-
+
final String serviceId = controllerService.getIdentifier();
- if (!context.getControllerServiceLookup().isControllerServiceEnabled(serviceId) &&
- !context.getControllerServiceLookup().isControllerServiceEnabling(serviceId)) {
+ if (!context.getControllerServiceLookup().isControllerServiceEnabled(serviceId)
+ && !context.getControllerServiceLookup().isControllerServiceEnabling(serviceId)) {
return new ValidationResult.Builder()
.input(context.getControllerServiceLookup().getControllerServiceName(serviceId))
.subject(getName())
@@ -235,8 +234,8 @@ public final class PropertyDescriptor implements Comparable
* This is beneficial because it allows a User Interface to represent
* the name differently.
*
- * @param displayName
- * @return
+ * @param displayName of the property
+ * @return the builder
*/
public Builder displayName(final String displayName) {
if (null != displayName) {
@@ -249,8 +248,8 @@ public final class PropertyDescriptor implements Comparable
/**
* Sets the property name.
*
- * @param name
- * @return
+ * @param name of the property
+ * @return the builder
*/
public Builder name(final String name) {
if (null != name) {
@@ -263,8 +262,8 @@ public final class PropertyDescriptor implements Comparable
* Sets the value indicating whether or not this Property will support
* the Attribute Expression Language.
*
- * @param supported
- * @return
+ * @param supported true if yes; false otherwise
+ * @return the builder
*/
public Builder expressionLanguageSupported(final boolean supported) {
this.expressionLanguageSupported = supported;
@@ -272,9 +271,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param description
- * @return
+ * @param description of the property
+ * @return the builder
*/
public Builder description(final String description) {
if (null != description) {
@@ -294,8 +292,8 @@ public final class PropertyDescriptor implements Comparable
* should be set to the "Value" of the {@link AllowableValue} object
* (see {@link AllowableValue#getValue()}).
*
- * @param value
- * @return
+ * @param value default value
+ * @return the builder
*/
public Builder defaultValue(final String value) {
if (null != value) {
@@ -310,9 +308,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param values
- * @return
+ * @param values contrained set of values
+ * @return the builder
*/
public Builder allowableValues(final Set values) {
if (null != values) {
@@ -336,9 +333,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param values
- * @return
+ * @param values constrained set of values
+ * @return the builder
*/
public Builder allowableValues(final String... values) {
if (null != values) {
@@ -353,8 +349,8 @@ public final class PropertyDescriptor implements Comparable
/**
* Sets the Allowable Values for this Property
*
- * @param values
- * @return
+ * @param values contrained set of values
+ * @return the builder
*/
public Builder allowableValues(final AllowableValue... values) {
if (null != values) {
@@ -364,9 +360,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param required
- * @return
+ * @param required true if yes; false otherwise
+ * @return the builder
*/
public Builder required(final boolean required) {
this.required = required;
@@ -374,9 +369,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param sensitive
- * @return
+ * @param sensitive true if sensitive; false otherwise
+ * @return the builder
*/
public Builder sensitive(final boolean sensitive) {
this.sensitive = sensitive;
@@ -384,9 +378,8 @@ public final class PropertyDescriptor implements Comparable
}
/**
- *
- * @param validator
- * @return
+ * @param validator for the property
+ * @return the builder
*/
public Builder addValidator(final Validator validator) {
if (validator != null) {
@@ -401,7 +394,7 @@ public final class PropertyDescriptor implements Comparable
*
* @param controllerServiceDefinition the interface that is implemented
* by the Controller Service
- * @return
+ * @return the builder
*/
public Builder identifiesControllerService(final Class extends ControllerService> controllerServiceDefinition) {
if (controllerServiceDefinition != null) {
@@ -436,7 +429,7 @@ public final class PropertyDescriptor implements Comparable
throw new IllegalStateException("Must specify a name");
}
if (!isValueAllowed(defaultValue)) {
- throw new IllegalStateException("Default value ["+ defaultValue +"] is not in the set of allowable values");
+ throw new IllegalStateException("Default value [" + defaultValue + "] is not in the set of allowable values");
}
return new PropertyDescriptor(this);
@@ -525,7 +518,7 @@ public final class PropertyDescriptor implements Comparable
* Constructs a validator that will check if the given value is in the
* given set.
*
- * @param validValues
+ * @param validValues values which are acceptible
* @throws NullPointerException if the given validValues is null
*/
private ConstrainedSetValidator(final Collection validValues) {
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyValue.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyValue.java
index 1c5f04a943..1845ed224c 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyValue.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/PropertyValue.java
@@ -89,25 +89,21 @@ public interface PropertyValue {
public Double asDataSize(DataUnit dataUnit);
/**
- * Returns the ControllerService whose identifier is the raw value of
+ * @return the ControllerService whose identifier is the raw value of
* this, or null if either the value is not set or
* the value does not identify a ControllerService
- *
- * @return
*/
public ControllerService asControllerService();
/**
- * Returns the ControllerService whose identifier is the raw value of the
+ * @param the generic type of the controller service
+ * @param serviceType the class of the Controller Service
+ * @return the ControllerService whose identifier is the raw value of the
* this, or null if either the value is not set or
* the value does not identify a ControllerService. The object returned by
* this method is explicitly cast to type specified, if the type specified
* is valid. Otherwise, throws an IllegalArgumentException
*
- * @param
- * @param serviceType
- * @return
- *
* @throws IllegalArgumentException if the value of this points
* to a ControllerService but that service is not of type
* serviceType or if serviceType references a
@@ -116,11 +112,9 @@ public interface PropertyValue {
public T asControllerService(Class serviceType) throws IllegalArgumentException;
/**
- * Returns true if the user has configured a value, or if the
+ * @return true if the user has configured a value, or if the
* {@link PropertyDescriptor} for the associated property has a default
- * value, false otherwise.
- *
- * @return
+ * value, false otherwise
*/
public boolean isSet();
@@ -131,7 +125,8 @@ public interface PropertyValue {
* call chaining.
*
*
- * @return
+ * @return a PropertyValue with the new value is returned, supporting call
+ * chaining
*
* @throws ProcessException if the Query cannot be compiled or evaluating
* the query against the given attributes causes an Exception to be thrown
@@ -145,8 +140,9 @@ public interface PropertyValue {
* call chaining.
*
*
- * @param flowFile
- * @return
+ * @param flowFile to evaluate attributes of
+ * @return a PropertyValue with the new value is returned, supporting call
+ * chaining
*
* @throws ProcessException if the Query cannot be compiled or evaluating
* the query against the given attributes causes an Exception to be thrown
@@ -161,8 +157,10 @@ public interface PropertyValue {
* supporting call chaining.
*
*
- * @param decorator
- * @return
+ * @param decorator The supplied decorator is then given a chance to
+ * decorate the value
+ * @return a PropertyValue with the new value is then returned, supporting
+ * call chaining
*
* @throws ProcessException if the Query cannot be compiled or evaluating
* the query against the given attributes causes an Exception to be thrown
@@ -177,10 +175,12 @@ public interface PropertyValue {
* supporting call chaining.
*
*
- * @param flowFile
- * @param decorator
+ * @param flowFile to evaluate expressions against
+ * @param decorator The supplied decorator is then given a chance to
+ * decorate the value
*
- * @return
+ * @return a PropertyValue with the new value is then returned, supporting
+ * call chaining
*
* @throws ProcessException if the Query cannot be compiled or evaluating
* the query against the given attributes causes an Exception to be thrown
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationContext.java
index 61b68a249c..a1dcf438dd 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationContext.java
@@ -25,86 +25,71 @@ import org.apache.nifi.expression.ExpressionLanguageCompiler;
public interface ValidationContext {
/**
- * Returns the {@link ControllerServiceLookup} which can be used to obtain
+ * @return the {@link ControllerServiceLookup} which can be used to obtain
* Controller Services
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
/**
- * Returns a ValidationContext that is appropriate for validating the given
+ * @param controllerService to lookup the validation context of
+ * @return a ValidationContext that is appropriate for validating the given
* {@link ControllerService}
- *
- * @param controllerService
- * @return
*/
ValidationContext getControllerServiceValidationContext(ControllerService controllerService);
/**
- * Creates and returns a new {@link ExpressionLanguageCompiler} that can be
- * used to compile & evaluate Attribute Expressions
- *
- * @return
+ * @return a new {@link ExpressionLanguageCompiler} that can be used to
+ * compile & evaluate Attribute Expressions
*/
ExpressionLanguageCompiler newExpressionLanguageCompiler();
/**
- * Returns a PropertyValue that encapsulates the value configured for the
+ * @param property being validated
+ * @return a PropertyValue that encapsulates the value configured for the
* given PropertyDescriptor
- *
- * @param property
- * @return
*/
PropertyValue getProperty(PropertyDescriptor property);
/**
- * Returns a PropertyValue that represents the given value
- *
- * @param value
- * @return
+ * @param value to make a PropertyValue object for
+ * @return a PropertyValue that represents the given value
*/
PropertyValue newPropertyValue(String value);
/**
- * Returns a Map of all configured Properties.
- *
- * @return
+ * @return a Map of all configured Properties
*/
Map getProperties();
/**
- * Returns the currently configured Annotation Data
- *
- * @return
+ * @return the currently configured Annotation Data
*/
String getAnnotationData();
-
+
/**
- * There are times when the framework needs to consider a component valid, even if it
- * references an invalid ControllerService. This method will return false
- * if the component is to be considered valid even if the given Controller Service is referenced
- * and is invalid.
- * @param service
+ * There are times when the framework needs to consider a component valid,
+ * even if it references an invalid ControllerService. This method will
+ * return false if the component is to be considered valid even
+ * if the given Controller Service is referenced and is invalid.
+ *
+ * @param service to check if validation is required
+ * @return false if the component is to be considered valid
+ * even if the given Controller Service is referenced and is invalid
*/
boolean isValidationRequired(ControllerService service);
-
+
/**
- * Returns true if the given value contains a NiFi Expression Language expression,
- * false if it does not
- *
- * @param value
- * @return
+ * @param value to test whether expression language is present
+ * @return true if the given value contains a NiFi Expression
+ * Language expression, false if it does not
*/
boolean isExpressionLanguagePresent(String value);
-
+
/**
- * Returns true if the property with the given name supports the NiFi Expression Language,
- * false if the property does not support the Expression Language or is not a valid property
- * name
- *
- * @param propertyName
- * @return
+ * @param propertyName to test whether expression language is supported
+ * @return true if the property with the given name supports
+ * the NiFi Expression Language, false if the property does not
+ * support the Expression Language or is not a valid property name
*/
boolean isExpressionLanguageSupported(String propertyName);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationResult.java b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationResult.java
index 3a54848fa0..2736044708 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationResult.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/components/ValidationResult.java
@@ -119,8 +119,8 @@ public class ValidationResult {
/**
* Defaults to false
*
- * @param valid
- * @return
+ * @param valid true if is valid; false otherwise
+ * @return the builder
*/
public Builder valid(final boolean valid) {
this.valid = valid;
@@ -130,8 +130,8 @@ public class ValidationResult {
/**
* Defaults to empty string
*
- * @param input
- * @return
+ * @param input what was validated
+ * @return the builder
*/
public Builder input(final String input) {
if (null != input) {
@@ -143,8 +143,8 @@ public class ValidationResult {
/**
* Defaults to empty string
*
- * @param explanation
- * @return
+ * @param explanation of validation result
+ * @return the builder
*/
public Builder explanation(final String explanation) {
if (null != explanation) {
@@ -156,8 +156,8 @@ public class ValidationResult {
/**
* Defaults to empty string
*
- * @param subject
- * @return
+ * @param subject the thing that was validated
+ * @return the builder
*/
public Builder subject(final String subject) {
if (null != subject) {
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
index 71cdd231ea..cd3b9bdc10 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
@@ -32,7 +32,7 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
private ControllerServiceLookup serviceLookup;
private volatile ConfigurationContext configContext;
private ComponentLog logger;
-
+
@Override
public final void initialize(final ControllerServiceInitializationContext context) throws InitializationException {
this.identifier = context.getIdentifier();
@@ -52,31 +52,25 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
}
/**
- * Returns the currently configured value for the given
+ * @param descriptor to retrieve value of
+ * @return the currently configured value for the given
* {@link PropertyDescriptor}
- *
- * @param descriptor
- * @return
*/
protected final PropertyValue getProperty(final PropertyDescriptor descriptor) {
return configContext.getProperty(descriptor);
}
/**
- * Returns an unmodifiable map of all configured properties for this
+ * @return an unmodifiable map of all configured properties for this
* {@link ControllerService}
- *
- * @return
*/
protected final Map getProperties() {
return configContext.getProperties();
}
/**
- * Returns the {@link ControllerServiceLookup} that was passed to the
+ * @return the {@link ControllerServiceLookup} that was passed to the
* {@link #init(ProcessorInitializationContext)} method
- *
- * @return
*/
protected final ControllerServiceLookup getControllerServiceLookup() {
return serviceLookup;
@@ -86,15 +80,15 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
* Provides a mechanism by which subclasses can perform initialization of
* the Reporting Task before it is scheduled to be run
*
- * @param config
- * @throws InitializationException
+ * @param config of initialization context
+ * @throws InitializationException if unable to init
*/
protected void init(final ControllerServiceInitializationContext config) throws InitializationException {
}
-
+
/**
- * Returns the logger that has been provided to the component by the framework in its initialize method.
- * @return
+ * @return the logger that has been provided to the component by the
+ * framework in its initialize method
*/
protected ComponentLog getLogger() {
return logger;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
index 7ed09170ed..1fff6b9b34 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
@@ -28,18 +28,14 @@ import org.apache.nifi.components.PropertyValue;
public interface ConfigurationContext {
/**
- * Returns the configured value for the property with the given name
- *
- * @param property
- * @return
+ * @param property to retrieve by name
+ * @return the configured value for the property with the given name
*/
PropertyValue getProperty(PropertyDescriptor property);
/**
- * Returns an unmodifiable map of all configured properties for this
+ * @return an unmodifiable map of all configured properties for this
* {@link ControllerService}
- *
- * @return
*/
Map getProperties();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerService.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerService.java
index cbf81a5a9b..a77c69d7a6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerService.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerService.java
@@ -68,21 +68,20 @@ import org.apache.nifi.reporting.ReportingTask;
*
*
*
- * public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor.Builder()
- * .name("My Property")
- * .description("Example Property")
- * .identifiesControllerService( MyControllerServiceInterface.class )
- * .build();
+ * public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor.Builder()
+ * .name("My Property")
+ * .description("Example Property")
+ * .identifiesControllerService( MyControllerServiceInterface.class )
+ * .build();
*
- * ...
+ * ...
+ * public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
+ * // Obtain the user-selected controller service
+ * final MyControllerServiceInterface service = context.getProperty(MY_PROPERTY).asControllerService( MyControllerServiceInterface.class );
+ * ...
+ * }
*
- * public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
- * // Obtain the user-selected controller service
- * final MyControllerServiceInterface service = context.getProperty(MY_PROPERTY).asControllerService( MyControllerServiceInterface.class );
- * ...
- * }
- *
- *
+ *
*
*
A Controller Service can be obtained via a
* {@link ControllerServiceLookup}. This lookup may be obtained, for example,
@@ -94,10 +93,9 @@ import org.apache.nifi.reporting.ReportingTask;
*
*
*
- * public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
- * final MyControllerServiceInterface service = (MyControllerServiceInterface)
- * context.getControllerServiceLookup().getControllerService("service_identifier");
- * }
+ * public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
+ * final MyControllerServiceInterface service = (MyControllerServiceInterface) context.getControllerServiceLookup().getControllerService("service_identifier");
+ * }
*
*
*
@@ -174,8 +172,8 @@ public interface ControllerService extends ConfigurableComponent {
* throughout the life of the service. This method will be called before any
* properties are set
*
- * @param context
- * @throws org.apache.nifi.reporting.InitializationException
+ * @param context of initialization
+ * @throws org.apache.nifi.reporting.InitializationException if unable to init
*/
void initialize(ControllerServiceInitializationContext context) throws InitializationException;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceInitializationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceInitializationContext.java
index d34c6354ad..6fcee0c7bd 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceInitializationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceInitializationContext.java
@@ -21,26 +21,20 @@ import org.apache.nifi.logging.ComponentLog;
public interface ControllerServiceInitializationContext {
/**
- * Returns the identifier associated with the {@link ControllerService} with
+ * @return the identifier associated with the {@link ControllerService} with
* which this context is associated
- *
- * @return
*/
String getIdentifier();
/**
- * Returns the {@link ControllerServiceLookup} which can be used to obtain
+ * @return the {@link ControllerServiceLookup} which can be used to obtain
* Controller Services
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
-
+
/**
- * Returns a logger that can be used to log important events in a standard way and generate
- * bulletins when appropriate
- *
- * @return
+ * @return a logger that can be used to log important events in a standard
+ * way and generate bulletins when appropriate
*/
ComponentLog getLogger();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceLookup.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceLookup.java
index 4b96f626a6..f5300b15c5 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceLookup.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/ControllerServiceLookup.java
@@ -18,68 +18,53 @@ package org.apache.nifi.controller;
import java.util.Set;
-
public interface ControllerServiceLookup {
/**
- * Returns the ControllerService that is registered with the given
+ * @param serviceIdentifier of controller service
+ * @return the ControllerService that is registered with the given
* identifier
- *
- * @param serviceIdentifier
- * @return
*/
ControllerService getControllerService(String serviceIdentifier);
/**
- * Returns true if the Controller Service with the given
+ * @param serviceIdentifier identifier of service to check
+ * @return true if the Controller Service with the given
* identifier is enabled, false otherwise. If the given
* identifier is not known by this ControllerServiceLookup, returns
* false
- *
- * @param serviceIdentifier
- * @return
*/
boolean isControllerServiceEnabled(String serviceIdentifier);
/**
- * Returns true if the Controller Service with the given
+ * @param serviceIdentifier idenfitier of service to check
+ * @return true if the Controller Service with the given
* identifier has been enabled but is still in the transitioning state,
- * otherwise returns false.
- * If the given identifier is not known by this ControllerServiceLookup,
- * returns false.
- *
- * @param serviceIdentifier
- * @return
+ * otherwise returns false. If the given identifier is not
+ * known by this ControllerServiceLookup, returns false
*/
boolean isControllerServiceEnabling(String serviceIdentifier);
-
+
/**
- * Returns true if the given Controller Service is enabled,
+ * @param service service to check
+ * @return true if the given Controller Service is enabled,
* false otherwise. If the given Controller Service is not
* known by this ControllerServiceLookup, returns false
- *
- * @param service
- * @return
*/
boolean isControllerServiceEnabled(ControllerService service);
/**
- * Returns the set of all Controller Service Identifiers whose Controller
- * Service is of the given type. The class specified MUST be an interface,
- * or an IllegalArgumentExcption will be thrown
- *
- * @param serviceType
- * @return
- *
+ * @param serviceType type of service to get identifiers for
+ * @return the set of all Controller Service Identifiers whose Controller
+ * Service is of the given type.
* @throws IllegalArgumentException if the given class is not an interface
*/
Set getControllerServiceIdentifiers(Class extends ControllerService> serviceType) throws IllegalArgumentException;
/**
- * Returns the name of the Controller service with the given identifier. If no service can be
- * found with this identifier, returns {@code null}.
- * @param serviceIdentifier
- * @return
+ * @param serviceIdentifier identifier to look up
+ * @return the name of the Controller service with the given identifier. If
+ * no service can be found with this identifier, returns {@code null}
*/
String getControllerServiceName(String serviceIdentifier);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/FlowFileQueue.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/FlowFileQueue.java
index 86742c77db..92a4ee0301 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/FlowFileQueue.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/FlowFileQueue.java
@@ -40,10 +40,8 @@ public interface FlowFileQueue {
List getPriorities();
/**
- * Returns the minimum number of FlowFiles that must be present in order for
+ * @return the minimum number of FlowFiles that must be present in order for
* FlowFiles to begin being swapped out of the queue
- *
- * @return
*/
int getSwapThreshold();
@@ -71,9 +69,7 @@ public interface FlowFileQueue {
long getBackPressureObjectThreshold();
/**
- * Establishes this queue's preferred maximum data size.
- *
- * @param maxDataSize
+ * @param maxDataSize Establishes this queue's preferred maximum data size.
*/
void setBackPressureDataSizeThreshold(String maxDataSize);
@@ -117,21 +113,21 @@ public interface FlowFileQueue {
/**
* places the given file into the queue
*
- * @param file
+ * @param file to place into queue
*/
void put(FlowFileRecord file);
/**
* places the given files into the queue
*
- * @param files
+ * @param files to place into queue
*/
void putAll(Collection files);
/**
* Removes all records from the internal swap queue and returns them.
*
- * @return
+ * @return all removed records from internal swap queue
*/
List pollSwappableRecords();
@@ -139,7 +135,7 @@ public interface FlowFileQueue {
* Restores the records from swap space into this queue, adding the records
* that have expired to the given set instead of enqueuing them.
*
- * @param records
+ * @param records that were swapped in
*/
void putSwappedRecords(Collection records);
@@ -147,15 +143,13 @@ public interface FlowFileQueue {
* Updates the internal counters of how much data is queued, based on
* swapped data that is being restored.
*
- * @param numRecords
- * @param contentSize
+ * @param numRecords count of records swapped in
+ * @param contentSize total size of records being swapped in
*/
void incrementSwapCount(int numRecords, long contentSize);
/**
- * Returns the number of FlowFiles that are enqueued and not swapped
- *
- * @return
+ * @return the number of FlowFiles that are enqueued and not swapped
*/
int unswappedSize();
@@ -164,14 +158,14 @@ public interface FlowFileQueue {
int getSwapQueueSize();
/**
- * @param expiredRecords
+ * @param expiredRecords expired records
* @return the next flow file on the queue; null if empty
*/
FlowFileRecord poll(Set expiredRecords);
/**
- * @param maxResults
- * @param expiredRecords
+ * @param maxResults limits how many results can be polled
+ * @param expiredRecords for expired records
* @return the next flow files on the queue up to the max results; null if
* empty
*/
@@ -181,10 +175,10 @@ public interface FlowFileQueue {
* Drains flow files from the given source queue into the given destination
* list.
*
- * @param sourceQueue
- * @param destination
+ * @param sourceQueue queue to drain from
+ * @param destination Collection to drain to
* @param maxResults max number to drain
- * @param expiredRecords
+ * @param expiredRecords for expired records
* @return size (bytes) of flow files drained from queue
*/
long drainQueue(Queue sourceQueue, List destination, int maxResults, Set expiredRecords);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Snippet.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Snippet.java
index 8ce106e8ec..93f332735b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Snippet.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Snippet.java
@@ -24,89 +24,65 @@ import java.util.Set;
public interface Snippet {
/**
- * The id of this snippet.
- *
- * @return
+ * @return id of this snippet
*/
public String getId();
/**
- * Whether or not this snippet is linked to the data flow. If the Snippet is
+ * @return Whether or not this snippet is linked to the data flow. If the Snippet is
* deleted and is linked, then the underlying components will also be
* deleted. If the Snippet is deleted and is NOT linked, only the Snippet is
* removed
- *
- * @return
*/
public boolean isLinked();
/**
- * The parent group id of the components in this snippet.
- *
- * @return
+ * @return parent group id of the components in this snippet
*/
public String getParentGroupId();
/**
- * The connections in this snippet.
- *
- * @return
+ * @return connections in this snippet
*/
public Set getConnections();
/**
- * The funnels in this snippet.
- *
- * @return
+ * @return funnels in this snippet
*/
public Set getFunnels();
/**
- * The input ports in this snippet.
- *
- * @return
+ * @return input ports in this snippet
*/
public Set getInputPorts();
/**
- * The output ports in this snippet.
- *
- * @return
+ * @return output ports in this snippet
*/
public Set getOutputPorts();
/**
- * The labels in this snippet.
- *
- * @return
+ * @return labels in this snippet
*/
public Set getLabels();
/**
- * Returns the identifiers of all ProcessGroups in this Snippet
- *
- * @return
+ * @return the identifiers of all ProcessGroups in this Snippet
*/
public Set getProcessGroups();
/**
- * Returns the identifiers of all Processors in this Snippet
- *
- * @return
+ * @return the identifiers of all Processors in this Snippet
*/
public Set getProcessors();
/**
- * Returns the identifiers of all RemoteProcessGroups in this Snippet
- *
- * @return
+ * @return the identifiers of all RemoteProcessGroups in this Snippet
*/
public Set getRemoteProcessGroups();
/**
- * Determines if this snippet is empty.
- *
- * @return
+ * @return Determines if this snippet is empty
*/
public boolean isEmpty();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Triggerable.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Triggerable.java
index 2eba911610..4b3149b213 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Triggerable.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/Triggerable.java
@@ -44,9 +44,9 @@ public interface Triggerable {
* be committed or the framework may use the session again for another
* processor down stream
*
- * @param context
- * @param sessionFactory used to generate {@link ProcessSession}s to use
- * for operating on flow files within the repository
+ * @param context in which the component is triggered
+ * @param sessionFactory used to generate {@link ProcessSession}s to use for
+ * operating on flow files within the repository
*
* @throws ProcessException if processing did not complete normally though
* indicates the problem is an understood potential outcome of processing.
@@ -81,7 +81,7 @@ public interface Triggerable {
* Triggerable has any active threads, see
* {@link ProcessScheduler#getActiveThreadCount(nifi.connectable.Connectable)}.
*
- * @return
+ * @return the schedule state
*/
ScheduledState getScheduledState();
@@ -92,12 +92,12 @@ public interface Triggerable {
* invocation of {@link #onTrigger(ProcessContext, ProcessSessionFactory)}
* have not yet returned
*
- * @return
+ * @return true if running;false otherwise
*/
boolean isRunning();
/**
- * @param timeUnit
+ * @param timeUnit for the scheduling period of the component
* @return the amount of time between each scheduling period
*/
long getSchedulingPeriod(TimeUnit timeUnit);
@@ -110,7 +110,8 @@ public interface Triggerable {
/**
* Updates how often this Triggerable should be triggered to run
- * @param schedulingPeriod
+ *
+ * @param schedulingPeriod to set
*/
void setScheduldingPeriod(String schedulingPeriod);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/annotation/OnConfigured.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/annotation/OnConfigured.java
index 78cc04b77e..2aa90cc700 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/annotation/OnConfigured.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/annotation/OnConfigured.java
@@ -31,8 +31,9 @@ import java.lang.annotation.Target;
* {@link nifi.controller.ConfigurationContext ConfigurationContext}.
*
* @author none
- *
- * @deprecated This annotation has been replaced by those in the {@link org.apache.nifi.annotation.lifecycle} package.
+ *
+ * @deprecated This annotation has been replaced by those in the
+ * {@link org.apache.nifi.annotation.lifecycle} package.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/ContentRepository.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/ContentRepository.java
index d66b8a6499..ee3ead9905 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/ContentRepository.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/ContentRepository.java
@@ -31,7 +31,6 @@ import org.apache.nifi.controller.repository.claim.ContentClaimManager;
* available on the methods but a merge capability is provided which between
* that and creating new claims a merge is available.
*
- * @author none
*/
public interface ContentRepository {
@@ -40,46 +39,38 @@ public interface ContentRepository {
* ContentClaimManager that is to be used for interacting with Content
* Claims
*
- * @param claimManager
- * @throws java.io.IOException
+ * @param claimManager to handle claims
+ * @throws java.io.IOException if unable to init
*/
void initialize(ContentClaimManager claimManager) throws IOException;
/**
- * Shuts down the Content Repository, freeing any resources that may be held.
- * This is called when an administrator shuts down NiFi.
+ * Shuts down the Content Repository, freeing any resources that may be
+ * held. This is called when an administrator shuts down NiFi.
*/
void shutdown();
-
+
/**
- * Returns the names of all Containers that exist for this Content
+ * @return the names of all Containers that exist for this Content
* Repository
- *
- * @return
*/
Set getContainerNames();
/**
- * Returns the maximum number of bytes that can be stored in the storage
+ * @param containerName name of container to check capacity on
+ * @return the maximum number of bytes that can be stored in the storage
* mechanism that backs the container with the given name
- *
- * @param containerName
- * @return
- * @throws java.io.IOException
- *
+ * @throws java.io.IOException if unable to check capacity
* @throws IllegalArgumentException if no container exists with the given
* name
*/
long getContainerCapacity(String containerName) throws IOException;
/**
- * Returns the number of bytes available to be used used by the storage
+ * @param containerName to check space on
+ * @return the number of bytes available to be used used by the storage
* mechanism that backs the container with the given name
- *
- * @param containerName
- * @return
- * @throws java.io.IOException
- *
+ * @throws java.io.IOException if unable to check space
* @throws IllegalArgumentException if no container exists with the given
* name
*/
@@ -92,14 +83,14 @@ public interface ContentRepository {
* loss tolerant. If true the repository might choose more volatile storage
* options which could increase performance for a tradeoff with reliability
* @return newly created claim
- * @throws java.io.IOException
+ * @throws java.io.IOException if unable to create claim
*/
ContentClaim create(boolean lossTolerant) throws IOException;
/**
* Increments the number of claimants for the given claim
*
- * @param claim
+ * @param claim to increment
* @return the number of claimants after incrementing
*/
int incrementClaimaintCount(ContentClaim claim);
@@ -107,7 +98,7 @@ public interface ContentRepository {
/**
* Obtains the current number of claimants for the given claim
*
- * @param claim
+ * @param claim to get count of
* @return the number of claimants
*/
int getClaimantCount(ContentClaim claim);
@@ -117,15 +108,15 @@ public interface ContentRepository {
* claim is null or content cannot be found or removed no exception will be
* thrown.
*
- * @param claim
- * @return
+ * @param claim to decrement
+ * @return new claimant count for the given claim
*/
int decrementClaimantCount(ContentClaim claim);
/**
* Removes the content indicated by the given claim
*
- * @param claim
+ * @param claim to remove
*
* @return a boolean indicating whether or not the destruction of the claim
* was successful
@@ -136,9 +127,9 @@ public interface ContentRepository {
* Clones the content for the given content claim and returns content claim
* of the new object
*
- * @param original
- * @param lossTolerant
- * @return
+ * @param original to clone
+ * @param lossTolerant if can be place in a loss tolerant repository
+ * @return new claim
* @throws IOException if an IO error occurs. Any content written to the new
* destination prior to the error will be destroyed
*/
@@ -156,7 +147,7 @@ public interface ContentRepository {
* @param footer if supplied will be appended to the output
* @param demarcator if supplied will be placed in between each merged
* object
- * @throws IOException
+ * @throws IOException if unable to merge
* @throws IllegalArgumentException if the given destination is included in
* the given claims
*/
@@ -167,9 +158,9 @@ public interface ContentRepository {
* claim within the repository.
*
* @return the size of the claim
- * @param content
+ * @param content to import from
* @param claim the claim to write imported content to
- * @throws IOException
+ * @throws IOException if failure to read given content
*/
long importFrom(Path content, ContentClaim claim) throws IOException;
@@ -179,11 +170,11 @@ public interface ContentRepository {
* argument
*
* @return the size of the claim
- * @param content
+ * @param content to import from
* @param claim the claim to write imported content to
* @param append if true, the content will be appended to the claim; if
* false, the content will replace the contents of the claim
- * @throws IOException
+ * @throws IOException if unable to read content
*/
long importFrom(Path content, ContentClaim claim, boolean append) throws IOException;
@@ -192,9 +183,9 @@ public interface ContentRepository {
* claim within the repository.
*
* @return the size of the claim
- * @param content
+ * @param content to import from
* @param claim the claim to write imported content to
- * @throws IOException
+ * @throws IOException if unable to read content
*/
long importFrom(InputStream content, ContentClaim claim) throws IOException;
@@ -202,11 +193,11 @@ public interface ContentRepository {
* Imports content from the given stream, appending or replacing the current
* claim, according to the value of the appen dargument
*
- * @param content
- * @param claim
- * @param append
- * @return
- * @throws IOException
+ * @param content to import from
+ * @param claim to write to
+ * @param append whether to append or replace
+ * @return length of data imported in bytes
+ * @throws IOException if failure to read or write stream
*/
long importFrom(InputStream content, ContentClaim claim, boolean append) throws IOException;
@@ -214,7 +205,7 @@ public interface ContentRepository {
* Exports the content of the given claim to the given destination.
*
* @return the size of the destination or the claim
- * @param claim
+ * @param claim to export from
* @param destination where to export data
* @param append if true appends to the destination; false overwrites
* @throws IOException if an IO error occurs. The state of the content for
@@ -227,7 +218,7 @@ public interface ContentRepository {
* Exports the content of the given claim to the given destination.
*
* @return the size of the destination or the claim
- * @param claim
+ * @param claim to export from
* @param destination where to export data
* @param append if true appends to the destination; false overwrites
* @param offset the offset at which the claim should start being copied
@@ -242,7 +233,7 @@ public interface ContentRepository {
* Exports the content of the given claim to the given destination.
*
* @return the size of the claim
- * @param claim
+ * @param claim to export from
* @param destination where to export data
* @throws IOException if an IO error occurs.
*/
@@ -253,7 +244,7 @@ public interface ContentRepository {
* and copying length bytes, to the given destination.
*
* @return the number of bytes copied
- * @param claim
+ * @param claim to export from
* @param destination where to export data
* @param offset the offset into the claim at which the copy should begin
* @param length the number of bytes to copy
@@ -262,27 +253,27 @@ public interface ContentRepository {
long exportTo(ContentClaim claim, OutputStream destination, long offset, long length) throws IOException;
/**
- * @param claim
+ * @param claim to get size of
* @return size in bytes of content for given claim
- * @throws IOException
+ * @throws IOException if size check failed
*/
long size(ContentClaim claim) throws IOException;
/**
* Provides access to the input stream for the given claim
*
- * @param claim
+ * @param claim to read from
* @return InputStream over the content of the given claim
- * @throws IOException
+ * @throws IOException if unable to read
*/
InputStream read(ContentClaim claim) throws IOException;
/**
* Obtains an OutputStream to the content for the given claim.
*
- * @param claim
- * @return
- * @throws IOException
+ * @param claim to write to
+ * @return the stream to write to
+ * @throws IOException if unable to obtain stream
*/
OutputStream write(ContentClaim claim) throws IOException;
@@ -300,15 +291,13 @@ public interface ContentRepository {
void cleanup();
/**
- * Returns a boolean indicating whether or not the content specified by the
- * given claim can be read, regardless of whether the content has been
- * archived or not. If the ContentRepository does not implement archiving
- * capabilities, this method will return false.
- *
* @param contentClaim the Content Claim to check
- * @return
+ * @return Returns a boolean indicating whether or not the content specified
+ * by the given claim can be read, regardless of whether the content has
+ * been archived or not. If the ContentRepository does not implement
+ * archiving capabilities, this method will return false
*
- * @throws IOException
+ * @throws IOException if unable to determine accessibility
*/
boolean isAccessible(ContentClaim contentClaim) throws IOException;
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRecord.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRecord.java
index 13548a2c03..f2493f616e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRecord.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRecord.java
@@ -27,28 +27,22 @@ import org.apache.nifi.flowfile.FlowFile;
public interface FlowFileRecord extends FlowFile {
/**
- * Returns the time (in millis since epoch) at which this FlowFile should no
- * longer be penalized.
- *
- * @return
+ * @return the time (in millis since epoch) at which this FlowFile should no
+ * longer be penalized
*/
long getPenaltyExpirationMillis();
/**
- * Returns the {@link ContentClaim} that holds the FlowFile's content
- *
- * @return
+ * @return the {@link ContentClaim} that holds the FlowFile's content
*/
ContentClaim getContentClaim();
/**
- * Returns the byte offset into the {@link ContentClaim} at which the
+ * @return the byte offset into the {@link ContentClaim} at which the
* FlowFile's content occurs. This mechanism allows multiple FlowFiles to
* have the same ContentClaim, which can be significantly more efficient for
* some implementations of
* {@link nifi.controller.repository.ContentRepository ContentRepository}
- *
- * @return
*/
long getContentClaimOffset();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRepository.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRepository.java
index 999a087d8a..5e59e04890 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRepository.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileRepository.java
@@ -27,7 +27,6 @@ import org.apache.nifi.controller.repository.claim.ContentClaimManager;
/**
* Implementations must be thread safe
*
- * @author none
*/
public interface FlowFileRepository extends Closeable {
@@ -36,28 +35,24 @@ public interface FlowFileRepository extends Closeable {
* ContentClaimManager that is to be used for interacting with Content
* Claims
*
- * @param claimManager
- * @throws java.io.IOException
+ * @param claimManager for handling claims
+ * @throws java.io.IOException if unable to initialize repository
*/
void initialize(ContentClaimManager claimManager) throws IOException;
/**
- * Returns the maximum number of bytes that can be stored in the underlying
+ * @return the maximum number of bytes that can be stored in the underlying
* storage mechanism
*
- * @return
- *
- * @throws IOException
+ * @throws IOException if computing capacity fails
*/
long getStorageCapacity() throws IOException;
/**
- * Returns the number of bytes currently available for use by the underlying
+ * @return the number of bytes currently available for use by the underlying
* storage mechanism
*
- * @return
- *
- * @throws IOException
+ * @throws IOException if computing usable space fails
*/
long getUsableStorageSpace() throws IOException;
@@ -65,7 +60,7 @@ public interface FlowFileRepository extends Closeable {
* Updates the repository with the given RepositoryRecords.
*
* @param records the records to update the repository with
- * @throws java.io.IOException
+ * @throws java.io.IOException if update fails
*/
void updateRepository(Collection records) throws IOException;
@@ -79,7 +74,7 @@ public interface FlowFileRepository extends Closeable {
* returned by a call to {@link #getNextFlowFileSequence()}
*
* @return index of highest flow file identifier
- * @throws IOException
+ * @throws IOException if load fails
*/
long loadFlowFiles(QueueProvider queueProvider, long minimumSequenceNumber) throws IOException;
@@ -97,7 +92,7 @@ public interface FlowFileRepository extends Closeable {
/**
* @return the max ID of all FlowFiles that currently exist in
* the repository.
- * @throws IOException
+ * @throws IOException if computing max identifier fails
*/
long getMaxFlowFileIdentifier() throws IOException;
@@ -109,7 +104,7 @@ public interface FlowFileRepository extends Closeable {
* @param flowFileQueue the queue that the FlowFiles belong to
* @param swapLocation the location to which the FlowFiles were swapped
*
- * @throws IOException
+ * @throws IOException if swap fails
*/
void swapFlowFilesOut(List swappedOut, FlowFileQueue flowFileQueue, String swapLocation) throws IOException;
@@ -122,7 +117,7 @@ public interface FlowFileRepository extends Closeable {
* @param flowFileRecords the records that were swapped in
* @param flowFileQueue the queue that the FlowFiles belong to
*
- * @throws IOException
+ * @throws IOException if swap fails
*/
void swapFlowFilesIn(String swapLocation, List flowFileRecords, FlowFileQueue flowFileQueue) throws IOException;
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
index c6daab8303..869e2b355b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
@@ -55,9 +55,9 @@ public interface FlowFileSwapManager {
* Notifies FlowFile queues of the number of FlowFiles and content size of
* all FlowFiles that are currently swapped out
*
- * @param connectionProvider
- * @param claimManager
- * @return
+ * @param connectionProvider provider
+ * @param claimManager manager
+ * @return how many flowfiles have been recovered
*/
long recoverSwappedFlowFiles(QueueProvider connectionProvider, ContentClaimManager claimManager);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/QueueProvider.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/QueueProvider.java
index 42cf319afd..fcb516d5ea 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/QueueProvider.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/QueueProvider.java
@@ -27,9 +27,7 @@ import org.apache.nifi.controller.FlowFileQueue;
public interface QueueProvider {
/**
- * Returns all FlowFileQueues that currently exist in the flow
- *
- * @return
+ * @return all FlowFileQueues that currently exist in the flow
*/
Collection getAllQueues();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/RepositoryRecord.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/RepositoryRecord.java
index d4b9c86ba3..40d44a84c6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/RepositoryRecord.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/RepositoryRecord.java
@@ -26,60 +26,44 @@ import org.apache.nifi.controller.repository.claim.ContentClaim;
public interface RepositoryRecord {
/**
- * The FlowFileQueue to which the FlowFile is to be transferred
- *
- * @return
+ * @return FlowFileQueue to which the FlowFile is to be transferred
*/
FlowFileQueue getDestination();
/**
- * The FlowFileQueue from which the record was pulled
- *
- * @return
+ * @return FlowFileQueue from which the record was pulled
*/
FlowFileQueue getOriginalQueue();
/**
- * The type of update that this record encapsulates
- *
- * @return
+ * @return type of update that this record encapsulates
*/
RepositoryRecordType getType();
/**
- * The current ContentClaim for the FlowFile
- *
- * @return
+ * @return current ContentClaim for the FlowFile
*/
ContentClaim getCurrentClaim();
/**
- * The original ContentClaim for the FlowFile before any changes were made
- *
- * @return
+ * @return original ContentClaim for the FlowFile before any changes were made
*/
ContentClaim getOriginalClaim();
/**
- * The byte offset into the Content Claim where this FlowFile's content
+ * @return byte offset into the Content Claim where this FlowFile's content
* begins
- *
- * @return
*/
long getCurrentClaimOffset();
/**
- * The FlowFile being encapsulated by this record
- *
- * @return
+ * @return FlowFile being encapsulated by this record
*/
FlowFileRecord getCurrent();
/**
- * Whether or not the FlowFile's attributes have changed since the FlowFile
+ * @return Whether or not the FlowFile's attributes have changed since the FlowFile
* was pulled from its queue (or created)
- *
- * @return
*/
boolean isAttributesChanged();
@@ -90,11 +74,9 @@ public interface RepositoryRecord {
boolean isMarkedForAbort();
/**
- * If the FlowFile is swapped out of the Java heap space, provides the
+ * @return If the FlowFile is swapped out of the Java heap space, provides the
* location of the swap file, or null if the FlowFile is not
* swapped out
- *
- * @return
*/
String getSwapLocation();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaim.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaim.java
index e321217fd3..11a1620ac8 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaim.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaim.java
@@ -45,11 +45,9 @@ public interface ContentClaim extends Comparable {
String getSection();
/**
- * Specifies whether or not the Claim is loss-tolerant. If so, we will
+ * @return Indicates whether or not the Claim is loss-tolerant. If so, we will
* attempt to keep the content but will not sacrifice a great deal of
- * performance to do so.
- *
- * @return
+ * performance to do so
*/
boolean isLossTolerant();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaimManager.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaimManager.java
index 6a5b38b4b5..bffcec321b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaimManager.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/repository/claim/ContentClaimManager.java
@@ -28,20 +28,18 @@ public interface ContentClaimManager {
* Creates a new Content Claim with the given id, container, section, and
* loss tolerance.
*
- * @param id
- * @param container
- * @param section
- * @param lossTolerant
- * @return
+ * @param id of claim
+ * @param container of claim
+ * @param section of claim
+ * @param lossTolerant of claim
+ * @return new claim
*/
ContentClaim newContentClaim(String container, String section, String id, boolean lossTolerant);
/**
- * Returns the number of FlowFiles that hold a claim to a particular piece
+ * @param claim to obtain reference count for
+ * @return the number of FlowFiles that hold a claim to a particular piece
* of FlowFile content
- *
- * @param claim
- * @return
*/
int getClaimantCount(ContentClaim claim);
@@ -49,8 +47,8 @@ public interface ContentClaimManager {
* Decreases by 1 the count of how many FlowFiles hold a claim to a
* particular piece of FlowFile content and returns the new count
*
- * @param claim
- * @return
+ * @param claim to decrement claimants on
+ * @return new claimaint count
*/
int decrementClaimantCount(ContentClaim claim);
@@ -58,8 +56,8 @@ public interface ContentClaimManager {
* Increases by 1 the count of how many FlowFiles hold a claim to a
* particular piece of FlowFile content and returns the new count
*
- * @param claim
- * @return
+ * @param claim to increment claims on
+ * @return new claimant count
*/
int incrementClaimantCount(ContentClaim claim);
@@ -73,9 +71,10 @@ public interface ContentClaimManager {
* optimize its tasks, knowing that the Content Claim cannot be referenced
* by any other component
*
- * @param claim
- * @param newClaim
- * @return
+ * @param claim to increment
+ * @param newClaim provides a hint that no other process can have access to this
+ * claim right now
+ * @return new claim count
*/
int incrementClaimantCount(ContentClaim claim, boolean newClaim);
@@ -105,7 +104,7 @@ public interface ContentClaimManager {
* unneeded claim. As such, it is now safe to destroy the contents.
*
*
- * @param claim
+ * @param claim to mark as now destructable
*/
void markDestructable(ContentClaim claim);
@@ -114,8 +113,8 @@ public interface ContentClaimManager {
* of destructable content claims to the given {@code destination} so that
* they can be destroyed.
*
- * @param destination
- * @param maxElements
+ * @param destination to drain to
+ * @param maxElements max items to drain
*/
void drainDestructableClaims(Collection destination, int maxElements);
@@ -128,10 +127,10 @@ public interface ContentClaimManager {
* ready to be destroyed, the method will return without having added
* anything to the given {@code destination}.
*
- * @param destination
- * @param maxElements
- * @param timeout
- * @param unit
+ * @param destination to drain to
+ * @param maxElements max items to drain
+ * @param timeout maximum time to wait
+ * @param unit unit of time to wait
*/
void drainDestructableClaims(Collection destination, int maxElements, long timeout, TimeUnit unit);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
index dba3a19b17..45acf8e206 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
@@ -43,6 +43,8 @@ public class ProcessGroupStatus implements Cloneable {
private long bytesReceived;
private int flowFilesSent;
private long bytesSent;
+ private int flowFilesTransferred;
+ private long bytesTransferred;
private Collection connectionStatus = new ArrayList<>();
private Collection processorStatus = new ArrayList<>();
@@ -227,6 +229,22 @@ public class ProcessGroupStatus implements Cloneable {
this.bytesSent = bytesSent;
}
+ public int getFlowFilesTransferred() {
+ return flowFilesTransferred;
+ }
+
+ public void setFlowFilesTransferred(int flowFilesTransferred) {
+ this.flowFilesTransferred = flowFilesTransferred;
+ }
+
+ public long getBytesTransferred() {
+ return bytesTransferred;
+ }
+
+ public void setBytesTransferred(long bytesTransferred) {
+ this.bytesTransferred = bytesTransferred;
+ }
+
@Override
public ProcessGroupStatus clone() {
@@ -248,6 +266,8 @@ public class ProcessGroupStatus implements Cloneable {
clonedObj.bytesReceived = bytesReceived;
clonedObj.flowFilesSent = flowFilesSent;
clonedObj.bytesSent = bytesSent;
+ clonedObj.flowFilesTransferred = flowFilesTransferred;
+ clonedObj.bytesTransferred = bytesTransferred;
if (connectionStatus != null) {
final Collection statusList = new ArrayList<>();
@@ -317,6 +337,18 @@ public class ProcessGroupStatus implements Cloneable {
builder.append(creationTimestamp);
builder.append(", activeThreadCount=");
builder.append(activeThreadCount);
+ builder.append(", flowFilesTransferred=");
+ builder.append(flowFilesTransferred);
+ builder.append(", bytesTransferred=");
+ builder.append(bytesTransferred);
+ builder.append(", flowFilesReceived=");
+ builder.append(flowFilesReceived);
+ builder.append(", bytesReceived=");
+ builder.append(bytesReceived);
+ builder.append(", flowFilesSent=");
+ builder.append(flowFilesSent);
+ builder.append(", bytesSent=");
+ builder.append(bytesSent);
builder.append(",\n\tconnectionStatus=");
for (final ConnectionStatus status : connectionStatus) {
@@ -374,6 +406,12 @@ public class ProcessGroupStatus implements Cloneable {
target.setBytesRead(target.getBytesRead() + toMerge.getBytesRead());
target.setBytesWritten(target.getBytesWritten() + toMerge.getBytesWritten());
target.setActiveThreadCount(target.getActiveThreadCount() + toMerge.getActiveThreadCount());
+ target.setFlowFilesTransferred(target.getFlowFilesTransferred() + toMerge.getFlowFilesTransferred());
+ target.setBytesTransferred(target.getBytesTransferred() + toMerge.getBytesTransferred());
+ target.setFlowFilesReceived(target.getFlowFilesReceived() + toMerge.getFlowFilesReceived());
+ target.setBytesReceived(target.getBytesReceived() + toMerge.getBytesReceived());
+ target.setFlowFilesSent(target.getFlowFilesSent() + toMerge.getFlowFilesSent());
+ target.setBytesSent(target.getBytesSent() + toMerge.getBytesSent());
// connection status
// sort by id
@@ -425,7 +463,7 @@ public class ProcessGroupStatus implements Cloneable {
// processor run status is disabled/stopped/running is part of the flow configuration
// and should not differ amongst nodes. however, whether a processor is invalid
// can be driven by environmental conditions. this check allows any of those to
- // take precedence over the configured run status.
+ // take precedence over the configured run status.
if (RunStatus.Invalid.equals(statusToMerge.getRunStatus())) {
merged.setRunStatus(RunStatus.Invalid);
}
@@ -454,7 +492,7 @@ public class ProcessGroupStatus implements Cloneable {
merged.setTransmitting(true);
}
- // should be unnecessary here since ports run status should not be affected by
+ // should be unnecessary here since ports run status should not be affected by
// environmental conditions but doing so in case that changes
if (RunStatus.Invalid.equals(statusToMerge.getRunStatus())) {
merged.setRunStatus(RunStatus.Invalid);
@@ -484,7 +522,7 @@ public class ProcessGroupStatus implements Cloneable {
merged.setTransmitting(true);
}
- // should be unnecessary here since ports run status not should be affected by
+ // should be unnecessary here since ports run status not should be affected by
// environmental conditions but doing so in case that changes
if (RunStatus.Invalid.equals(statusToMerge.getRunStatus())) {
merged.setRunStatus(RunStatus.Invalid);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/ComponentStatusRepository.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/ComponentStatusRepository.java
index 6fe13fc870..4628a288f7 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/ComponentStatusRepository.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/ComponentStatusRepository.java
@@ -33,7 +33,7 @@ public interface ComponentStatusRepository {
/**
* Captures the status information provided in the given report
*
- * @param rootGroupStatus
+ * @param rootGroupStatus status of root group
*/
void capture(ProcessGroupStatus rootGroupStatus);
@@ -42,22 +42,17 @@ public interface ComponentStatusRepository {
* timestamp that indicates the time at which the status report was
* generated. This can be used to replay historical values.
*
- * @param rootGroupStatus
- * @param timestamp
+ * @param rootGroupStatus status
+ * @param timestamp timestamp of capture
*/
void capture(ProcessGroupStatus rootGroupStatus, Date timestamp);
/**
- * Returns the Date at which the latest capture was performed
- *
- * @return
+ * @return the Date at which the latest capture was performed
*/
Date getLastCaptureDate();
/**
- * Returns a {@link StatusHistory} that provides the status information
- * about the Connection with the given ID during the given time period.
- *
* @param connectionId the ID of the Connection for which the Status is
* desired
* @param start the earliest date for which status information should be
@@ -70,15 +65,13 @@ public interface ComponentStatusRepository {
* If the date range is large, the total number of data points could be far
* too many to process. Therefore, this parameter allows the requestor to
* indicate how many samples to return.
- * @return
+ * @return a {@link StatusHistory} that provides the status information
+ * about the Connection with the given ID during the given time period
*/
StatusHistory getConnectionStatusHistory(String connectionId, Date start, Date end, int preferredDataPoints);
/**
- * Returns a {@link StatusHistory} that provides the status information
- * about the Process Group with the given ID during the given time period.
- *
- * @param processGroupId
+ * @param processGroupId of group to get status of
* @param start the earliest date for which status information should be
* returned; if null, the start date should be assumed to be
* the beginning of time
@@ -89,15 +82,13 @@ public interface ComponentStatusRepository {
* If the date range is large, the total number of data points could be far
* too many to process. Therefore, this parameter allows the requestor to
* indicate how many samples to return.
- * @return
+ * @return a {@link StatusHistory} that provides the status information
+ * about the Process Group with the given ID during the given time period
*/
StatusHistory getProcessGroupStatusHistory(String processGroupId, Date start, Date end, int preferredDataPoints);
/**
- * Returns a {@link StatusHistory} that provides the status information
- * about the Processor with the given ID during the given time period.
- *
- * @param processorId
+ * @param processorId to get status of
* @param start the earliest date for which status information should be
* returned; if null, the start date should be assumed to be
* the beginning of time
@@ -108,16 +99,13 @@ public interface ComponentStatusRepository {
* If the date range is large, the total number of data points could be far
* too many to process. Therefore, this parameter allows the requestor to
* indicate how many samples to return.
- * @return
+ * @return a {@link StatusHistory} that provides the status information
+ * about the Processor with the given ID during the given time period
*/
StatusHistory getProcessorStatusHistory(String processorId, Date start, Date end, int preferredDataPoints);
/**
- * Returns a {@link StatusHistory} that provides the status information
- * about the Remote Process Group with the given ID during the given time
- * period.
- *
- * @param remoteGroupId
+ * @param remoteGroupId to get history of
* @param start the earliest date for which status information should be
* returned; if null, the start date should be assumed to be
* the beginning of time
@@ -128,39 +116,33 @@ public interface ComponentStatusRepository {
* If the date range is large, the total number of data points could be far
* too many to process. Therefore, this parameter allows the requestor to
* indicate how many samples to return.
- * @return
+ * @return a {@link StatusHistory} that provides the status information
+ * about the Remote Process Group with the given ID during the given time
+ * period
*/
StatusHistory getRemoteProcessGroupStatusHistory(String remoteGroupId, Date start, Date end, int preferredDataPoints);
/**
- * Returns a List of all {@link MetricDescriptor}s that are applicable to
+ * @return a List of all {@link MetricDescriptor}s that are applicable to
* Process Groups
- *
- * @return
*/
List> getProcessGroupMetricDescriptors();
/**
- * Returns a List of all {@link MetricDescriptor}s that are applicable to
+ * @return a List of all {@link MetricDescriptor}s that are applicable to
* Processors
- *
- * @return
*/
List> getProcessorMetricDescriptors();
/**
- * Returns a List of all {@link MetricDescriptor}s that are applicable to
+ * @return a List of all {@link MetricDescriptor}s that are applicable to
* Remote Process Groups
- *
- * @return
*/
List> getRemoteProcessGroupMetricDescriptors();
/**
- * Returns a List of all {@link MetricDescriptor}s that are applicable to
+ * @return a List of all {@link MetricDescriptor}s that are applicable to
* Connections
- *
- * @return
*/
List> getConnectionMetricDescriptors();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java
index 3986c86bfb..8fdce05cad 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/MetricDescriptor.java
@@ -18,7 +18,8 @@ package org.apache.nifi.controller.status.history;
/**
* Describes a particular metric that is derived from a Status History
- * @param
+ *
+ * @param type of metric
*/
public interface MetricDescriptor {
@@ -32,44 +33,34 @@ public interface MetricDescriptor {
/**
* Specifies how the values should be formatted
*
- * @return
+ * @return formatter for values
*/
Formatter getFormatter();
/**
- * Returns a human-readable description of the field
- *
- * @return
+ * @return a human-readable description of the field
*/
String getDescription();
/**
- * Returns a human-readable label for the field
- *
- * @return
+ * @return a human-readable label for the field
*/
String getLabel();
/**
- * Returns the name of a field
- *
- * @return
+ * @return the name of a field
*/
String getField();
/**
- * Returns a {@link ValueMapper} that can be used to extract a value for the
+ * @return a {@link ValueMapper} that can be used to extract a value for the
* status history
- *
- * @return
*/
ValueMapper getValueFunction();
/**
- * Returns a {@link ValueReducer} that can reduce multiple StatusSnapshots
+ * @return a {@link ValueReducer} that can reduce multiple StatusSnapshots
* into a single Long value
- *
- * @return
*/
ValueReducer getValueReducer();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusHistory.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusHistory.java
index b053d33d77..f1bb946837 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusHistory.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusHistory.java
@@ -26,25 +26,19 @@ import java.util.Map;
public interface StatusHistory {
/**
- * Returns a Date indicating when this report was generated
- *
- * @return
+ * @return a Date indicating when this report was generated
*/
Date getDateGenerated();
/**
- * Returns a Map of component field names and their values. The order in
+ * @return a Map of component field names and their values. The order in
* which these values are displayed is dependent on the natural ordering of
- * the Map returned.
- *
- * @return
+ * the Map returned
*/
Map getComponentDetails();
/**
- * A List of snapshots for a given component
- *
- * @return
+ * @return List of snapshots for a given component
*/
List getStatusSnapshots();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusSnapshot.java b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusSnapshot.java
index d52c1cc081..551ceb2552 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusSnapshot.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/controller/status/history/StatusSnapshot.java
@@ -25,24 +25,18 @@ import java.util.Map;
public interface StatusSnapshot {
/**
- * Rreturns the point in time for which the status values were obtained
- *
- * @return
+ * @return the point in time for which the status values were obtained
*/
Date getTimestamp();
/**
- * Returns a Map of MetricDescriptor to value
- *
- * @return
+ * @return a Map of MetricDescriptor to value
*/
Map, Long> getStatusMetrics();
/**
- * Returns a {@link ValueReducer} that is capable of merging multiple
+ * @return a {@link ValueReducer} that is capable of merging multiple
* StatusSnapshot objects into a single one
- *
- * @return
*/
ValueReducer getValueReducer();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeExpression.java b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeExpression.java
index b71c83dacd..ed409ea2ad 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeExpression.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeExpression.java
@@ -22,12 +22,10 @@ import org.apache.nifi.processor.exception.ProcessException;
public interface AttributeExpression {
/**
- * Evaluates the expression without providing any FlowFile Attributes. This
+ * @return Evaluates the expression without providing any FlowFile Attributes. This
* will evaluate the expression based only on System Properties and JVM
* Environment properties
- *
- * @return
- * @throws ProcessException
+ * @throws ProcessException if unable to evaluate
*/
String evaluate() throws ProcessException;
@@ -36,9 +34,9 @@ public interface AttributeExpression {
* will evaluate the expression based only on System Properties and JVM
* Environment properties but allows the values to be decorated
*
- * @param decorator
- * @return
- * @throws ProcessException
+ * @param decorator for attribute value
+ * @return evaluated value
+ * @throws ProcessException if failure in evaluation
*/
String evaluate(AttributeValueDecorator decorator) throws ProcessException;
@@ -47,9 +45,9 @@ public interface AttributeExpression {
* id, etc. of the given FlowFile, as well as System Properties and JVM
* Environment properties
*
- * @param flowFile
- * @return
- * @throws ProcessException
+ * @param flowFile to evaluate
+ * @return evaluated value
+ * @throws ProcessException if failure evaluating
*/
String evaluate(FlowFile flowFile) throws ProcessException;
@@ -58,17 +56,15 @@ public interface AttributeExpression {
* id, etc. of the given FlowFile, as well as System Properties and JVM
* Environment properties and allows the values to be decorated
*
- * @param flowFile
- * @param decorator
- * @return
- * @throws ProcessException
+ * @param flowFile to evaluate
+ * @param decorator for evaluation
+ * @return evaluated value
+ * @throws ProcessException if failed to evaluate
*/
String evaluate(FlowFile flowFile, AttributeValueDecorator decorator) throws ProcessException;
/**
- * Returns the type that is returned by the Expression
- *
- * @return
+ * @return the type that is returned by the Expression
*/
ResultType getResultType();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeValueDecorator.java b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeValueDecorator.java
index af071f3cee..4cea248961 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeValueDecorator.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/AttributeValueDecorator.java
@@ -22,8 +22,8 @@ public interface AttributeValueDecorator {
* Decorates the value of a FlowFile Attribute or System/JVM property in
* some way
*
- * @param attributeValue
- * @return
+ * @param attributeValue to decorate
+ * @return decorated value
*/
String decorate(String attributeValue);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/ExpressionLanguageCompiler.java b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/ExpressionLanguageCompiler.java
index aced2e6a23..9383d2722e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/expression/ExpressionLanguageCompiler.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/expression/ExpressionLanguageCompiler.java
@@ -25,7 +25,7 @@ public interface ExpressionLanguageCompiler {
* AttributeExpression that can be evaluated
*
* @param expression the Attribute Expression to be compiled
- * @return
+ * @return expression that can be evaluated
* @throws IllegalArgumentException if the given expression is not valid
*/
AttributeExpression compile(String expression) throws IllegalArgumentException;
@@ -34,8 +34,8 @@ public interface ExpressionLanguageCompiler {
* Indicates whether or not the given string is a valid Attribute
* Expression.
*
- * @param expression
- * @return
+ * @param expression to validate
+ * @return if is value or not
*/
boolean isValidExpression(String expression);
@@ -44,7 +44,7 @@ public interface ExpressionLanguageCompiler {
* if the expression is syntactically valid or a String indicating why the
* expression is invalid otherwise.
*
- * @param expression
+ * @param expression to validate
* @param allowSurroundingCharacters if true allows characters
* to surround the Expression, otherwise the expression must be exactly
* equal to a valid Expression. E.g., /${path} is valid if and
@@ -60,7 +60,7 @@ public interface ExpressionLanguageCompiler {
* Returns the ResultType that will be returned by the given Expression
*
* @param expression the Expression to evaluate
- * @return
+ * @return result type for the given expression
* @throws IllegalArgumentException if the given Expression is not a valid
* Expression Language Expression; the message of this Exception will
* indicate the problem if the expression is not syntactically valid.
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/flowfile/FlowFile.java b/nifi/nifi-api/src/main/java/org/apache/nifi/flowfile/FlowFile.java
index bce92ee9a1..0e2c19d6ea 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/flowfile/FlowFile.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/flowfile/FlowFile.java
@@ -48,24 +48,22 @@ public interface FlowFile extends Comparable {
long getLineageStartDate();
/**
- * Returns the time at which the FlowFile was most recently added to a
+ * @return the time at which the FlowFile was most recently added to a
* FlowFile queue, or {@code null} if the FlowFile has never been enqueued.
* This value will always be populated before it is passed to a
- * {@link FlowFilePrioritizer}.
- *
- * @return
+ * {@link FlowFilePrioritizer}
*/
Long getLastQueueDate();
/**
- * @return a set of identifiers that are unique to this FlowFile's lineage.
- * If FlowFile X is derived from FlowFile Y, both FlowFiles will have the
- * same value for the Lineage Claim ID.
- *
*
* If a FlowFile is derived from multiple "parent" FlowFiles, all of the
* parents' Lineage Identifiers will be in the set.
*
+ *
+ * @return a set of identifiers that are unique to this FlowFile's lineage.
+ * If FlowFile X is derived from FlowFile Y, both FlowFiles will have the
+ * same value for the Lineage Claim ID.
*/
Set getLineageIdentifiers();
@@ -77,7 +75,7 @@ public interface FlowFile extends Comparable {
/**
* Obtains the attribute value for the given key
*
- * @param key
+ * @param key of the attribute
* @return value if found; null otherwise
*/
String getAttribute(String key);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ComponentLog.java b/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ComponentLog.java
index c070e23698..b4b3c6a565 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ComponentLog.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ComponentLog.java
@@ -16,36 +16,40 @@
*/
package org.apache.nifi.logging;
-
/**
*
- * The ComponentLog provides a mechanism to ensure that all NiFi components are logging and reporting
- * information in a consistent way. When messages are logged to the ComponentLog, each message has the
- * following characteristics:
+ * The ComponentLog provides a mechanism to ensure that all NiFi components are
+ * logging and reporting information in a consistent way. When messages are
+ * logged to the ComponentLog, each message has the following characteristics:
*
- *
+ *
*
- *
- * The toString() of the component is automatically prepended to the message so that it is clear
- * which component is providing the information. This is important, since a single component may have many
- * different instances within the same NiFi instance.
- *
- *
- * If the last value in an Object[] argument that is passed to the logger is a Throwable, then the logged message
- * will include a toString() of the Throwable; in addition, if the component's logger is set to
- * DEBUG level via the logback configuration, the Stacktrace will also be logged. This provides a mechanism to easily
- * enable stacktraces in the logs when they are desired without filling the logs with unneeded stack traces for messages
- * that end up occurring often.
- *
- *
- * Any message that is logged with a Severity level that meets or exceeds the configured Bulletin Level for that component
- * will also cause a Bulletin to be generated, so that the message is visible in the UI, allowing Dataflow Managers
- * to understand that a problem exists and what the issue is.
- *
+ *
+ * The toString() of the component is automatically prepended to
+ * the message so that it is clear which component is providing the information.
+ * This is important, since a single component may have many different instances
+ * within the same NiFi instance.
+ *
+ *
+ * If the last value in an Object[] argument that is passed to the logger is a
+ * Throwable, then the logged message will include a toString() of
+ * the Throwable; in addition, if the component's logger is set to DEBUG level
+ * via the logback configuration, the Stacktrace will also be logged. This
+ * provides a mechanism to easily enable stacktraces in the logs when they are
+ * desired without filling the logs with unneeded stack traces for messages that
+ * end up occurring often.
+ *
+ *
+ * Any message that is logged with a Severity level that meets or exceeds the
+ * configured Bulletin Level for that component will also cause a Bulletin to be
+ * generated, so that the message is visible in the UI, allowing Dataflow
+ * Managers to understand that a problem exists and what the issue is.
+ *
*
- *
+ *
*/
public interface ComponentLog {
+
void warn(String msg, Throwable t);
void warn(String msg, Object[] os);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ProcessorLog.java b/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ProcessorLog.java
index 0d66d8553b..a90ee26cc9 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ProcessorLog.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/logging/ProcessorLog.java
@@ -16,14 +16,14 @@
*/
package org.apache.nifi.logging;
-
/**
- * The ProcessorLog is an extension of ComponentLog but provides no additional functionality.
- * It exists because ProcessorLog was created first,
- * but when Controller Services and Reporting Tasks began to be used more heavily loggers
- * were needed for them as well. We did not want to return a ProcessorLog to a ControllerService
- * or a ReportingTask, so all of the methods were moved to a higher interface named ComponentLog.
- * However, we kept the ProcessorLog interface around in order to maintain backward compatibility.
+ * The ProcessorLog is an extension of ComponentLog but provides no additional
+ * functionality. It exists because ProcessorLog was created first, but when
+ * Controller Services and Reporting Tasks began to be used more heavily loggers
+ * were needed for them as well. We did not want to return a ProcessorLog to a
+ * ControllerService or a ReportingTask, so all of the methods were moved to a
+ * higher interface named ComponentLog. However, we kept the ProcessorLog
+ * interface around in order to maintain backward compatibility.
*/
public interface ProcessorLog extends ComponentLog {
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/AbstractSessionFactoryProcessor.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/AbstractSessionFactoryProcessor.java
index f13a14304d..2695dcddfa 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/AbstractSessionFactoryProcessor.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/AbstractSessionFactoryProcessor.java
@@ -41,7 +41,6 @@ import org.apache.nifi.logging.ProcessorLog;
*
* Thread safe
*
- * @author none
*/
public abstract class AbstractSessionFactoryProcessor extends AbstractConfigurableComponent implements Processor {
@@ -62,10 +61,8 @@ public abstract class AbstractSessionFactoryProcessor extends AbstractConfigurab
}
/**
- * Returns the {@link ControllerServiceLookup} that was passed to the
+ * @return the {@link ControllerServiceLookup} that was passed to the
* {@link #init(ProcessorInitializationContext)} method
- *
- * @return
*/
protected final ControllerServiceLookup getControllerServiceLookup() {
return serviceLookup;
@@ -83,17 +80,15 @@ public abstract class AbstractSessionFactoryProcessor extends AbstractConfigurab
/**
* Provides subclasses the ability to perform initialization logic
*
- * @param context
+ * @param context in which to perform initialization
*/
protected void init(final ProcessorInitializationContext context) {
// Provided for subclasses to override
}
/**
- * Returns true if the processor is scheduled to run,
+ * @return true if the processor is scheduled to run,
* false otherwise
- *
- * @return
*/
protected final boolean isScheduled() {
return scheduled;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/DataUnit.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/DataUnit.java
index dc0a66f631..4980b97d55 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/DataUnit.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/DataUnit.java
@@ -21,9 +21,6 @@ import java.util.regex.Pattern;
public enum DataUnit {
- // 1024 * 1024 =
- // 1024 * 1024 * 1024
- // 1024 * 1024 * 1024 * 1024
/**
* Bytes
*/
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/FlowFileFilter.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/FlowFileFilter.java
index 20147ca5d0..3bd6546a61 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/FlowFileFilter.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/FlowFileFilter.java
@@ -35,8 +35,10 @@ public interface FlowFileFilter {
* whether or not the Processor is interested in filtering additional
* FlowFiles
*
- * @param flowFile
- * @return
+ * @param flowFile to apply the filter to
+ * @return true if the given FlowFile should be selected and
+ * if Processor is interested in filtering additional
+ * FlowFiles
*/
FlowFileFilterResult filter(FlowFile flowFile);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java
index 7fa183f824..c61a31802f 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java
@@ -39,8 +39,8 @@ public interface ProcessContext {
* Retrieves the current value set for the given descriptor, if a value is
* set - else uses the descriptor to determine the appropriate default value
*
- * @param descriptor
- * @return
+ * @param descriptor to lookup the value of
+ * @return the property value of the given descriptor
*/
PropertyValue getProperty(PropertyDescriptor descriptor);
@@ -48,8 +48,8 @@ public interface ProcessContext {
* Retrieves the current value set for the given descriptor, if a value is
* set - else uses the descriptor to determine the appropriate default value
*
- * @param propertyName
- * @return
+ * @param propertyName of the property to lookup the value for
+ * @return property value as retrieved by property name
*/
PropertyValue getProperty(String propertyName);
@@ -57,8 +57,9 @@ public interface ProcessContext {
* Creates and returns a {@link PropertyValue} object that can be used for
* evaluating the value of the given String
*
- * @param rawValue
- * @return
+ * @param rawValue the raw input before any property evaluation has occurred
+ * @return a {@link PropertyValue} object that can be used for
+ * evaluating the value of the given String
*/
PropertyValue newPropertyValue(String rawValue);
@@ -89,11 +90,9 @@ public interface ProcessContext {
String getAnnotationData();
/**
- * Returns a Map of all PropertyDescriptors to their configured values. This
+ * @return a Map of all PropertyDescriptors to their configured values. This
* Map may or may not be modifiable, but modifying its values will not
* change the values of the processor's properties
- *
- * @return
*/
Map getProperties();
@@ -101,8 +100,8 @@ public interface ProcessContext {
* Encrypts the given value using the password provided in the NiFi
* Properties
*
- * @param unencrypted
- * @return
+ * @param unencrypted plaintext value
+ * @return encrypted value
*/
String encrypt(String unencrypted);
@@ -110,19 +109,17 @@ public interface ProcessContext {
* Decrypts the given value using the password provided in the NiFi
* Properties
*
- * @param encrypted
- * @return
+ * @param encrypted the encrypted value
+ * @return the plaintext value
*/
String decrypt(String encrypted);
/**
- * Provides a {@code ControllerServiceLookup} that can be used to obtain a
+ * @return a {@code ControllerServiceLookup} that can be used to obtain a
* Controller Service
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
-
+
/**
* @return the set of all relationships for which space is available to
* receive new objects
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java
index 7b855f2833..ed46d68071 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java
@@ -60,7 +60,6 @@ import org.apache.nifi.provenance.ProvenanceReporter;
* A process session instance may be used continuously. That is, after each
* commit or rollback, the session can be used again.
*
- * @author unattributed
*/
public interface ProcessSession {
@@ -136,7 +135,8 @@ public interface ProcessSession {
* single call.
*
* @param maxResults the maximum number of FlowFiles to return
- * @return
+ * @return up to maxResults FlowFiles from the work queue. If
+ * no FlowFiles are available, returns an empty list. Will not return null.
* @throws IllegalArgumentException if maxResults is less than
* 0
*/
@@ -152,8 +152,9 @@ public interface ProcessSession {
* returned.
*
*
- * @param filter
- * @return
+ * @param filter to limit which flow files are returned
+ * @return all FlowFiles from all of the incoming queues for which the given
+ * {@link FlowFileFilter} indicates should be accepted.
*/
List get(FlowFileFilter filter);
@@ -170,7 +171,7 @@ public interface ProcessSession {
* linkage to a parent FlowFile. This method is appropriate only when data
* is received or created from an external system. Otherwise, this method
* should be avoided and should instead use {@link #create(FlowFile)} or
- * {@link #create(Collection)}.
+ * {@see #create(Collection)}.
*
* When this method is used, a Provenance CREATE or RECEIVE Event should be
* generated. See the {@link #getProvenanceReporter()} method and
@@ -188,8 +189,8 @@ public interface ProcessSession {
* event, depending on whether or not other FlowFiles are generated from the
* same parent before the ProcessSession is committed.
*
- * @param parent
- * @return
+ * @param parent to base the new flowfile on
+ * @return newly created flowfile
*/
FlowFile create(FlowFile parent);
@@ -201,8 +202,8 @@ public interface ProcessSession {
* only a single parent exists). This method will automatically generate a
* Provenance JOIN event.
*
- * @param parents
- * @return
+ * @param parents which the new flowfile should inherit shared attributes from
+ * @return new flowfile
*/
FlowFile create(Collection parents);
@@ -239,9 +240,9 @@ public interface ProcessSession {
* Event, if the offset is 0 and the size is exactly equal to the size of
* the example FlowFile).
*
- * @param example
- * @param offset
- * @param size
+ * @param parent to base the new flowfile attributes on
+ * @param offset of the parent flowfile to base the child flowfile content on
+ * @param size of the new flowfile from the offset
* @return a FlowFile with the specified size whose parent is first argument
* to this function
*
@@ -250,14 +251,14 @@ public interface ProcessSession {
* the given FlowFile
* @throws FlowFileHandlingException if the given FlowFile is already
* transferred or removed or doesn't belong to this session, or if the
- * specified offset + size exceeds that of the size of the example FlowFile.
+ * specified offset + size exceeds that of the size of the parent FlowFile.
* Automatic rollback will occur.
* @throws MissingFlowFileException if the given FlowFile content cannot be
* found. The FlowFile should no longer be reference, will be internally
* destroyed, and the session is automatically rolled back and what is left
* of the FlowFile is destroyed.
*/
- FlowFile clone(FlowFile example, long offset, long size);
+ FlowFile clone(FlowFile parent, long offset, long size);
/**
* Sets a penalty for the given FlowFile which will make it unavailable to
@@ -368,8 +369,8 @@ public interface ProcessSession {
* destination processor will have immediate visibility of the transferred
* FlowFiles within the session.
*
- * @param flowFile
- * @param relationship
+ * @param flowFile to transfer
+ * @param relationship to transfer to
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -389,7 +390,7 @@ public interface ProcessSession {
* the FlowFile will be maintained. FlowFiles that are created by the
* processor cannot be transferred back to themselves via this method.
*
- * @param flowFile
+ * @param flowFile to transfer
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -410,7 +411,7 @@ public interface ProcessSession {
* created by the processor cannot be transferred back to themselves via
* this method.
*
- * @param flowFiles
+ * @param flowFiles to transfer
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -435,8 +436,8 @@ public interface ProcessSession {
* destination processor will have immediate visibility of the transferred
* FlowFiles within the session.
*
- * @param flowFiles
- * @param relationship
+ * @param flowFiles to transfer
+ * @param relationship to transfer to
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -455,7 +456,7 @@ public interface ProcessSession {
* nothing else references it and this FlowFile will no longer be available
* for further operation.
*
- * @param flowFile
+ * @param flowFile to remove
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -471,7 +472,7 @@ public interface ProcessSession {
* nothing else references it and this FlowFile will no longer be available
* for further operation.
*
- * @param flowFiles
+ * @param flowFiles to remove
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -484,12 +485,12 @@ public interface ProcessSession {
/**
* Executes the given callback against the contents corresponding to the
* given FlowFile.
- *
- * Note: The OutputStream provided to the given OutputStreamCallback
+ *
+ * Note: The OutputStream provided to the given OutputStreamCallback
* will not be accessible once this method has completed its execution.
*
- * @param source
- * @param reader
+ * @param source flowfile to retrieve content of
+ * @param reader that will be called to read the flowfile content
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -501,7 +502,7 @@ public interface ProcessSession {
* destroyed, and the session is automatically rolled back and what is left
* of the FlowFile is destroyed.
* @throws FlowFileAccessException if some IO problem occurs accessing
- * FlowFile content; if an attempt is made to access the InputStream
+ * FlowFile content; if an attempt is made to access the InputStream
* provided to the given InputStreamCallback after this method completed its
* execution
*/
@@ -511,8 +512,8 @@ public interface ProcessSession {
* Combines the content of all given source FlowFiles into a single given
* destination FlowFile.
*
- * @param sources
- * @param destination
+ * @param sources the flowfiles to merge
+ * @param destination the flowfile to use as the merged result
* @return updated destination FlowFile (new size, etc...)
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
@@ -536,8 +537,8 @@ public interface ProcessSession {
* Combines the content of all given source FlowFiles into a single given
* destination FlowFile.
*
- * @param sources
- * @param destination
+ * @param sources to merge together
+ * @param destination to merge to
* @param header bytes that will be added to the beginning of the merged
* output. May be null or empty.
* @param footer bytes that will be added to the end of the merged output.
@@ -566,12 +567,12 @@ public interface ProcessSession {
/**
* Executes the given callback against the content corresponding to the
* given FlowFile.
- *
- * Note: The OutputStream provided to the given OutputStreamCallback
- * will not be accessible once this method has completed its execution.
*
- * @param source
- * @param writer
+ * Note: The OutputStream provided to the given OutputStreamCallback
+ * will not be accessible once this method has completed its execution.
+ *
+ * @param source to write to
+ * @param writer used to write new content
* @return updated FlowFile
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
@@ -584,8 +585,8 @@ public interface ProcessSession {
* destroyed, and the session is automatically rolled back and what is left
* of the FlowFile is destroyed.
* @throws FlowFileAccessException if some IO problem occurs accessing
- * FlowFile content; if an attempt is made to access the OutputStream
- * provided to the given OutputStreamCallaback after this method completed
+ * FlowFile content; if an attempt is made to access the OutputStream
+ * provided to the given OutputStreamCallaback after this method completed
* its execution
*/
FlowFile write(FlowFile source, OutputStreamCallback writer) throws FlowFileAccessException;
@@ -593,13 +594,13 @@ public interface ProcessSession {
/**
* Executes the given callback against the content corresponding to the
* given flow file.
- *
- * Note: The InputStream & OutputStream provided to the given
- * StreamCallback will not be accessible once this method has completed its
- * execution.
*
- * @param source
- * @param writer
+ * Note: The InputStream & OutputStream provided to the given
+ * StreamCallback will not be accessible once this method has completed its
+ * execution.
+ *
+ * @param source to read from and write to
+ * @param writer used to read the old content and write new content
* @return updated FlowFile
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
@@ -612,8 +613,8 @@ public interface ProcessSession {
* destroyed, and the session is automatically rolled back and what is left
* of the FlowFile is destroyed.
* @throws FlowFileAccessException if some IO problem occurs accessing
- * FlowFile content; if an attempt is made to access the InputStream or
- * OutputStream provided to the given StreamCallback after this method
+ * FlowFile content; if an attempt is made to access the InputStream or
+ * OutputStream provided to the given StreamCallback after this method
* completed its execution
*/
FlowFile write(FlowFile source, StreamCallback writer) throws FlowFileAccessException;
@@ -622,16 +623,16 @@ public interface ProcessSession {
* Executes the given callback against the content corresponding to the
* given FlowFile, such that any data written to the OutputStream of the
* content will be appended to the end of FlowFile.
- *
- * Note: The OutputStream provided to the given OutputStreamCallback
+ *
+ * Note: The OutputStream provided to the given OutputStreamCallback
* will not be accessible once this method has completed its execution.
*
- * @param source
- * @param writer
- * @return
- * @throws FlowFileAccessException if an attempt is made to access the
- * OutputStream provided to the given OutputStreamCallaback after this method
- * completed its execution
+ * @param source the flowfile for which content should be appended
+ * @param writer used to write new bytes to the flowfile content
+ * @return the updated flowfile reference for the new content
+ * @throws FlowFileAccessException if an attempt is made to access the
+ * OutputStream provided to the given OutputStreamCallaback after this
+ * method completed its execution
*/
FlowFile append(FlowFile source, OutputStreamCallback writer) throws FlowFileAccessException;
@@ -687,8 +688,8 @@ public interface ProcessSession {
/**
* Writes the content of the given FlowFile to the given destination path.
*
- * @param flowFile
- * @param destination
+ * @param flowFile to export the content of
+ * @param destination to export the content to
* @param append if true will append to the current content at the given
* path; if false will replace any current content
* @throws IllegalStateException if detected that this method is being
@@ -709,8 +710,8 @@ public interface ProcessSession {
/**
* Writes the content of the given FlowFile to the given destination stream
*
- * @param flowFile
- * @param destination
+ * @param flowFile to export the content of
+ * @param destination to export the content to
* @throws IllegalStateException if detected that this method is being
* called from within a callback of another method in this session and for
* the given FlowFile(s)
@@ -729,7 +730,7 @@ public interface ProcessSession {
/**
* Returns a ProvenanceReporter that is tied to this ProcessSession.
*
- * @return
+ * @return the provenance reporter
*/
ProvenanceReporter getProvenanceReporter();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/Processor.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/Processor.java
index eff5b5958c..fcb04ea510 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/Processor.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/Processor.java
@@ -54,7 +54,7 @@ public interface Processor extends ConfigurableComponent {
* Provides the processor with access to objects that may be of use
* throughout the life of the Processor
*
- * @param context
+ * @param context of initialization
*/
void initialize(ProcessorInitializationContext context);
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessorInitializationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessorInitializationContext.java
index 6e3679c440..7b09e1bafd 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessorInitializationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/ProcessorInitializationContext.java
@@ -29,25 +29,19 @@ import org.apache.nifi.logging.ProcessorLog;
public interface ProcessorInitializationContext {
/**
- * Returns the unique identifier for this processor
- *
- * @return
+ * @return the unique identifier for this processor
*/
String getIdentifier();
/**
- * Returns a {@link ProcessorLog} that is tied to this processor that can be
+ * @return a {@link ProcessorLog} that is tied to this processor that can be
* used to log events
- *
- * @return
*/
ProcessorLog getLogger();
/**
- * Returns the {@link ControllerServiceLookup} which can be used to obtain
+ * @return the {@link ControllerServiceLookup} which can be used to obtain
* Controller Services
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/CapabilityDescription.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/CapabilityDescription.java
index fad1ebb90d..8ca8290010 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/CapabilityDescription.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/CapabilityDescription.java
@@ -28,7 +28,8 @@ import java.lang.annotation.Target;
* provided. This description can be provided to a user in logs, UI, etc.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.documentation.CapabilityDescription}
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.documentation.CapabilityDescription}
* annotation.
*/
@Documented
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/EventDriven.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/EventDriven.java
index 615216828f..53f1d72a3e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/EventDriven.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/EventDriven.java
@@ -39,8 +39,8 @@ import java.lang.annotation.Target;
*
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.EventDriven}
- * annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.EventDriven} annotation.
*/
@Documented
@Target({ElementType.TYPE})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnAdded.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnAdded.java
index b2ea5eb43d..1c2b709099 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnAdded.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnAdded.java
@@ -32,7 +32,8 @@ import java.lang.annotation.Target;
* be added to the graph.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnAdded} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnAdded} annotation.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnRemoved.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnRemoved.java
index fae4e34610..239a449970 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnRemoved.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnRemoved.java
@@ -33,7 +33,8 @@ import java.lang.annotation.Target;
* be removed from the graph.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnRemoved} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnRemoved} annotation.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnScheduled.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnScheduled.java
index ed65ce0459..3a716e630c 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnScheduled.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnScheduled.java
@@ -35,8 +35,9 @@ import java.lang.annotation.Target;
* be scheduled to run.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnScheduled} annotation.
-*/
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnScheduled} annotation.
+ */
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnShutdown.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnShutdown.java
index bb38221c28..22ecc0b0ff 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnShutdown.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnShutdown.java
@@ -29,7 +29,8 @@ import java.lang.annotation.Target;
* most once for each processor instance in a process lifetime.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnShutdown} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnShutdown} annotation.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnStopped.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnStopped.java
index 3f61850a54..223868ec3b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnStopped.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnStopped.java
@@ -46,7 +46,8 @@ import java.lang.annotation.Target;
*
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnStopped} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnStopped} annotation.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnUnscheduled.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnUnscheduled.java
index a9b94fc17d..a2314355b0 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnUnscheduled.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/OnUnscheduled.java
@@ -37,7 +37,8 @@ import java.lang.annotation.Target;
* be scheduled to run.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.lifecycle.OnUnscheduled} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.lifecycle.OnUnscheduled} annotation.
*/
@Documented
@Target({ElementType.METHOD})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SideEffectFree.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SideEffectFree.java
index 281b38d902..99980c563e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SideEffectFree.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SideEffectFree.java
@@ -36,7 +36,8 @@ import java.lang.annotation.Target;
* repeated (implied idempotent behavior).
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.SideEffectFree} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.SideEffectFree} annotation.
*/
@Documented
@Target({ElementType.TYPE})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SupportsBatching.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SupportsBatching.java
index 2b89e4e9ef..7335a55e2d 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SupportsBatching.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/SupportsBatching.java
@@ -41,7 +41,8 @@ import java.lang.annotation.Target;
* from a remote source.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.SupportsBatching} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.SupportsBatching} annotation.
*/
@Documented
@Target({ElementType.TYPE})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/Tags.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/Tags.java
index c06302d52e..81428d7531 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/Tags.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/Tags.java
@@ -29,9 +29,8 @@ import java.lang.annotation.Target;
* any way but serve as additional documentation and can be used to sort/filter
* Processors.
*
- * @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.documentation.Tags}
- * annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.documentation.Tags} annotation.
*/
@Documented
@Target({ElementType.TYPE})
@@ -40,8 +39,5 @@ import java.lang.annotation.Target;
@Deprecated
public @interface Tags {
- /**
- * @return all tag values associated with the given processor
- */
public String[] value();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerSerially.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerSerially.java
index 0b3d1e6d05..52c1079681 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerSerially.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerSerially.java
@@ -30,8 +30,9 @@ import java.lang.annotation.Target;
* execution.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.TriggerSerially} annotation.
-*/
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.TriggerSerially} annotation.
+ */
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenAnyDestinationAvailable.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenAnyDestinationAvailable.java
index 52f6c5e132..8e8e5df1ce 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenAnyDestinationAvailable.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenAnyDestinationAvailable.java
@@ -30,7 +30,9 @@ import java.lang.annotation.Target;
* destinations report that they have available space.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.TriggerWhenAnyDestinationAvailable} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.TriggerWhenAnyDestinationAvailable}
+ * annotation.
*/
@Documented
@Target({ElementType.TYPE})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenEmpty.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenEmpty.java
index 1d2f755f48..f27b111714 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenEmpty.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/annotation/TriggerWhenEmpty.java
@@ -32,7 +32,8 @@ import java.lang.annotation.Target;
* their queue or they present this annotation.
*
* @author none
- * @deprecated This Annotation has been replaced by the {@link org.apache.nifi.annotation.behavior.TriggerWhenEmpty} annotation.
+ * @deprecated This Annotation has been replaced by the
+ * {@link org.apache.nifi.annotation.behavior.TriggerWhenEmpty} annotation.
*/
@Documented
@Target({ElementType.TYPE})
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/InputStreamCallback.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/InputStreamCallback.java
index e227156d65..e850684832 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/InputStreamCallback.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/InputStreamCallback.java
@@ -30,8 +30,8 @@ public interface InputStreamCallback {
* automatically opened and closed though it is ok to close the stream
* manually.
*
- * @param in
- * @throws IOException
+ * @param in the stream to read bytes from
+ * @throws IOException if issues reading from the underlying stream
*/
void process(InputStream in) throws IOException;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/OutputStreamCallback.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/OutputStreamCallback.java
index a991a1c7ab..e37c37688b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/OutputStreamCallback.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/OutputStreamCallback.java
@@ -31,8 +31,8 @@ public interface OutputStreamCallback {
* manually - and quite important if any streams wrapping these streams open
* resources which should be cleared.
*
- * @param out
- * @throws IOException
+ * @param out the stream to write bytes to
+ * @throws IOException if issues writing to output stream
*/
void process(OutputStream out) throws IOException;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/StreamCallback.java b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/StreamCallback.java
index 2d47c8903f..54f0e3bbca 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/StreamCallback.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/processor/io/StreamCallback.java
@@ -20,10 +20,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-/**
- *
- * @author unattributed
- */
public interface StreamCallback {
/**
@@ -32,9 +28,9 @@ public interface StreamCallback {
* manually - and quite important if any streams wrapping these streams open
* resources which should be cleared.
*
- * @param in
- * @param out
- * @throws IOException
+ * @param in the stream to read bytes from
+ * @param out the stream to write bytes to
+ * @throws IOException if issues occur reading or writing the underlying streams
*/
void process(InputStream in, OutputStream out) throws IOException;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventBuilder.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventBuilder.java
index 4978eba533..0ffccd56d4 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventBuilder.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventBuilder.java
@@ -28,8 +28,8 @@ public interface ProvenanceEventBuilder {
/**
* Sets the type of {@link ProvenanceEventRecord}
*
- * @param eventType
- * @return
+ * @param eventType of the event
+ * @return the builder
*/
ProvenanceEventBuilder setEventType(ProvenanceEventType eventType);
@@ -38,15 +38,15 @@ public interface ProvenanceEventBuilder {
* given event
*
* @param event the event from which to populate the Builders values
- * @return
+ * @return the builder
*/
ProvenanceEventBuilder fromEvent(ProvenanceEventRecord event);
/**
* Sets the date and time at which the FlowFile entered the flow
*
- * @param entryDate
- * @return
+ * @param entryDate of the flow file
+ * @return the builder
*/
ProvenanceEventBuilder setFlowFileEntryDate(long entryDate);
@@ -54,8 +54,8 @@ public interface ProvenanceEventBuilder {
* Sets the Lineage Identifiers. This is a set of all FlowFile UUID's that
* were involved in making this event occur.
*
- * @param lineageIdentifiers
- * @return
+ * @param lineageIdentifiers of the flowfiles in this event
+ * @return the builder
*/
ProvenanceEventBuilder setLineageIdentifiers(Set lineageIdentifiers);
@@ -63,12 +63,12 @@ public interface ProvenanceEventBuilder {
* Sets the Content Claim that the FlowFile was previously associated with
* before this event occurred.
*
- * @param container
- * @param section
- * @param identifier
- * @param offset
- * @param size
- * @return
+ * @param container for previous content
+ * @param section for previous content
+ * @param identifier for previous content
+ * @param offset for previous content
+ * @param size for previous content
+ * @return the builder
*/
ProvenanceEventBuilder setPreviousContentClaim(String container, String section, String identifier, Long offset, long size);
@@ -76,12 +76,12 @@ public interface ProvenanceEventBuilder {
* Sets the Content Claim that the FlowFile is associated with as a result
* of this event
*
- * @param container
- * @param section
- * @param identifier
- * @param offset
- * @param size
- * @return
+ * @param container for resulting content
+ * @param section for resulting content
+ * @param identifier for resulting content
+ * @param offset for resulting content
+ * @param size for resulting content
+ * @return the builder
*/
ProvenanceEventBuilder setCurrentContentClaim(String container, String section, String identifier, Long offset, long size);
@@ -89,8 +89,8 @@ public interface ProvenanceEventBuilder {
* Sets the identifier of the FlowFile Queue from which the FlowFile was
* pulled
*
- * @param identifier
- * @return
+ * @param identifier of the source queue
+ * @return the builder
*/
ProvenanceEventBuilder setSourceQueueIdentifier(String identifier);
@@ -99,28 +99,28 @@ public interface ProvenanceEventBuilder {
* occurred and any attributes that were added or updated as a result of
* this event.
*
- * @param previousAttributes
+ * @param previousAttributes Map of all attributes before the event occurred
* @param updatedAttributes Map containing all attributes that were added or
* updated. If any entry has a value of null, that attribute is
* considered removed
*
- * @return
+ * @return the builder
*/
ProvenanceEventBuilder setAttributes(Map previousAttributes, Map updatedAttributes);
/**
* Sets the UUID to associate with the FlowFile
*
- * @param uuid
- * @return
+ * @param uuid of the flowfile
+ * @return the builder
*/
ProvenanceEventBuilder setFlowFileUUID(String uuid);
/**
* Sets the time at which the Provenance Event took place
*
- * @param eventTime
- * @return
+ * @param eventTime time of the event
+ * @return the builder
*/
ProvenanceEventBuilder setEventTime(long eventTime);
@@ -128,16 +128,16 @@ public interface ProvenanceEventBuilder {
* Sets the amount of time that was required in order to perform the
* function referred to by this event
*
- * @param millis
- * @return
+ * @param millis of the event
+ * @return the builder
*/
ProvenanceEventBuilder setEventDuration(long millis);
/**
* Sets the time at which the FlowFile's lineage began
*
- * @param startDate
- * @return
+ * @param startDate start date of the event
+ * @return the builder
*/
ProvenanceEventBuilder setLineageStartDate(long startDate);
@@ -145,8 +145,8 @@ public interface ProvenanceEventBuilder {
* Sets the unique identifier of the NiFi Component (such as a
* {@link Processor}) that is generating the Event
*
- * @param componentId
- * @return
+ * @param componentId that produced the event
+ * @return the builder
*/
ProvenanceEventBuilder setComponentId(String componentId);
@@ -154,8 +154,8 @@ public interface ProvenanceEventBuilder {
* Sets the type of the Component that is generating the Event. For
* {@link Processor}s, this is the Simple Class Name of the Processor.
*
- * @param componentType
- * @return
+ * @param componentType of the component that made the event
+ * @return the builder
*/
ProvenanceEventBuilder setComponentType(String componentType);
@@ -167,8 +167,8 @@ public interface ProvenanceEventBuilder {
* and {@link ProvenanceEventType#SEND} and will be ignored for any other
* event types.
*
- * @param sourceSystemFlowFileIdentifier
- * @return
+ * @param sourceSystemFlowFileIdentifier identifier the remote system used
+ * @return the builder
*/
ProvenanceEventBuilder setSourceSystemFlowFileIdentifier(String sourceSystemFlowFileIdentifier);
@@ -184,8 +184,8 @@ public interface ProvenanceEventBuilder {
* and {@link ProvenanceEventType#SEND} and will be ignored for any other
* event types.
*
- * @param transitUri
- * @return
+ * @param transitUri of the event
+ * @return the builder
*/
ProvenanceEventBuilder setTransitUri(String transitUri);
@@ -194,13 +194,13 @@ public interface ProvenanceEventBuilder {
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE}
*
- * This is valid only for null null null null null {@link ProvenanceEventType#SPAWN},
+ * This is valid only for {@link ProvenanceEventType#SPAWN},
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE} events and will be ignored for any
* other event types.
*
- * @param parent
- * @return
+ * @param parent flowfile that this event is derived from
+ * @return the builder
*/
ProvenanceEventBuilder addParentFlowFile(FlowFile parent);
@@ -209,13 +209,13 @@ public interface ProvenanceEventBuilder {
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE}
*
- * This is valid only for null null null null null {@link ProvenanceEventType#SPAWN},
+ * This is valid only for {@link ProvenanceEventType#SPAWN},
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE} events and will be ignored for any
* other event types.
*
- * @param parent
- * @return
+ * @param parent previous parent of this event
+ * @return the builder
*/
ProvenanceEventBuilder removeParentFlowFile(FlowFile parent);
@@ -224,13 +224,13 @@ public interface ProvenanceEventBuilder {
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE}
*
- * This is valid only for null null null null null {@link ProvenanceEventType#SPAWN},
+ * This is valid only for {@link ProvenanceEventType#SPAWN},
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE} events and will be ignored for any
* other event types.
*
- * @param child
- * @return
+ * @param child the child to add
+ * @return the builder
*/
ProvenanceEventBuilder addChildFlowFile(FlowFile child);
@@ -239,13 +239,13 @@ public interface ProvenanceEventBuilder {
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE}
*
- * This is valid only for null null null null null {@link ProvenanceEventType#SPAWN},
+ * This is valid only for {@link ProvenanceEventType#SPAWN},
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, and
* {@link ProvenanceEventType#CLONE} events and will be ignored for any
* other event types.
*
- * @param child
- * @return
+ * @param child to remove
+ * @return the builder
*/
ProvenanceEventBuilder removeChildFlowFile(FlowFile child);
@@ -259,8 +259,8 @@ public interface ProvenanceEventBuilder {
* This is valid only for {@link ProvenanceEventType#ADDINFO} events and
* will be ignored for any other event types.
*
- * @param alternateIdentifierUri
- * @return
+ * @param alternateIdentifierUri another identifier of the flowfile this event is for
+ * @return the builder
*/
ProvenanceEventBuilder setAlternateIdentifierUri(String alternateIdentifierUri);
@@ -268,8 +268,8 @@ public interface ProvenanceEventBuilder {
* Sets the details for this event. This is a free-form String that can
* contain any information that is relevant to this event.
*
- * @param details
- * @return
+ * @param details a description of the event
+ * @return the builder
*/
ProvenanceEventBuilder setDetails(String details);
@@ -279,8 +279,8 @@ public interface ProvenanceEventBuilder {
* {@link ProvenanceEventType#ROUTE} events and will be ignored for any
* other event types.
*
- * @param relationship
- * @return
+ * @param relationship to which flowfiles in this event were routed
+ * @return the builder
*/
ProvenanceEventBuilder setRelationship(Relationship relationship);
@@ -288,8 +288,8 @@ public interface ProvenanceEventBuilder {
* Populates the builder with as much information as it can from the given
* FlowFile
*
- * @param flowFile
- * @return
+ * @param flowFile to source attributes for this event from
+ * @return the builder
*/
ProvenanceEventBuilder fromFlowFile(FlowFile flowFile);
@@ -301,7 +301,7 @@ public interface ProvenanceEventBuilder {
* depend on the {@link ProvevenanceEventRepository} to generate the unique
* identifier.
*
- * @return
+ * @return the event
*/
ProvenanceEventRecord build();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRecord.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRecord.java
index 4b1b1a00c1..dc251b3f17 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRecord.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRecord.java
@@ -26,26 +26,20 @@ import java.util.Set;
public interface ProvenanceEventRecord {
/**
- * Returns a unique ID for this Provenance Event. Depending on the
+ * @return a unique ID for this Provenance Event. Depending on the
* implementation, the Event ID may be set to -1 until the event has been
* added to the {@link ProvenanceEventRepository}
- *
- * @return
*/
long getEventId();
/**
- * Returns the time at which this Provenance Event was created, as the
+ * @return the time at which this Provenance Event was created, as the
* number of milliseconds since epoch
- *
- * @return
*/
long getEventTime();
/**
- * Returns the EntryDate of the FlowFile to which this Event is associated
- *
- * @return
+ * @return the EntryDate of the FlowFile to which this Event is associated
*/
long getFlowFileEntryDate();
@@ -61,236 +55,181 @@ public interface ProvenanceEventRecord {
Set getLineageIdentifiers();
/**
- * Returns the size of the FlowFile to which this Event is associated
- *
- * @return
+ * @return the size of the FlowFile to which this Event is associated
*/
long getFileSize();
/**
- * Returns the previous size of the FlowFile to which this Event is
+ * @return the previous size of the FlowFile to which this Event is
* associated, if the FlowFile previously had content and its size was
* known; otherwise, returns null
- *
- * @return
*/
Long getPreviousFileSize();
/**
- * Returns the amount of time in milliseconds that elapsed while performing
- * this event. If not populated, the value -1 will be returned.
- *
- * @return
+ * @return the amount of time in milliseconds that elapsed while performing
+ * this event. If not populated, the value -1 will be returned
*/
long getEventDuration();
/**
- * Returns the type of this Provenance Event
- *
- * @return
+ * @return the type of this Provenance Event
*/
ProvenanceEventType getEventType();
/**
- * Returns all FlowFile attributes that were associated with the FlowFile at
+ * @return all FlowFile attributes that were associated with the FlowFile at
* the time that this ProvenanceEvent was created
- *
- * @return
*/
Map getAttributes();
/**
- * Returns all FlowFile attributes that existed on the FlowFile before this
+ * @return all FlowFile attributes that existed on the FlowFile before this
* event occurred
- *
- * @return
*/
Map getPreviousAttributes();
/**
- * Returns all FlowFile attributes that were updated as a result of this
+ * @return all FlowFile attributes that were updated as a result of this
* event
- *
- * @return
*/
Map getUpdatedAttributes();
/**
- * Returns the ID of the Processor/component that created this Provenance
+ * @return the ID of the Processor/component that created this Provenance
* Event
- *
- * @return
*/
String getComponentId();
/**
- * Returns the fully-qualified Class Name of the Processor/component that
+ * @return the fully-qualified Class Name of the Processor/component that
* created this Provenance Event
- *
- * @return
*/
String getComponentType();
/**
- * Returns a URI that provides information about the System and Protocol
+ * @return a URI that provides information about the System and Protocol
* information over which the transfer occurred. The intent of this field is
* such that both the sender and the receiver can publish the events to an
* external Enterprise-wide system that is then able to correlate the SEND
* and RECEIVE events.
- *
- * @return
*/
String getTransitUri();
/**
- * Returns the UUID that the Source System used to refer to this data; this
- * is applicable only when the {@link ProvenanceEventType} is of type
- * {@link ProvenanceEventType#RECEIVE RECEIVE}.
- *
* Since the receiving system will usually refer to the data using a
* different identifier than the source system, this information is used to
* correlate the receive system's FlowFile with the sending system's data
*
- * @return
+ * @return the UUID that the Source System used to refer to this data; this
+ * is applicable only when the {@link ProvenanceEventType} is of type
+ * {@link ProvenanceEventType#RECEIVE RECEIVE}
*/
String getSourceSystemFlowFileIdentifier();
/**
- * Returns the UUID of the FlowFile with which this Event is associated
- *
- * @return
+ * @return the UUID of the FlowFile with which this Event is associated
*/
String getFlowFileUuid();
/**
- * Returns the UUID's of all Parent FlowFiles. This is applicable only when
+ * @return the UUID's of all Parent FlowFiles. This is applicable only when
* the {@link ProvenanceEventType} is of type
- * {@link ProvenanceEventType#SPAWN SPAWN}.
- *
- * @return
+ * {@link ProvenanceEventType#SPAWN SPAWN}
*/
List getParentUuids();
/**
- * Returns the UUID's of all Child FlowFiles. This is applicable only when
+ * @return the UUID's of all Child FlowFiles. This is applicable only when
* the {@link ProvenanceEventType} is of type
- * {@link ProvenanceEventType#SPAWN SPAWN}.
- *
- * @return
+ * {@link ProvenanceEventType#SPAWN SPAWN}
*/
List getChildUuids();
/**
- * Returns the Alternate Identifier associated with the FlowFile with which
+ * @return the Alternate Identifier associated with the FlowFile with which
* this Event is associated. This is applicable only when the
* {@link ProvenanceEventType} is of type
- * {@link ProvenanceEventType#ADDINFO}.
- *
- * @return
+ * {@link ProvenanceEventType#ADDINFO}
*/
String getAlternateIdentifierUri();
/**
- * Returns the details for this record, if any were supplied. Otherwise,
+ * @return the details for this record, if any were supplied. Otherwise,
* returns null
- *
- * @return
- *
*/
String getDetails();
/**
- * Returns the relationship to which this record was routed if the event
+ * @return the relationship to which this record was routed if the event
* type is {@link ProvenanceEventType#ROUTE}. The relationship is applicable
- * only to this type.
- *
- * @return
- *
+ * only to this type
*/
String getRelationship();
/**
- * Returns the identifier of the queue from which the FlowFile was taken, if
+ * @return the identifier of the queue from which the FlowFile was taken, if
* any. If the FlowFile is created as a result of this event (in this case,
- * the Event Type is one of null null null null null {@link ProvenanceEventType#CREATE}, {@link ProvenanceEventType#RECEIVE},
+ * the Event Type is one of null null null null null null null null {@link ProvenanceEventType#CREATE}, {@link ProvenanceEventType#RECEIVE},
* {@link ProvenanceEventType#FORK}, {@link ProvenanceEventType#JOIN}, or
* {@link ProvenanceEventType#CLONE}), or if the queue identifier is
- * unknown, then this method will return null.
- *
- * @return
+ * unknown, then this method will return null
*
*/
String getSourceQueueIdentifier();
/**
- * Returns the Section for the Content Claim that this Event refers to, if
+ * @return the Section for the Content Claim that this Event refers to, if
* any; otherwise, returns null
*
- * @return
- *
*/
String getContentClaimSection();
/**
- * Returns the Section for the Content Claim that the FlowFile previously
+ * @return the Section for the Content Claim that the FlowFile previously
* referenced, if any; otherwise, returns null
*
- * @return
- *
*/
String getPreviousContentClaimSection();
/**
- * Returns the Container for the Content Claim that this Event refers to, if
+ * @return the Container for the Content Claim that this Event refers to, if
* any; otherwise, returns null
*
- * @return
- *
*/
String getContentClaimContainer();
/**
- * Returns the Container for the Content Claim that the FlowFile previously
+ * @return the Container for the Content Claim that the FlowFile previously
* referenced, if any; otherwise, returns null
- *
- * @return
- *
*/
String getPreviousContentClaimContainer();
/**
- * Returns the Identifier for the Content Claim that this Event refers to,
+ * @return the Identifier for the Content Claim that this Event refers to,
* if any; otherwise, returns null
*
- * @return
- *
*/
String getContentClaimIdentifier();
/**
- * Returns the Identifier for the Content Claim that the FlowFile previously
+ * @return the Identifier for the Content Claim that the FlowFile previously
* referenced, if any; otherwise, returns null
*
- * @return
- *
*/
String getPreviousContentClaimIdentifier();
/**
- * Returns the offset into the Content Claim at which the FlowFile's content
+ * @return the offset into the Content Claim at which the FlowFile's content
* begins, if any; otherwise, returns null
*
- * @return
- *
*/
Long getContentClaimOffset();
/**
- * Returns the offset into the Content Claim at which the FlowFile's
+ * @return the offset into the Content Claim at which the FlowFile's
* previous content began, if any; otherwise, returns null
*
- * @return
- *
*/
Long getPreviousContentClaimOffset();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRepository.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRepository.java
index 39c829e8d1..25563b7769 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRepository.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/ProvenanceEventRepository.java
@@ -36,8 +36,9 @@ public interface ProvenanceEventRepository {
/**
* Performs any initialization needed. This should be called only by the
* framework.
- * @param eventReporter
- * @throws java.io.IOException
+ *
+ * @param eventReporter to report to
+ * @throws java.io.IOException if unable to initialize
*/
void initialize(EventReporter eventReporter) throws IOException;
@@ -45,7 +46,7 @@ public interface ProvenanceEventRepository {
* Returns a {@link ProvenanceEventBuilder} that is capable of building
* {@link ProvenanceEventRecord}s
*
- * @return
+ * @return builder
*/
ProvenanceEventBuilder eventBuilder();
@@ -54,7 +55,7 @@ public interface ProvenanceEventRepository {
* the event id has been populated. Depending on the implementation, the
* returned event may or may not be the same event given
*
- * @param event
+ * @param event to register
*/
void registerEvent(ProvenanceEventRecord event);
@@ -66,7 +67,7 @@ public interface ProvenanceEventRepository {
* of the Collection are atomic. This detail is implementation-specific.
*
*
- * @param events
+ * @param events to register
*/
void registerEvents(Iterable events);
@@ -75,18 +76,16 @@ public interface ProvenanceEventRepository {
* repository starting with the given ID. The first ID in the repository
* will always be 0 or higher.
*
- * @param firstRecordId
- * @param maxRecords
- * @return
- * @throws java.io.IOException
+ * @param firstRecordId id of the first record to retrieve
+ * @param maxRecords maximum number of records to retrieve
+ * @return records
+ * @throws java.io.IOException if error reading from repository
*/
List getEvents(long firstRecordId, final int maxRecords) throws IOException;
/**
- * Returns the largest ID of any event that is queryable in the repository.
+ * @return the largest ID of any event that is queryable in the repository.
* If no queryable events exists, returns null
- *
- * @return
*/
Long getMaxEventId();
@@ -94,19 +93,18 @@ public interface ProvenanceEventRepository {
* Submits an asynchronous request to process the given query, returning an
* identifier that can be used to fetch the results at a later time
*
- * @param query
- * @return
+ * @param query to submit
+ * @return an identifier that can be used to fetch the results at a later
+ * time
*/
QuerySubmission submitQuery(Query query);
/**
- * Returns the QueryResult associated with the given identifier, if the
+ * @param queryIdentifier of the query
+ *
+ * @return the QueryResult associated with the given identifier, if the
* query has finished processing. If the query has not yet finished running,
- * returns null.
- *
- * @param queryIdentifier
- *
- * @return
+ * returns null
*/
QuerySubmission retrieveQuerySubmission(String queryIdentifier);
@@ -123,21 +121,17 @@ public interface ProvenanceEventRepository {
ComputeLineageSubmission submitLineageComputation(String flowFileUuid);
/**
- * Returns the {@link ComputeLineageSubmission} associated with the given
+ * @param lineageIdentifier identifier of lineage to compute
+ * @return the {@link ComputeLineageSubmission} associated with the given
* identifier
- *
- * @param lineageIdentifier
- * @return
*/
ComputeLineageSubmission retrieveLineageSubmission(String lineageIdentifier);
/**
- * Returns the Provenance Event Record with the given ID, if it exists, or
+ * @param id to lookup
+ * @return the Provenance Event Record with the given ID, if it exists, or
* {@code null} otherwise
- *
- * @param id
- * @return
- * @throws IOException
+ * @throws IOException if failure while retrieving event
*/
ProvenanceEventRecord getEvent(long id) throws IOException;
@@ -145,7 +139,7 @@ public interface ProvenanceEventRepository {
* Submits a request to expand the parents of the event with the given id
*
* @param eventId the one-up id of the Event to expand
- * @return
+ * @return a submission which can be checked for status
*
* @throws IllegalArgumentException if the given identifier identifies a
* Provenance Event that has a Type that is not expandable or if the
@@ -157,7 +151,7 @@ public interface ProvenanceEventRepository {
* Submits a request to expand the children of the event with the given id
*
* @param eventId the one-up id of the Event
- * @return
+ * @return a submission which can be checked for status
*
* @throws IllegalArgumentException if the given identifier identifies a
* Provenance Event that has a Type that is not expandable or if the
@@ -168,23 +162,19 @@ public interface ProvenanceEventRepository {
/**
* Closes the repository, freeing any resources
*
- * @throws IOException
+ * @throws IOException if failure closing repository
*/
void close() throws IOException;
/**
- * Returns a list of all fields that can be searched via the
+ * @return a list of all fields that can be searched via the
* {@link #submitQuery(nifi.provenance.search.Query)} method
- *
- * @return
*/
List getSearchableFields();
/**
- * Returns a list of all FlowFile attributes that can be searched via the
+ * @return a list of all FlowFile attributes that can be searched via the
* {@link #submitQuery(nifi.provenance.search.Query)} method
- *
- * @return
*/
List getSearchableAttributes();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageResult.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageResult.java
index c2d55132ab..e754ff7d1a 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageResult.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageResult.java
@@ -25,46 +25,34 @@ import java.util.List;
public interface ComputeLineageResult {
/**
- * Returns all nodes for the graph
- *
- * @return
+ * @return all nodes for the graph
*/
public List getNodes();
/**
- * Returns all links for the graph
- *
- * @return
+ * @return all links for the graph
*/
public List getEdges();
/**
- * Returns the date at which this AsynchronousLineageResult will expire
- *
- * @return
+ * @return the date at which this AsynchronousLineageResult will expire
*/
Date getExpiration();
/**
- * If an error occurred while computing the lineage, this will return the
- * serialized error; otherwise, returns null.
- *
- * @return
+ * @return If an error occurred while computing the lineage, this will return the
+ * serialized error; otherwise, returns null
*/
String getError();
/**
- * returns an integer between 0 and 100 (inclusive) that indicates what
+ * @return an integer between 0 and 100 (inclusive) that indicates what
* percentage of completion the computation has reached
- *
- * @return
*/
int getPercentComplete();
/**
- * Indicates whether or not the lineage has finished running
- *
- * @return
+ * @return Indicates whether or not the lineage has finished running
*/
boolean isFinished();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
index fbbff105e3..a9df26cea1 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/ComputeLineageSubmission.java
@@ -22,25 +22,19 @@ import java.util.Date;
public interface ComputeLineageSubmission {
/**
- * Returns the {@link ComputeLineageResult} that contains the results. The
+ * @return the {@link ComputeLineageResult} that contains the results. The
* results may be partial if a call to
- * {@link ComputeLineageResult#isFinished()} returns false.
- *
- * @return
+ * {@link ComputeLineageResult#isFinished()} returns false
*/
ComputeLineageResult getResult();
/**
- * Returns the date at which this lineage was submitted
- *
- * @return
+ * @return the date at which this lineage was submitted
*/
Date getSubmissionTime();
/**
- * Returns the generated identifier for this lineage result
- *
- * @return
+ * @return the generated identifier for this lineage result
*/
String getLineageIdentifier();
@@ -56,27 +50,21 @@ public interface ComputeLineageSubmission {
boolean isCanceled();
/**
- * Returns the type of Lineage Computation that was submitted
- *
- * @return
+ * @return the type of Lineage Computation that was submitted
*/
LineageComputationType getLineageComputationType();
/**
- * If the Lineage Computation Type of this submission is
+ * @return If the Lineage Computation Type of this submission is
* {@link LineageComputationType.EXPAND_CHILDREN} or
* {@link LineageComputationType.EXPAND_PARENTS}, indicates the ID event
- * that is to be expanded; otherwise, returns null.
- *
- * @return
+ * that is to be expanded; otherwise, returns null
*/
Long getExpandedEventId();
/**
- * Returns all FlowFile UUID's that are encapsulated in this lineage
+ * @return all FlowFile UUID's that are encapsulated in this lineage
* computation submission
- *
- * @return
*/
Collection getLineageFlowFileUuids();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/Lineage.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/Lineage.java
index 252968c0e8..ff5fee7c44 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/Lineage.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/Lineage.java
@@ -25,16 +25,12 @@ import java.util.List;
public interface Lineage {
/**
- * Returns all nodes for the graph
- *
- * @return
+ * @return all nodes for the graph
*/
public List getNodes();
/**
- * Returns all links for the graph
- *
- * @return
+ * @return all links for the graph
*/
public List getEdges();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/LineageNode.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/LineageNode.java
index 84e3546e39..c50cdf5840 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/LineageNode.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/lineage/LineageNode.java
@@ -19,43 +19,33 @@ package org.apache.nifi.provenance.lineage;
public interface LineageNode {
/**
- * Returns the identifier of the Clustered NiFi Node that generated the
+ * @return the identifier of the Clustered NiFi Node that generated the
* event
- *
- * @return
*/
String getClusterNodeIdentifier();
/**
- * Returns the type of the LineageNode
- *
- * @return
+ * @return the type of the LineageNode
*/
LineageNodeType getNodeType();
/**
- * Returns the UUID of the FlowFile for which this Node was created
- *
- * @return
+ * @return the UUID of the FlowFile for which this Node was created
*/
String getFlowFileUuid();
/**
- * Returns the UUID for this LineageNode.
- *
- * @return
+ * @return the UUID for this LineageNode
*/
String getIdentifier();
/**
- * Returns the timestamp that corresponds to this Node. The meaning of the
+ * @return the timestamp that corresponds to this Node. The meaning of the
* timestamp may differ between implementations. For example, a
* {@link ProvenanceEventLineageNode}'s timestamp indicates the time at
* which the event occurred. However, for a Node that reperesents a
* FlowFile, for example, the timestamp may represent the time at which the
- * FlowFile was created.
- *
- * @return
+ * FlowFile was created
*/
long getTimestamp();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/Query.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/Query.java
index a319e36465..3519c1468a 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/Query.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/Query.java
@@ -16,7 +16,12 @@
*/
package org.apache.nifi.provenance.search;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
public class Query {
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QueryResult.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QueryResult.java
index 3dd0b71297..0079433ec5 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QueryResult.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QueryResult.java
@@ -24,54 +24,40 @@ import org.apache.nifi.provenance.ProvenanceEventRecord;
public interface QueryResult {
/**
- * Returns the Provenance events that match the query (up to the limit
+ * @return the Provenance events that match the query (up to the limit
* specified in the query)
- *
- * @return
*/
List getMatchingEvents();
/**
- * Returns the total number of Provenance Events that hit
- *
- * @return
+ * @return the total number of Provenance Events that hit
*/
long getTotalHitCount();
/**
- * Returns the number of milliseconds the query took to run
- *
- * @return
+ * @return the number of milliseconds the query took to run
*/
long getQueryTime();
/**
- * Returns the date at which this QueryResult will expire
- *
- * @return
+ * @return the date at which this QueryResult will expire
*/
Date getExpiration();
/**
- * If an error occurred while computing the lineage, this will return the
- * serialized error; otherwise, returns null.
- *
- * @return
+ * @return If an error occurred while computing the lineage, this will return the
+ * serialized error; otherwise, returns null
*/
String getError();
/**
- * returns an integer between 0 and 100 (inclusive) that indicates what
+ * @return an integer between 0 and 100 (inclusive) that indicates what
* percentage of completion the query has reached
- *
- * @return
*/
int getPercentComplete();
/**
- * Indicates whether or not the query has finished running
- *
- * @return
+ * @return Indicates whether or not the query has finished running
*/
boolean isFinished();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QuerySubmission.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QuerySubmission.java
index 6c3e1ad81f..4716d2d4e2 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QuerySubmission.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/QuerySubmission.java
@@ -21,32 +21,24 @@ import java.util.Date;
public interface QuerySubmission {
/**
- * Returns the query that this submission pertains to
- *
- * @return
+ * @return the query that this submission pertains to
*/
Query getQuery();
/**
- * Returns the {@link QueryResult} for this query. Note that the result is
+ * @return the {@link QueryResult} for this query. Note that the result is
* only a partial result if the result of calling
- * {@link QueryResult#isFinished()} is false.
- *
- * @return
+ * {@link QueryResult#isFinished()} is false
*/
QueryResult getResult();
/**
- * Returns the date at which this query was submitted
- *
- * @return
+ * @return the date at which this query was submitted
*/
Date getSubmissionTime();
/**
- * Returns the generated identifier for this query result
- *
- * @return
+ * @return the generated identifier for this query result
*/
String getQueryIdentifier();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/SearchableField.java b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/SearchableField.java
index fa3bfe33db..85c6154892 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/SearchableField.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/provenance/search/SearchableField.java
@@ -23,40 +23,30 @@ package org.apache.nifi.provenance.search;
public interface SearchableField {
/**
- * Returns the identifier that is used to refer to this field
- *
- * @return
+ * @return the identifier that is used to refer to this field
*/
String getIdentifier();
/**
- * Returns the name of the field that is used when searching the repository.
- *
- * @return
+ * @return the name of the field that is used when searching the repository
*/
String getSearchableFieldName();
/**
- * Returns the "friendly" name or "display name" of the field, which may be
+ * @return the "friendly" name or "display name" of the field, which may be
* more human-readable than the searchable field name
- *
- * @return
*/
String getFriendlyName();
/**
- * Returns the type of the data stored in this field
- *
- * @return
+ * @return the type of the data stored in this field
*/
SearchableFieldType getFieldType();
/**
- * Returns true if this field represents a FlowFile attribute,
+ * @return true if this field represents a FlowFile attribute,
* false if the field represents a Provenance Event detail,
* such as Source System URI
- *
- * @return
*/
boolean isAttribute();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/remote/RemoteDestination.java b/nifi/nifi-api/src/main/java/org/apache/nifi/remote/RemoteDestination.java
index 508ab37d40..c3a34b234e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/remote/RemoteDestination.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/remote/RemoteDestination.java
@@ -18,36 +18,33 @@ package org.apache.nifi.remote;
import java.util.concurrent.TimeUnit;
-
/**
- * A model object for referring to a remote destination (i.e., a Port) for site-to-site communications
+ * A model object for referring to a remote destination (i.e., a Port) for
+ * site-to-site communications
*/
public interface RemoteDestination {
+
/**
- * Returns the identifier of the remote destination
- *
- * @return
+ * @return the identifier of the remote destination
*/
- String getIdentifier();
+ String getIdentifier();
- /**
- * Returns the human-readable name of the remote destination
- * @return
- */
- String getName();
+ /**
+ * @return the human-readable name of the remote destination
+ */
+ String getName();
- /**
- * Returns the amount of time that system should pause sending to a particular node if unable to
- * send data to or receive data from this endpoint
- * @param timeUnit
- * @return
- */
- long getYieldPeriod(TimeUnit timeUnit);
-
- /**
- * Returns whether or not compression should be used when transferring data to or receiving
- * data from the remote endpoint
- * @return
- */
- boolean isUseCompression();
+ /**
+ * @param timeUnit to yield
+ * @return the amount of time that system should pause sending to a
+ * particular node if unable to send data to or receive data from this
+ * endpoint
+ */
+ long getYieldPeriod(TimeUnit timeUnit);
+
+ /**
+ * @return whether or not compression should be used when transferring data
+ * to or receiving data from the remote endpoint
+ */
+ boolean isUseCompression();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
index efcf2a3637..b5afe17a9f 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
@@ -43,19 +43,15 @@ public abstract class AbstractReportingTask extends AbstractConfigurableComponen
}
/**
- * Returns the {@link ControllerServiceLookup} that was passed to the
+ * @return the {@link ControllerServiceLookup} that was passed to the
* {@link #init(ProcessorInitializationContext)} method
- *
- * @return
*/
protected final ControllerServiceLookup getControllerServiceLookup() {
return serviceLookup;
}
/**
- * Returns the identifier of this Reporting Task
- *
- * @return
+ * @return the identifier of this Reporting Task
*/
@Override
public String getIdentifier() {
@@ -63,22 +59,18 @@ public abstract class AbstractReportingTask extends AbstractConfigurableComponen
}
/**
- * Returns the name of this Reporting Task
- *
- * @return
+ * @return the name of this Reporting Task
*/
protected String getName() {
return name;
}
/**
- * Returns the amount of times that elapses between the moment that this
+ * @param timeUnit of scheduling period
+ * @return the amount of times that elapses between the moment that this
* ReportingTask finishes its invocation of
* {@link #onTrigger(ReportingContext)} and the next time that
* {@link #onTrigger(ReportingContext)} is called.
- *
- * @param timeUnit
- * @return
*/
protected long getSchedulingPeriod(final TimeUnit timeUnit) {
return timeUnit.convert(schedulingNanos, TimeUnit.NANOSECONDS);
@@ -88,15 +80,15 @@ public abstract class AbstractReportingTask extends AbstractConfigurableComponen
* Provides a mechanism by which subclasses can perform initialization of
* the Reporting Task before it is scheduled to be run
*
- * @param config
- * @throws InitializationException
+ * @param config context
+ * @throws InitializationException if failure to init
*/
protected void init(final ReportingInitializationContext config) throws InitializationException {
}
/**
- * Returns the logger that has been provided to the component by the framework in its initialize method.
- * @return
+ * @return the logger that has been provided to the component by the
+ * framework in its initialize method
*/
protected ComponentLog getLogger() {
return logger;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/BulletinRepository.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/BulletinRepository.java
index 4d32d40e66..2679099211 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/BulletinRepository.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/BulletinRepository.java
@@ -28,61 +28,55 @@ public interface BulletinRepository {
/**
* Adds a Bulletin to the repository.
*
- * @param bulletin
+ * @param bulletin to add
*/
void addBulletin(Bulletin bulletin);
/**
- * Returns the capacity for the number of bulletins for the controller.
- *
- * @return
+ * @return the capacity for the number of bulletins for the controller
*/
int getControllerBulletinCapacity();
/**
- * Returns the capacity for the number of bulletins per component.
- *
- * @return
+ * @return the capacity for the number of bulletins per component
*/
int getComponentBulletinCapacity();
/**
* Finds Bulletin's that meet the specified query.
*
- * @param bulletinQuery
- * @return
+ * @param bulletinQuery indicates which bulletins are of interest
+ * @return bulletins that met the query
*/
List findBulletins(BulletinQuery bulletinQuery);
/**
* Finds all bulletins for the specified group.
*
- * @param groupId
- * @return
+ * @param groupId id of the group
+ * @return bulletins for the given group
*/
List findBulletinsForGroupBySource(String groupId);
/**
* Finds all bulletins for the specified group.
*
- * @param groupId
- * @param maxPerComponent
- * @return
+ * @param groupId id of the group
+ * @param maxPerComponent max responses wanted
+ * @return bulletins found
*/
List findBulletinsForGroupBySource(String groupId, int maxPerComponent);
/**
- * Finds all bulletins for the controller;
- *
- * @return
+ * @return all bulletins for the controller
*/
List findBulletinsForController();
/**
* Finds all bulletins for the controller;
*
- * @param max
- * @return
+ * @param max limits the number of responses
+ * @return all bulletins for the controller
*/
List findBulletinsForController(int max);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/EventAccess.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/EventAccess.java
index f043efd3ca..bdc23c2635 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/EventAccess.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/EventAccess.java
@@ -26,9 +26,7 @@ import java.util.List;
public interface EventAccess {
/**
- * Gets the status for all components in this Controller.
- *
- * @return
+ * @return the status for all components in this Controller
*/
ProcessGroupStatus getControllerStatus();
@@ -39,15 +37,13 @@ public interface EventAccess {
*
* @param firstEventId the ID of the first event to obtain
* @param maxRecords the maximum number of records to obtain
- * @return
- * @throws java.io.IOException
+ * @return event records matching query
+ * @throws java.io.IOException if unable to get records
*/
List getProvenanceEvents(long firstEventId, final int maxRecords) throws IOException;
/**
- * Returns the Provenance Event Repository
- *
- * @return
+ * @return the Provenance Event Repository
*/
ProvenanceEventRepository getProvenanceRepository();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingContext.java
index ad4090c7cb..281194c7b5 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingContext.java
@@ -31,37 +31,29 @@ import org.apache.nifi.controller.ControllerServiceLookup;
public interface ReportingContext {
/**
- * Returns a Map of all known {@link PropertyDescriptor}s to their
+ * @return a Map of all known {@link PropertyDescriptor}s to their
* configured properties. This Map will contain a null for any
* Property that has not been configured by the user, even if the
- * PropertyDescriptor has a default value.
- *
- * @return
+ * PropertyDescriptor has a default value
*/
Map getProperties();
/**
- * A PropertyValue that represents the user-configured value for the given
- * {@link PropertyDescriptor}.
- *
- * @param propertyName
- * @return
+ * @param propertyName descriptor of property to lookup the value of
+ * @return PropertyValue that represents the user-configured value for the given
+ * {@link PropertyDescriptor}
*/
PropertyValue getProperty(PropertyDescriptor propertyName);
/**
- * Returns the {@link EventAccess} object that can be used to obtain
+ * @return the {@link EventAccess} object that can be used to obtain
* information about specific events and reports that have happened
- *
- * @return
*/
EventAccess getEventAccess();
/**
- * Returns the {@link BulletinRepository} that can be used to analyze
+ * @return the {@link BulletinRepository} that can be used to analyze
* Bulletins that have been emitted and register new Bulletins
- *
- * @return
*/
BulletinRepository getBulletinRepository();
@@ -70,10 +62,10 @@ public interface ReportingContext {
* level, and message, so that the Bulletin can be added to the
* {@link BulletinRepository}.
*
- * @param category
- * @param severity
- * @param message
- * @return
+ * @param category of bulletin
+ * @param severity of bulletin
+ * @param message of bulletin
+ * @return new bulletin
*/
Bulletin createBulletin(String category, Severity severity, String message);
@@ -85,15 +77,13 @@ public interface ReportingContext {
* @param category the name of the bulletin's category
* @param severity the severity level of the bulletin
* @param message the bulletin's message
- * @return
+ * @return new bulletin
*/
Bulletin createBulletin(String componentId, String category, Severity severity, String message);
/**
- * Returns the {@link ControllerServiceLookup} which can be used to obtain
+ * @return the {@link ControllerServiceLookup} which can be used to obtain
* Controller Services
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingInitializationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingInitializationContext.java
index 6b84589d75..d014b26023 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingInitializationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingInitializationContext.java
@@ -29,16 +29,12 @@ import org.apache.nifi.scheduling.SchedulingStrategy;
public interface ReportingInitializationContext {
/**
- * Returns the identifier for this ReportingTask
- *
- * @return
+ * @return the identifier for this ReportingTask
*/
String getIdentifier();
/**
- * Returns the configured name for this ReportingTask
- *
- * @return
+ * @return the configured name for this ReportingTask
*/
String getName();
@@ -51,40 +47,31 @@ public interface ReportingInitializationContext {
* -1L if the Scheduling Strategy is not set to
* {@link SchedulingStrategy#TIMER_DRIVEN}
*
- * @param timeUnit
- * @return
+ * @param timeUnit unit of time for scheduling
+ * @return period of time
*/
long getSchedulingPeriod(TimeUnit timeUnit);
/**
- * Returns the {@link ControllerServiceLookup} which can be used to obtain
+ * @return the {@link ControllerServiceLookup} which can be used to obtain
* Controller Services
- *
- * @return
*/
ControllerServiceLookup getControllerServiceLookup();
/**
- * Returns a String representation of the scheduling period.
- *
- * @return
+ * @return a String representation of the scheduling period
*/
String getSchedulingPeriod();
/**
- * Returns the {@link SchedulingStrategy} that is used to trigger the task
+ * @return the {@link SchedulingStrategy} that is used to trigger the task
* to run
- *
- * @return
*/
SchedulingStrategy getSchedulingStrategy();
-
-
+
/**
- * Returns a logger that can be used to log important events in a standard way and generate
- * bulletins when appropriate
- *
- * @return
+ * @return a logger that can be used to log important events in a standard
+ * way and generate bulletins when appropriate
*/
ComponentLog getLogger();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingTask.java b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingTask.java
index 3f777969da..3de9b9386b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingTask.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/reporting/ReportingTask.java
@@ -60,8 +60,8 @@ public interface ReportingTask extends ConfigurableComponent {
* Provides the Reporting Task with access to objects that may be of use
* throughout the life of the service
*
- * @param config
- * @throws org.apache.nifi.reporting.InitializationException
+ * @param config of initialization context
+ * @throws org.apache.nifi.reporting.InitializationException if unable to init
*/
void initialize(ReportingInitializationContext config) throws InitializationException;
@@ -69,7 +69,7 @@ public interface ReportingTask extends ConfigurableComponent {
* This method is called on a scheduled interval to allow the Reporting Task
* to perform its tasks.
*
- * @param context
+ * @param context reporting context
*/
void onTrigger(ReportingContext context);
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchContext.java
index 77865bf4dd..1da8c90754 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchContext.java
@@ -26,32 +26,24 @@ import org.apache.nifi.components.PropertyValue;
public interface SearchContext {
/**
- * Gets the search term.
- *
- * @return
+ * @return the search term
*/
String getSearchTerm();
/**
- * Gets the annotation data.
- *
- * @return
+ * @return the annotation data
*/
String getAnnotationData();
/**
- * Returns a PropertyValue that encapsulates the value configured for the
+ * @param property to get value of
+ * @return a PropertyValue that encapsulates the value configured for the
* given PropertyDescriptor
- *
- * @param property
- * @return
*/
PropertyValue getProperty(PropertyDescriptor property);
/**
- * Returns a Map of all configured Properties.
- *
- * @return
+ * @return a Map of all configured Properties
*/
Map getProperties();
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchResult.java b/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchResult.java
index 7ed7d829e9..29e490a5a6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchResult.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/search/SearchResult.java
@@ -30,18 +30,14 @@ public class SearchResult {
}
/**
- * Get the label for this search result.
- *
- * @return
+ * @return the label for this search result
*/
public String getLabel() {
return label;
}
/**
- * Get the matching string for this search result.
- *
- * @return
+ * @return the matching string for this search result
*/
public String getMatch() {
return match;
@@ -55,8 +51,8 @@ public class SearchResult {
/**
* Set the label for the search result.
*
- * @param label
- * @return
+ * @param label to set
+ * @return the builder
*/
public Builder label(final String label) {
this.label = label;
@@ -66,8 +62,8 @@ public class SearchResult {
/**
* Set the matching string for the search result.
*
- * @param match
- * @return
+ * @param match string
+ * @return the builder
*/
public Builder match(final String match) {
this.match = match;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java
index 0b68ed95ac..5614fc2e40 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java
@@ -20,7 +20,8 @@ import java.util.Collection;
import java.util.Map;
/**
- * Details about a given component. Contains configuration and current validation errors.
+ * Details about a given component. Contains configuration and current
+ * validation errors.
*/
public class ComponentDetails {
@@ -43,63 +44,49 @@ public class ComponentDetails {
}
/**
- * The component id.
- *
- * @return
+ * @return component id
*/
public String getId() {
return id;
}
/**
- * The component name.
- *
- * @return
+ * @return component name
*/
public String getName() {
return name;
}
/**
- * The component type.
- *
- * @return
+ * @return component type
*/
public String getType() {
return type;
}
-
+
/**
- * The component state.
- *
- * @return
+ * @return component state
*/
public String getState() {
return state;
}
/**
- * The component's annotation data.
- *
- * @return
+ * @return component's annotation data
*/
public String getAnnotationData() {
return annotationData;
}
/**
- * Mapping of component properties.
- *
- * @return
+ * @return Mapping of component properties
*/
public Map getProperties() {
return properties;
}
/**
- * Current validation errors for the component.
- *
- * @return
+ * @return Current validation errors for the component
*/
public Collection getValidationErrors() {
return validationErrors;
@@ -124,7 +111,7 @@ public class ComponentDetails {
this.name = name;
return this;
}
-
+
public Builder type(final String type) {
this.type = type;
return this;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ConfigurationAction.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ConfigurationAction.java
index 066e77254c..96f2abf0a6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ConfigurationAction.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ConfigurationAction.java
@@ -38,54 +38,42 @@ public class ConfigurationAction {
}
/**
- * The id of the component being modified.
- *
- * @return
+ * @return id of the component being modified
*/
public String getId() {
return id;
}
/**
- * The name of the component being modified.
- *
- * @return
+ * @return name of the component being modified
*/
public String getName() {
return name;
}
/**
- * The type of the component being modified.
- *
- * @return
+ * @return type of the component being modified
*/
public String getType() {
return type;
}
/**
- * Gets the name of the field, property, etc that has been modified.
- *
- * @return
+ * @return the name of the field, property, etc that has been modified
*/
public String getField() {
return field;
}
/**
- * Gets the previous value.
- *
- * @return
+ * @return the previous value
*/
public String getPreviousValue() {
return previousValue;
}
/**
- * Gets the new value.
- *
- * @return
+ * @return the new value
*/
public String getValue() {
return value;
@@ -104,17 +92,17 @@ public class ConfigurationAction {
this.id = id;
return this;
}
-
+
public Builder name(final String name) {
this.name = name;
return this;
}
-
+
public Builder type(final String type) {
this.type = type;
return this;
}
-
+
public Builder field(final String field) {
this.field = field;
return this;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java
index 50f0ca30f3..ae32b10490 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java
@@ -25,15 +25,13 @@ import org.apache.nifi.controller.ControllerService;
* component custom UIs.
*/
public interface NiFiWebConfigurationContext {
-
+
/**
- * Gets the ControllerService for the specified identifier. If a
+ * @param serviceIdentifier of the controller service
+ * @return the ControllerService for the specified identifier. If a
* corresponding service cannot be found, null is returned. If this NiFi is
- * clustered, the only services available will be those those
- * availability is NCM only.
- *
- * @param serviceIdentifier
- * @return
+ * clustered, the only services available will be those those availability
+ * is NCM only
*/
ControllerService getControllerService(String serviceIdentifier);
@@ -48,55 +46,55 @@ public interface NiFiWebConfigurationContext {
* been applied to the flow, we cannot revert them because of a failure to
* insert an audit record.
*
- * @param requestContext
- * @param actions
- * @throws IllegalArgumentException When the requestContext isn't fully populated or
- * isn't appropriate for the given request
+ * @param requestContext context of the request
+ * @param actions to save
+ * @throws IllegalArgumentException When the requestContext isn't fully
+ * populated or isn't appropriate for the given request
*/
void saveActions(NiFiWebRequestContext requestContext, Collection actions);
/**
- * Gets the current user dn. Returns null if no user is found.
- *
- * @return
+ * @return the current user dn. Returns null if no user is found
*/
String getCurrentUserDn();
/**
- * Gets the current user name. Returns null if no user is found.
- *
- * @return
+ * @return the current user name. Returns null if no user is found
*/
String getCurrentUserName();
/**
* Sets the annotation data for the underlying component.
- *
- * @param configurationContext
- * @param annotationData
+ *
+ * @param configurationContext config context
+ * @param annotationData the data
* @return the configuration for the underlying component
- * @throws ResourceNotFoundException if the underlying component does not exit
+ * @throws ResourceNotFoundException if the underlying component does not
+ * exit
* @throws InvalidRevisionException if a revision other than the current
* revision is given
* @throws ClusterRequestException if the annotation data was unable to be
- * set for the underlying component. This exception will only be thrown when operating
- * in a cluster.
- * @throws IllegalArgumentException When the requestContext isn't fully populated or
- * isn't appropriate for the given request
- */
- ComponentDetails setAnnotationData(NiFiWebConfigurationRequestContext configurationContext, String annotationData) throws ResourceNotFoundException, InvalidRevisionException, ClusterRequestException;
-
- /**
- * Gets the details for the underlying component (including configuration, validation errors, and annotation data).
- *
- * @param requestContext
- * @return the configuration for the underlying component
- * @throws ResourceNotFoundException if the underlying component does not exit
- * @throws ClusterRequestException if the underlying component was unable to be
- * retrieved from the cluster. This exception will only be thrown when
+ * set for the underlying component. This exception will only be thrown when
* operating in a cluster.
- * @throws IllegalArgumentException When the requestContext isn't fully populated or
- * isn't appropriate for the given request
+ * @throws IllegalArgumentException When the requestContext isn't fully
+ * populated or isn't appropriate for the given request
+ */
+ ComponentDetails setAnnotationData(NiFiWebConfigurationRequestContext configurationContext, String annotationData)
+ throws ResourceNotFoundException, InvalidRevisionException, ClusterRequestException;
+
+ /**
+ * Gets the details for the underlying component (including configuration,
+ * validation errors, and annotation data).
+ *
+ * @param requestContext context of request
+ * @return the configuration for the underlying component
+ * @throws ResourceNotFoundException if the underlying component does not
+ * exit
+ * @throws ClusterRequestException if the underlying component was unable to
+ * be retrieved from the cluster. This exception will only be thrown when
+ * operating in a cluster.
+ * @throws IllegalArgumentException When the requestContext isn't fully
+ * populated or isn't appropriate for the given request
*/
ComponentDetails getComponentDetails(NiFiWebRequestContext requestContext) throws ResourceNotFoundException, ClusterRequestException;
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationRequestContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationRequestContext.java
index 791224122a..c75d9dc731 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationRequestContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationRequestContext.java
@@ -17,13 +17,14 @@
package org.apache.nifi.web;
/**
- * Contextual details required to make a configuration request from a UI extension.
+ * Contextual details required to make a configuration request from a UI
+ * extension.
*/
public interface NiFiWebConfigurationRequestContext extends NiFiWebRequestContext {
/**
* The revision to include in the request.
- *
+ *
* @return the revision
*/
Revision getRevision();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebContext.java
index 01702addf8..55e90e867e 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebContext.java
@@ -28,12 +28,10 @@ import org.apache.nifi.controller.ControllerService;
public interface NiFiWebContext {
/**
- * Gets the ControllerService for the specified identifier. If a
+ * @param serviceIdentifier identifier of the service
+ * @return the ControllerService for the specified identifier. If a
* corresponding service cannot be found, null is returned. If this NiFi is
- * clustered, the ControllerService is loaded from the NCM.
- *
- * @param serviceIdentifier
- * @return
+ * clustered, the ControllerService is loaded from the NCM
*/
ControllerService getControllerService(String serviceIdentifier);
@@ -48,21 +46,17 @@ public interface NiFiWebContext {
* been applied to the flow, we cannot revert them because of a failure to
* insert an audit record.
*
- * @param actions
+ * @param actions to save
*/
void saveActions(Collection actions);
/**
- * Gets the current user dn. Returns null if no user is found.
- *
- * @return
+ * @return the current user dn. Returns null if no user is found
*/
String getCurrentUserDn();
/**
- * Gets the current user name. Returns null if no user is found.
- *
- * @return
+ * @return the current user name. Returns null if no user is found
*/
String getCurrentUserName();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
index ac38221ae1..9dd44abf50 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
@@ -22,12 +22,10 @@ package org.apache.nifi.web;
public interface NiFiWebRequestContext {
/**
- * Returns the type of UI extension is making the request.
- *
- * @return
+ * @return the type of UI extension is making the request
*/
UiExtensionType getExtensionType();
-
+
/**
* The request protocol scheme (http or https). When scheme is https, the
* X509Certificate can be used for subsequent remote requests.
@@ -38,7 +36,7 @@ public interface NiFiWebRequestContext {
/**
* The id of the component.
- *
+ *
* @return the ID
*/
String getId();
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ProcessorConfigurationAction.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ProcessorConfigurationAction.java
index ce5e069d30..f42063fd32 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ProcessorConfigurationAction.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ProcessorConfigurationAction.java
@@ -39,54 +39,42 @@ public class ProcessorConfigurationAction {
}
/**
- * Gets the id of the processor.
- *
- * @return
+ * @return the id of the processor
*/
public String getProcessorId() {
return processorId;
}
/**
- * Gets the name of the processor being modified.
- *
- * @return
+ * @return the name of the processor being modified
*/
public String getProcessorName() {
return processorName;
}
/**
- * Gets the type of the processor being modified.
- *
- * @return
+ * @return the type of the processor being modified
*/
public String getProcessorType() {
return processorType;
}
/**
- * Gets the name of the field, property, etc that has been modified.
- *
- * @return
+ * @return the name of the field, property, etc that has been modified.
*/
public String getName() {
return name;
}
/**
- * Gets the previous value.
- *
- * @return
+ * @return the previous value
*/
public String getPreviousValue() {
return previousValue;
}
/**
- * Gets the new value.
- *
- * @return
+ * @return the new value
*/
public String getValue() {
return value;
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/Revision.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
index 8a6275e1c5..6fcdcaf51b 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
@@ -37,12 +37,12 @@ public class Revision implements Serializable {
* the client ID
*/
private final String clientId;
-
+
public Revision(Long revision, String clientId) {
this.version = revision;
this.clientId = clientId;
}
-
+
public String getClientId() {
return clientId;
}
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
index 0bbda16d66..e3b0f8a217 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
@@ -17,13 +17,14 @@
package org.apache.nifi.web;
/**
- * Types of UI extensions. Since a UI extension could support multiple
- * types of custom UIs it will need to include the type so the framework
- * can appropriate understand and process the request (recording actions
- * in the audit database, replicating a request throughout the cluster to
- * the appropriate endpoints, etc).
+ * Types of UI extensions. Since a UI extension could support multiple types of
+ * custom UIs it will need to include the type so the framework can appropriate
+ * understand and process the request (recording actions in the audit database,
+ * replicating a request throughout the cluster to the appropriate endpoints,
+ * etc).
*/
public enum UiExtensionType {
+
ContentViewer,
ProcessorConfiguration,
ControllerServiceConfiguration,
diff --git a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
index f90221e97f..180385e2f6 100644
--- a/nifi/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
+++ b/nifi/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
@@ -25,50 +25,41 @@ import java.io.InputStream;
public interface ViewableContent {
public static final String CONTENT_REQUEST_ATTRIBUTE = "org.apache.nifi.web.content";
-
+
public enum DisplayMode {
+
Original,
Formatted,
Hex;
}
-
+
/**
- * The stream to the viewable content. The data stream can only be read once so
- * an extension can call this method or getContent.
- *
- * @return
+ * @return stream to the viewable content. The data stream can only be read once
+ * so an extension can call this method or getContent
*/
InputStream getContentStream();
/**
- * Gets the content as a string. The data stream can only be read once so
- * an extension can call this method or getContentStream.
- *
- * @return
- * @throws java.io.IOException
+ * @return the content as a string. The data stream can only be read once so an
+ * extension can call this method or getContentStream
+ * @throws java.io.IOException if unable to read content
*/
String getContent() throws IOException;
-
+
/**
- * Returns the desired play mode. If the mode is Hex the
- * framework will handle generating the mark up. The only
- * values that an extension will see is Original or Formatted.
- *
- * @return
+ * @return the desired display mode. If the mode is Hex the framework will
+ * handle generating the mark up. The only values that an extension will see
+ * is Original or Formatted
*/
DisplayMode getDisplayMode();
-
+
/**
- * The contents file name.
- *
- * @return
+ * @return contents file name
*/
String getFileName();
-
+
/**
- * The mime type of the content.
- *
- * @return
+ * @return mime type of the content
*/
String getContentType();
}
diff --git a/nifi/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java b/nifi/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
index 82b8111089..e3043be6c9 100644
--- a/nifi/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
+++ b/nifi/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
@@ -24,34 +24,34 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-
/**
- * Regression test for issue NIFI-49, to ensure that if a Processor's Property's Default Value is not allowed,
- * the Exception thrown should indicate what the default value is
+ * Regression test for issue NIFI-49, to ensure that if a Processor's Property's
+ * Default Value is not allowed, the Exception thrown should indicate what the
+ * default value is
*/
public class TestPropertyDescriptor {
private static Builder invalidDescriptorBuilder;
private static Builder validDescriptorBuilder;
private static String DEFAULT_VALUE = "Default Value";
-
+
@Rule
public ExpectedException thrown = ExpectedException.none();
-
+
@BeforeClass
public static void setUp() {
validDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue("Allowable Value");
invalidDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue(DEFAULT_VALUE);
}
-
+
@Test
public void testExceptionThrownByDescriptorWithInvalidDefaultValue() {
thrown.expect(IllegalStateException.class);
- thrown.expectMessage("["+ DEFAULT_VALUE +"]");
-
+ thrown.expectMessage("[" + DEFAULT_VALUE + "]");
+
invalidDescriptorBuilder.build();
}
-
+
@Test
public void testNoExceptionThrownByPropertyDescriptorWithValidDefaultValue() {
assertNotNull(validDescriptorBuilder.build());
diff --git a/nifi/nifi-assembly/LICENSE b/nifi/nifi-assembly/LICENSE
index 38386b9a81..ec360de10b 100644
--- a/nifi/nifi-assembly/LICENSE
+++ b/nifi/nifi-assembly/LICENSE
@@ -455,6 +455,28 @@ This product bundles 'json2.js' which is available in the 'public domain'.
This product bundles 'reset.css' which is available in the 'public domain'.
For details see http://meyerweb.com/eric/tools/css/reset/
+This product bundles HexViewJS available under an MIT License
+
+ Copyright (c) 2010 Nick McVeity
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The binary distribution of this product bundles 'Slf4j' which is available
under a "3-clause BSD" license. For details see http://www.slf4j.org/
diff --git a/nifi/nifi-assembly/NOTICE b/nifi/nifi-assembly/NOTICE
index f14c662257..73780db347 100644
--- a/nifi/nifi-assembly/NOTICE
+++ b/nifi/nifi-assembly/NOTICE
@@ -511,44 +511,31 @@ The following binary components are provided under the Apache Software License v
The following NOTICE information applies:
JOAuth
Copyright 2010-2013 Twitter, Inc
-
- Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
(ASLv2) Hosebird Client
The following NOTICE information applies:
Hosebird Client (hbc)
Copyright 2013 Twitter, Inc.
- Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
-
(ASLv2) GeoIP2 Java API
The following NOTICE information applies:
GeoIP2 Java API
This software is Copyright (c) 2013 by MaxMind, Inc.
- This is free software, licensed under the Apache License, Version 2.0.
-
- (ASLv2) Google HTTP Client Library for Java
- The following NOTICE information applies:
- Google HTTP Client Library for Java
-
- This is free software, licensed under the Apache License, Version 2.0.
-
(ASLv2) Amazon Web Services SDK
The following NOTICE information applies:
- Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- This product includes software developed by
- Amazon Technologies, Inc (http://www.amazon.com/).
-
- **********************
- THIRD PARTY COMPONENTS
- **********************
- This software includes third party software subject to the following copyrights:
- - XML parsing and utility functions from JetS3t - Copyright 2006-2009 James Murty.
- - JSON parsing and utility functions from JSON.org - Copyright 2002 JSON.org.
- - PKCS#1 PEM encoded private key parsing and utility functions from oauth.googlecode.com - Copyright 1998-2010 AOL Inc.
+ This product includes software developed by
+ Amazon Technologies, Inc (http://www.amazon.com/).
+ **********************
+ THIRD PARTY COMPONENTS
+ **********************
+ This software includes third party software subject to the following copyrights:
+ - XML parsing and utility functions from JetS3t - Copyright 2006-2009 James Murty.
+ - JSON parsing and utility functions from JSON.org - Copyright 2002 JSON.org.
+ - PKCS#1 PEM encoded private key parsing and utility functions from oauth.googlecode.com - Copyright 1998-2010 AOL Inc.
************************
Common Development and Distribution License 1.1
diff --git a/nifi/nifi-assembly/pom.xml b/nifi/nifi-assembly/pom.xml
index 260614cf88..0cc076a6a4 100644
--- a/nifi/nifi-assembly/pom.xml
+++ b/nifi/nifi-assembly/pom.xml
@@ -1,489 +1,490 @@
+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. -->
- 4.0.0
-
- org.apache.nifi
- nifi
- 0.1.0-incubating-SNAPSHOT
-
- nifi-assembly
- pom
- This is the assembly Apache NiFi (incubating)
-
-
-
- maven-assembly-plugin
-
- nifi-${project.version}
- false
-
-
-
- make shared resource
-
- single
-
- package
-
-
- src/main/assembly/dependencies.xml
-
- posix
-
-
-
-
-
-
-
-
- ch.qos.logback
- logback-classic
- compile
-
-
- org.slf4j
- jcl-over-slf4j
- compile
-
-
- org.slf4j
- jul-to-slf4j
- compile
-
-
- org.slf4j
- log4j-over-slf4j
- compile
-
-
- org.slf4j
- slf4j-api
- compile
-
-
- org.apache.nifi
- nifi-api
-
-
- org.apache.nifi
- nifi-runtime
-
-
- org.apache.nifi
- nifi-bootstrap
-
-
- org.apache.nifi
- nifi-resources
- resources
- runtime
- zip
-
-
- org.apache.nifi
- nifi-docs
- resources
- runtime
- zip
-
-
- org.apache.nifi
- nifi-framework-nar
- nar
-
-
- org.apache.nifi
- nifi-provenance-repository-nar
- nar
-
-
- org.apache.nifi
- nifi-standard-services-api-nar
- nar
-
-
- org.apache.nifi
- nifi-ssl-context-service-nar
- nar
-
-
- org.apache.nifi
- nifi-distributed-cache-services-nar
- nar
-
-
- org.apache.nifi
- nifi-standard-nar
- nar
-
-
- org.apache.nifi
- nifi-jetty-bundle
- nar
-
-
- org.apache.nifi
- nifi-update-attribute-nar
- nar
-
-
- org.apache.nifi
- nifi-hadoop-libraries-nar
- nar
-
-
- org.apache.nifi
- nifi-hadoop-nar
- nar
-
-
- org.apache.nifi
- nifi-kafka-nar
- nar
-
-
- org.apache.nifi
- nifi-http-context-map-nar
- nar
-
-
- org.apache.nifi
- nifi-kite-nar
- nar
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+
+ org.apache.nifi
+ nifi
+ 0.1.0-incubating-SNAPSHOT
+
+ nifi-assembly
+ pom
+ This is the assembly Apache NiFi (incubating)
+
+
+
+ maven-assembly-plugin
+
+ nifi-${project.version}
+ false
+
+
+
+ make shared resource
+
+ single
+
+ package
+
+
+ src/main/assembly/dependencies.xml
+
+ posix
+
+
+
+
+
+
+
+
+ ch.qos.logback
+ logback-classic
+ compile
+
+
+ org.slf4j
+ jcl-over-slf4j
+ compile
+
+
+ org.slf4j
+ jul-to-slf4j
+ compile
+
+
+ org.slf4j
+ log4j-over-slf4j
+ compile
+
+
+ org.slf4j
+ slf4j-api
+ compile
+
+
+ org.apache.nifi
+ nifi-api
+
+
+ org.apache.nifi
+ nifi-runtime
+
+
+ org.apache.nifi
+ nifi-bootstrap
+
+
+ org.apache.nifi
+ nifi-resources
+ resources
+ runtime
+ zip
+
+
+ org.apache.nifi
+ nifi-docs
+ resources
+ runtime
+ zip
+
+
+ org.apache.nifi
+ nifi-framework-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-provenance-repository-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-standard-services-api-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-ssl-context-service-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-distributed-cache-services-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-standard-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-jetty-bundle
+ nar
+
+
+ org.apache.nifi
+ nifi-update-attribute-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-hadoop-libraries-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-hadoop-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-kafka-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-http-context-map-nar
+ nar
+
+
+ org.apache.nifi
+ nifi-kite-nar
+ nar
+ org.apache.nifinifi-solr-narnar
-
- org.apache.nifi
- nifi-social-media-nar
- 0.1.0-incubating-SNAPSHOT
- nar
-
-
- org.apache.nifi
- nifi-hl7-nar
- 0.1.0-incubating-SNAPSHOT
- nar
-
-
- org.apache.nifi
- nifi-language-translation-nar
- 0.1.0-incubating-SNAPSHOT
- nar
-
-
- org.apache.nifi
- nifi-geo-nar
- 0.1.0-incubating-SNAPSHOT
- nar
-
-
+
+ org.apache.nifi
+ nifi-social-media-nar
+ 0.1.0-incubating-SNAPSHOT
+ nar
+
+
+ org.apache.nifi
+ nifi-hl7-nar
+ 0.1.0-incubating-SNAPSHOT
+ nar
+
+
+ org.apache.nifi
+ nifi-language-translation-nar
+ 0.1.0-incubating-SNAPSHOT
+ nar
+
+
+ org.apache.nifi
+ nifi-geo-nar
+ 0.1.0-incubating-SNAPSHOT
+ nar
+
+
+>>>>>>> upstream/develop
-
-
- 256
- 512
- 128
- 128
- 10m
- 10
+
+
+ 256
+ 512
+ 128
+ 128
+ 10m
+ 10
-
- ${project.version}
- true
- 10 sec
- 500 ms
- 30 sec
- 10 millis
+
+ ${project.version}
+ true
+ 10 sec
+ 500 ms
+ 30 sec
+ 10 millis
- ./conf/flow.xml.gz
- ./conf/archive/
- ./conf/authority-providers.xml
- ./conf/templates
- ./database_repository
+ ./conf/flow.xml.gz
+ ./conf/archive/
+ ./conf/authority-providers.xml
+ ./conf/templates
+ ./database_repository
- org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
- ./flowfile_repository
- 256
- 2 mins
- false
- org.apache.nifi.controller.FileSystemSwapManager
- 20000
- 5 sec
- 1
- 5 sec
- 4
+ org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
+ ./flowfile_repository
+ 256
+ 2 mins
+ false
+ org.apache.nifi.controller.FileSystemSwapManager
+ 20000
+ 5 sec
+ 1
+ 5 sec
+ 4
- org.apache.nifi.controller.repository.FileSystemRepository
- 10 MB
- 100
- ./content_repository
-
-
- false
- false
-
+ org.apache.nifi.controller.repository.FileSystemRepository
+ 10 MB
+ 100
+ ./content_repository
+
+
+ false
+ false
+
-
-
- 30 sec
- ./lib
- ./work/nar/
- ./work/docs/components
+
+
+ 30 sec
+ ./lib
+ ./work/nar/
+ ./work/docs/components
- PBEWITHMD5AND256BITAES-CBC-OPENSSL
- BC
- ;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE
+ PBEWITHMD5AND256BITAES-CBC-OPENSSL
+ BC
+ ;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE
- 9990
+ 9990
-
- org.apache.nifi.provenance.PersistentProvenanceRepository
- ./provenance_repository
- 24 hours
- 1 GB
- 5 mins
- 100 MB
- 2
- true
- EventType, FlowFileUUID,
- Filename, ProcessorID
-
- 500 MB
- false
- 16
+
+ org.apache.nifi.provenance.PersistentProvenanceRepository
+ ./provenance_repository
+ 24 hours
+ 1 GB
+ 5 mins
+ 100 MB
+ 2
+ true
+ EventType, FlowFileUUID,
+ Filename, ProcessorID
+
+ 500 MB
+ false
+ 16
-
- 100000
+
+ 100000
-
- org.apache.nifi.controller.status.history.VolatileComponentStatusRepository
- 288
- 5 mins
+
+ org.apache.nifi.controller.status.history.VolatileComponentStatusRepository
+ 288
+ 5 mins
-
- ./lib
-
- 8080
-
-
- ./work/jetty
- 200
+
+ ./lib
+
+ 8080
+
+
+ ./work/jetty
+ 200
-
-
-
-
-
-
-
-
-
- ./conf/authorized-users.xml
- 24 hours
- file-provider
-
-
-
-
+
+
+
+
+
+
+
+
+
+ ./conf/authorized-users.xml
+ 24 hours
+ file-provider
+
+
+
+
-
- 5 sec
- false
- 30 sec
- 45 sec
- false
-
-
- 500 ms
- 3
- 1 sec
+
+ 5 sec
+ false
+ 30 sec
+ 45 sec
+ false
+
+
+ 500 ms
+ 3
+ 1 sec
-
- false
-
-
- 2
-
-
+
+ false
+
+
+ 2
+
+
-
- false
-
-
-
- 10
- 30 sec
- 30 sec
- 10
- 5 sec
- 10
- 0 sec
-
-
-
- rpm
-
- false
-
-
-
-
- maven-dependency-plugin
-
-
- unpack-shared-resources
-
- unpack-dependencies
-
- generate-resources
-
- ${project.build.directory}/generated-resources
- nifi-resources
- org.apache.nifi
- false
-
-
-
- unpack-docs
-
- unpack-dependencies
-
- generate-resources
-
- ${project.build.directory}/generated-docs
- nifi-docs
- org.apache.nifi
- false
-
-
-
-
-
- org.codehaus.mojo
- rpm-maven-plugin
-
- Apache NiFi (incubating)
- Apache Nifi (incubating) is dataflow system based on
- the Flow-Based Programming concepts.
- Apache License, Version 2.0 and others (see included
- LICENSE file)
- http://nifi.incubator.apache.org
- Utilities
- /opt/nifi
-
- _use_internal_dependency_generator 0
-
- 750
- 640
- root
- root
-
-
-
- build-bin-rpm
-
- attached-rpm
-
-
- bin
-
- nifi
-
-
-
- /opt/nifi/nifi-${project.version}
-
-
- /opt/nifi/nifi-${project.version}
-
-
-
-
-
-
-
-
- /opt/nifi/nifi-${project.version}/bin
- 750
-
-
-
-
-
- /opt/nifi/nifi-${project.version}/conf
- true
-
-
-
-
-
- /opt/nifi/nifi-${project.version}/lib
-
-
- org.apache.nifi:nifi-bootstrap
- org.apache.nifi:nifi-resources
- org.apache.nifi:nifi-docs
-
-
-
-
- /opt/nifi/nifi-${project.version}/lib/bootstrap
-
-
- org.apache.nifi:nifi-bootstrap
-
-
-
-
- /opt/nifi/nifi-${project.version}/docs
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ false
+
+
+
+ 10
+ 30 sec
+ 30 sec
+ 10
+ 5 sec
+ 10
+ 0 sec
+
+
+
+ rpm
+
+ false
+
+
+
+
+ maven-dependency-plugin
+
+
+ unpack-shared-resources
+
+ unpack-dependencies
+
+ generate-resources
+
+ ${project.build.directory}/generated-resources
+ nifi-resources
+ org.apache.nifi
+ false
+
+
+
+ unpack-docs
+
+ unpack-dependencies
+
+ generate-resources
+
+ ${project.build.directory}/generated-docs
+ nifi-docs
+ org.apache.nifi
+ false
+
+
+
+
+
+ org.codehaus.mojo
+ rpm-maven-plugin
+
+ Apache NiFi (incubating)
+ Apache Nifi (incubating) is dataflow system based on
+ the Flow-Based Programming concepts.
+ Apache License, Version 2.0 and others (see included
+ LICENSE file)
+ http://nifi.incubator.apache.org
+ Utilities
+ /opt/nifi
+
+ _use_internal_dependency_generator 0
+
+ 750
+ 640
+ root
+ root
+
+
+
+ build-bin-rpm
+
+ attached-rpm
+
+
+ bin
+
+ nifi
+
+
+
+ /opt/nifi/nifi-${project.version}
+
+
+ /opt/nifi/nifi-${project.version}
+
+
+
+
+
+
+
+
+ /opt/nifi/nifi-${project.version}/bin
+ 750
+
+
+
+
+
+ /opt/nifi/nifi-${project.version}/conf
+ true
+
+
+
+
+
+ /opt/nifi/nifi-${project.version}/lib
+
+
+ org.apache.nifi:nifi-bootstrap
+ org.apache.nifi:nifi-resources
+ org.apache.nifi:nifi-docs
+
+
+
+
+ /opt/nifi/nifi-${project.version}/lib/bootstrap
+
+
+ org.apache.nifi:nifi-bootstrap
+
+
+
+
+ /opt/nifi/nifi-${project.version}/docs
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java
index f03bf1edcd..381787512d 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java
@@ -27,66 +27,66 @@ import java.util.Arrays;
import org.apache.nifi.bootstrap.exception.InvalidCommandException;
-
public class BootstrapCodec {
- private final RunNiFi runner;
- private final BufferedReader reader;
- private final BufferedWriter writer;
-
- public BootstrapCodec(final RunNiFi runner, final InputStream in, final OutputStream out) {
- this.runner = runner;
- this.reader = new BufferedReader(new InputStreamReader(in));
- this.writer = new BufferedWriter(new OutputStreamWriter(out));
- }
-
- public void communicate() throws IOException {
- final String line = reader.readLine();
- final String[] splits = line.split(" ");
- if ( splits.length < 0 ) {
- throw new IOException("Received invalid command from NiFi: " + line);
- }
-
- final String cmd = splits[0];
- final String[] args;
- if ( splits.length == 1 ) {
- args = new String[0];
- } else {
- args = Arrays.copyOfRange(splits, 1, splits.length);
- }
-
- try {
- processRequest(cmd, args);
- } catch (final InvalidCommandException ice) {
- throw new IOException("Received invalid command from NiFi: " + line + " : " + ice.getMessage() == null ? "" : "Details: " + ice.toString());
- }
- }
- private void processRequest(final String cmd, final String[] args) throws InvalidCommandException, IOException {
- switch (cmd) {
- case "PORT": {
- if ( args.length != 2 ) {
- throw new InvalidCommandException();
- }
-
- final int port;
- try {
- port = Integer.parseInt( args[0] );
- } catch (final NumberFormatException nfe) {
- throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535");
- }
-
- if ( port < 1 || port > 65535 ) {
- throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535");
- }
+ private final RunNiFi runner;
+ private final BufferedReader reader;
+ private final BufferedWriter writer;
- final String secretKey = args[1];
-
- runner.setNiFiCommandControlPort(port, secretKey);
- writer.write("OK");
- writer.newLine();
- writer.flush();
- }
- break;
- }
- }
+ public BootstrapCodec(final RunNiFi runner, final InputStream in, final OutputStream out) {
+ this.runner = runner;
+ this.reader = new BufferedReader(new InputStreamReader(in));
+ this.writer = new BufferedWriter(new OutputStreamWriter(out));
+ }
+
+ public void communicate() throws IOException {
+ final String line = reader.readLine();
+ final String[] splits = line.split(" ");
+ if (splits.length < 0) {
+ throw new IOException("Received invalid command from NiFi: " + line);
+ }
+
+ final String cmd = splits[0];
+ final String[] args;
+ if (splits.length == 1) {
+ args = new String[0];
+ } else {
+ args = Arrays.copyOfRange(splits, 1, splits.length);
+ }
+
+ try {
+ processRequest(cmd, args);
+ } catch (final InvalidCommandException ice) {
+ throw new IOException("Received invalid command from NiFi: " + line + " : " + ice.getMessage() == null ? "" : "Details: " + ice.toString());
+ }
+ }
+
+ private void processRequest(final String cmd, final String[] args) throws InvalidCommandException, IOException {
+ switch (cmd) {
+ case "PORT": {
+ if (args.length != 2) {
+ throw new InvalidCommandException();
+ }
+
+ final int port;
+ try {
+ port = Integer.parseInt(args[0]);
+ } catch (final NumberFormatException nfe) {
+ throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535");
+ }
+
+ if (port < 1 || port > 65535) {
+ throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535");
+ }
+
+ final String secretKey = args[1];
+
+ runner.setNiFiCommandControlPort(port, secretKey);
+ writer.write("OK");
+ writer.newLine();
+ writer.flush();
+ }
+ break;
+ }
+ }
}
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java
index f05d45a395..171347880e 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java
@@ -28,101 +28,103 @@ import java.util.concurrent.TimeUnit;
import org.apache.nifi.bootstrap.util.LimitingInputStream;
public class NiFiListener {
- private ServerSocket serverSocket;
- private volatile Listener listener;
-
- int start(final RunNiFi runner) throws IOException {
- serverSocket = new ServerSocket();
- serverSocket.bind(new InetSocketAddress("localhost", 0));
-
- final int localPort = serverSocket.getLocalPort();
- listener = new Listener(serverSocket, runner);
- final Thread listenThread = new Thread(listener);
- listenThread.setName("Listen to NiFi");
- listenThread.start();
- return localPort;
- }
-
- public void stop() throws IOException {
- final Listener listener = this.listener;
- if ( listener == null ) {
- return;
- }
-
- listener.stop();
- }
-
- private class Listener implements Runnable {
- private final ServerSocket serverSocket;
- private final ExecutorService executor;
- private final RunNiFi runner;
- private volatile boolean stopped = false;
-
- public Listener(final ServerSocket serverSocket, final RunNiFi runner) {
- this.serverSocket = serverSocket;
- this.executor = Executors.newFixedThreadPool(2);
- this.runner = runner;
- }
-
- public void stop() throws IOException {
- stopped = true;
-
- executor.shutdown();
- try {
- executor.awaitTermination(3, TimeUnit.SECONDS);
- } catch (final InterruptedException ie) {
- }
-
- serverSocket.close();
- }
-
- @Override
- public void run() {
- while (!serverSocket.isClosed()) {
- try {
- if ( stopped ) {
- return;
- }
-
- final Socket socket;
- try {
- socket = serverSocket.accept();
- } catch (final IOException ioe) {
- if ( stopped ) {
- return;
- }
-
- throw ioe;
- }
-
- executor.submit(new Runnable() {
- @Override
- public void run() {
- try {
- // we want to ensure that we don't try to read data from an InputStream directly
- // by a BufferedReader because any user on the system could open a socket and send
- // a multi-gigabyte file without any new lines in order to crash the Bootstrap,
- // which in turn may cause the Shutdown Hook to shutdown NiFi.
- // So we will limit the amount of data to read to 4 KB
- final InputStream limitingIn = new LimitingInputStream(socket.getInputStream(), 4096);
- final BootstrapCodec codec = new BootstrapCodec(runner, limitingIn, socket.getOutputStream());
- codec.communicate();
- } catch (final Throwable t) {
- System.out.println("Failed to communicate with NiFi due to " + t);
- t.printStackTrace();
- } finally {
- try {
- socket.close();
- } catch (final IOException ioe) {
- }
- }
- }
- });
- } catch (final Throwable t) {
- System.err.println("Failed to receive information from NiFi due to " + t);
- t.printStackTrace();
- }
- }
- }
- }
+
+ private ServerSocket serverSocket;
+ private volatile Listener listener;
+
+ int start(final RunNiFi runner) throws IOException {
+ serverSocket = new ServerSocket();
+ serverSocket.bind(new InetSocketAddress("localhost", 0));
+
+ final int localPort = serverSocket.getLocalPort();
+ listener = new Listener(serverSocket, runner);
+ final Thread listenThread = new Thread(listener);
+ listenThread.setName("Listen to NiFi");
+ listenThread.start();
+ return localPort;
+ }
+
+ public void stop() throws IOException {
+ final Listener listener = this.listener;
+ if (listener == null) {
+ return;
+ }
+
+ listener.stop();
+ }
+
+ private class Listener implements Runnable {
+
+ private final ServerSocket serverSocket;
+ private final ExecutorService executor;
+ private final RunNiFi runner;
+ private volatile boolean stopped = false;
+
+ public Listener(final ServerSocket serverSocket, final RunNiFi runner) {
+ this.serverSocket = serverSocket;
+ this.executor = Executors.newFixedThreadPool(2);
+ this.runner = runner;
+ }
+
+ public void stop() throws IOException {
+ stopped = true;
+
+ executor.shutdown();
+ try {
+ executor.awaitTermination(3, TimeUnit.SECONDS);
+ } catch (final InterruptedException ie) {
+ }
+
+ serverSocket.close();
+ }
+
+ @Override
+ public void run() {
+ while (!serverSocket.isClosed()) {
+ try {
+ if (stopped) {
+ return;
+ }
+
+ final Socket socket;
+ try {
+ socket = serverSocket.accept();
+ } catch (final IOException ioe) {
+ if (stopped) {
+ return;
+ }
+
+ throw ioe;
+ }
+
+ executor.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ // we want to ensure that we don't try to read data from an InputStream directly
+ // by a BufferedReader because any user on the system could open a socket and send
+ // a multi-gigabyte file without any new lines in order to crash the Bootstrap,
+ // which in turn may cause the Shutdown Hook to shutdown NiFi.
+ // So we will limit the amount of data to read to 4 KB
+ final InputStream limitingIn = new LimitingInputStream(socket.getInputStream(), 4096);
+ final BootstrapCodec codec = new BootstrapCodec(runner, limitingIn, socket.getOutputStream());
+ codec.communicate();
+ } catch (final Throwable t) {
+ System.out.println("Failed to communicate with NiFi due to " + t);
+ t.printStackTrace();
+ } finally {
+ try {
+ socket.close();
+ } catch (final IOException ioe) {
+ }
+ }
+ }
+ });
+ } catch (final Throwable t) {
+ System.err.println("Failed to receive information from NiFi due to " + t);
+ t.printStackTrace();
+ }
+ }
+ }
+ }
}
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
index 28a9b71028..d3796b5c9f 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
@@ -49,218 +49,223 @@ import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
-
/**
- * Bootstrap class to run Apache NiFi.
- *
- * This class looks for the bootstrap.conf file by looking in the following places (in order):
+ *
+ *
+ * The class which bootstraps Apache NiFi. This class looks for the
+ * bootstrap.conf file by looking in the following places (in order):
*
- *
Java System Property named {@code org.apache.nifi.bootstrap.config.file}
- *
${NIFI_HOME}/./conf/bootstrap.conf, where ${NIFI_HOME} references an environment variable {@code NIFI_HOME}
- *
./conf/bootstrap.conf, where {@code .} represents the working directory.
+ *
Java System Property named
+ * {@code org.apache.nifi.bootstrap.config.file}
+ *
${NIFI_HOME}/./conf/bootstrap.conf, where ${NIFI_HOME} references an
+ * environment variable {@code NIFI_HOME}
+ *
./conf/bootstrap.conf, where {@code ./} represents the working
+ * directory.
*
*
- * If the {@code bootstrap.conf} file cannot be found, throws a {@code FileNotFoundException].
+ * If the {@code bootstrap.conf} file cannot be found, throws a {@code FileNotFoundException}.
*/
public class RunNiFi {
- public static final String DEFAULT_CONFIG_FILE = "./conf/bootstrap.conf";
- public static final String DEFAULT_NIFI_PROPS_FILE = "./conf/nifi.properties";
- public static final String DEFAULT_JAVA_CMD = "java";
- public static final String GRACEFUL_SHUTDOWN_PROP = "graceful.shutdown.seconds";
- public static final String DEFAULT_GRACEFUL_SHUTDOWN_VALUE = "20";
-
- public static final String RUN_AS_PROP = "run.as";
-
- public static final int MAX_RESTART_ATTEMPTS = 5;
- public static final int STARTUP_WAIT_SECONDS = 60;
-
- public static final String SHUTDOWN_CMD = "SHUTDOWN";
- public static final String PING_CMD = "PING";
- public static final String DUMP_CMD = "DUMP";
-
- private volatile boolean autoRestartNiFi = true;
- private volatile int ccPort = -1;
- private volatile long nifiPid = -1L;
- private volatile String secretKey;
- private volatile ShutdownHook shutdownHook;
-
- private final Lock lock = new ReentrantLock();
- private final Condition startupCondition = lock.newCondition();
-
- private final File bootstrapConfigFile;
+ public static final String DEFAULT_CONFIG_FILE = "./conf/bootstrap.conf";
+ public static final String DEFAULT_NIFI_PROPS_FILE = "./conf/nifi.properties";
+ public static final String DEFAULT_JAVA_CMD = "java";
- private final java.util.logging.Logger logger;
-
- public RunNiFi(final File bootstrapConfigFile, final boolean verbose) {
- this.bootstrapConfigFile = bootstrapConfigFile;
- logger = java.util.logging.Logger.getLogger("Bootstrap");
- if ( verbose ) {
- logger.info("Enabling Verbose Output");
-
- logger.setLevel(Level.FINE);
- final Handler handler = new ConsoleHandler();
- handler.setLevel(Level.FINE);
- logger.addHandler(handler);
- }
- }
-
- private static void printUsage() {
- System.out.println("Usage:");
- System.out.println();
- System.out.println("java org.apache.nifi.bootstrap.RunNiFi [<-verbose>] [options]");
- System.out.println();
- System.out.println("Valid commands include:");
- System.out.println("");
- System.out.println("Start : Start a new instance of Apache NiFi");
- System.out.println("Stop : Stop a running instance of Apache NiFi");
- System.out.println("Restart : Stop Apache NiFi, if it is running, and then start a new instance");
- System.out.println("Status : Determine if there is a running instance of Apache NiFi");
- System.out.println("Dump : Write a Thread Dump to the file specified by [options], or to the log if no file is given");
- System.out.println("Run : Start a new instance of Apache NiFi and monitor the Process, restarting if the instance dies");
- System.out.println();
- }
+ public static final String GRACEFUL_SHUTDOWN_PROP = "graceful.shutdown.seconds";
+ public static final String DEFAULT_GRACEFUL_SHUTDOWN_VALUE = "20";
- private static String[] shift(final String[] orig) {
- return Arrays.copyOfRange(orig, 1, orig.length);
- }
-
- public static void main(String[] args) throws IOException, InterruptedException {
- if ( args.length < 1 || args.length > 3 ) {
- printUsage();
- return;
- }
-
- File dumpFile = null;
- boolean verbose = false;
- if ( args[0].equals("-verbose") ) {
- verbose = true;
- args = shift(args);
- }
-
- final String cmd = args[0];
- if (cmd.equals("dump") ) {
- if ( args.length > 1 ) {
- dumpFile = new File(args[1]);
- } else {
- dumpFile = null;
- }
- }
-
- switch (cmd.toLowerCase()) {
- case "start":
- case "run":
- case "stop":
- case "status":
- case "dump":
- case "restart":
- break;
- default:
- printUsage();
- return;
- }
-
- String configFilename = System.getProperty("org.apache.nifi.bootstrap.config.file");
-
- if ( configFilename == null ) {
- final String nifiHome = System.getenv("NIFI_HOME");
- if ( nifiHome != null ) {
- final File nifiHomeFile = new File(nifiHome.trim());
- final File configFile = new File(nifiHomeFile, DEFAULT_CONFIG_FILE);
- configFilename = configFile.getAbsolutePath();
- }
- }
-
- if ( configFilename == null ) {
- configFilename = DEFAULT_CONFIG_FILE;
- }
-
- final File configFile = new File(configFilename);
-
- final RunNiFi runNiFi = new RunNiFi(configFile, verbose);
-
- switch (cmd.toLowerCase()) {
- case "start":
- runNiFi.start(false);
- break;
- case "run":
- runNiFi.start(true);
- break;
- case "stop":
- runNiFi.stop();
- break;
- case "status":
- runNiFi.status();
- break;
- case "restart":
- runNiFi.stop();
- runNiFi.start(false);
- break;
- case "dump":
- runNiFi.dump(dumpFile);
- break;
- }
- }
-
-
- public File getStatusFile() {
- final File confDir = bootstrapConfigFile.getParentFile();
- final File nifiHome = confDir.getParentFile();
- final File bin = new File(nifiHome, "bin");
- final File statusFile = new File(bin, "nifi.pid");
-
- logger.fine("Status File: " + statusFile);
-
- return statusFile;
- }
-
- private Properties loadProperties() throws IOException {
- final Properties props = new Properties();
- final File statusFile = getStatusFile();
- if ( statusFile == null || !statusFile.exists() ) {
- logger.fine("No status file to load properties from");
- return props;
- }
-
- try (final FileInputStream fis = new FileInputStream(getStatusFile())) {
- props.load(fis);
- }
-
- logger.fine("Properties: " + props);
- return props;
- }
-
- private synchronized void saveProperties(final Properties nifiProps) throws IOException {
- final File statusFile = getStatusFile();
- if ( statusFile.exists() && !statusFile.delete() ) {
- logger.warning("Failed to delete " + statusFile);
- }
+ public static final String RUN_AS_PROP = "run.as";
- if ( !statusFile.createNewFile() ) {
- throw new IOException("Failed to create file " + statusFile);
- }
+ public static final int MAX_RESTART_ATTEMPTS = 5;
+ public static final int STARTUP_WAIT_SECONDS = 60;
+
+ public static final String SHUTDOWN_CMD = "SHUTDOWN";
+ public static final String PING_CMD = "PING";
+ public static final String DUMP_CMD = "DUMP";
+
+ private volatile boolean autoRestartNiFi = true;
+ private volatile int ccPort = -1;
+ private volatile long nifiPid = -1L;
+ private volatile String secretKey;
+ private volatile ShutdownHook shutdownHook;
+
+ private final Lock lock = new ReentrantLock();
+ private final Condition startupCondition = lock.newCondition();
+
+ private final File bootstrapConfigFile;
+
+ private final java.util.logging.Logger logger;
+
+ public RunNiFi(final File bootstrapConfigFile, final boolean verbose) {
+ this.bootstrapConfigFile = bootstrapConfigFile;
+ logger = java.util.logging.Logger.getLogger("Bootstrap");
+ if (verbose) {
+ logger.info("Enabling Verbose Output");
+
+ logger.setLevel(Level.FINE);
+ final Handler handler = new ConsoleHandler();
+ handler.setLevel(Level.FINE);
+ logger.addHandler(handler);
+ }
+ }
+
+ private static void printUsage() {
+ System.out.println("Usage:");
+ System.out.println();
+ System.out.println("java org.apache.nifi.bootstrap.RunNiFi [<-verbose>] [options]");
+ System.out.println();
+ System.out.println("Valid commands include:");
+ System.out.println("");
+ System.out.println("Start : Start a new instance of Apache NiFi");
+ System.out.println("Stop : Stop a running instance of Apache NiFi");
+ System.out.println("Restart : Stop Apache NiFi, if it is running, and then start a new instance");
+ System.out.println("Status : Determine if there is a running instance of Apache NiFi");
+ System.out.println("Dump : Write a Thread Dump to the file specified by [options], or to the log if no file is given");
+ System.out.println("Run : Start a new instance of Apache NiFi and monitor the Process, restarting if the instance dies");
+ System.out.println();
+ }
+
+ private static String[] shift(final String[] orig) {
+ return Arrays.copyOfRange(orig, 1, orig.length);
+ }
+
+ public static void main(String[] args) throws IOException, InterruptedException {
+ if (args.length < 1 || args.length > 3) {
+ printUsage();
+ return;
+ }
+
+ File dumpFile = null;
+ boolean verbose = false;
+ if (args[0].equals("-verbose")) {
+ verbose = true;
+ args = shift(args);
+ }
+
+ final String cmd = args[0];
+ if (cmd.equals("dump")) {
+ if (args.length > 1) {
+ dumpFile = new File(args[1]);
+ } else {
+ dumpFile = null;
+ }
+ }
+
+ switch (cmd.toLowerCase()) {
+ case "start":
+ case "run":
+ case "stop":
+ case "status":
+ case "dump":
+ case "restart":
+ break;
+ default:
+ printUsage();
+ return;
+ }
+
+ String configFilename = System.getProperty("org.apache.nifi.bootstrap.config.file");
+
+ if (configFilename == null) {
+ final String nifiHome = System.getenv("NIFI_HOME");
+ if (nifiHome != null) {
+ final File nifiHomeFile = new File(nifiHome.trim());
+ final File configFile = new File(nifiHomeFile, DEFAULT_CONFIG_FILE);
+ configFilename = configFile.getAbsolutePath();
+ }
+ }
+
+ if (configFilename == null) {
+ configFilename = DEFAULT_CONFIG_FILE;
+ }
+
+ final File configFile = new File(configFilename);
+
+ final RunNiFi runNiFi = new RunNiFi(configFile, verbose);
+
+ switch (cmd.toLowerCase()) {
+ case "start":
+ runNiFi.start(false);
+ break;
+ case "run":
+ runNiFi.start(true);
+ break;
+ case "stop":
+ runNiFi.stop();
+ break;
+ case "status":
+ runNiFi.status();
+ break;
+ case "restart":
+ runNiFi.stop();
+ runNiFi.start(false);
+ break;
+ case "dump":
+ runNiFi.dump(dumpFile);
+ break;
+ }
+ }
+
+ public File getStatusFile() {
+ final File confDir = bootstrapConfigFile.getParentFile();
+ final File nifiHome = confDir.getParentFile();
+ final File bin = new File(nifiHome, "bin");
+ final File statusFile = new File(bin, "nifi.pid");
+
+ logger.log(Level.FINE, "Status File: {0}", statusFile);
+
+ return statusFile;
+ }
+
+ private Properties loadProperties() throws IOException {
+ final Properties props = new Properties();
+ final File statusFile = getStatusFile();
+ if (statusFile == null || !statusFile.exists()) {
+ logger.fine("No status file to load properties from");
+ return props;
+ }
+
+ try (final FileInputStream fis = new FileInputStream(getStatusFile())) {
+ props.load(fis);
+ }
+
+ logger.log(Level.FINE, "Properties: {0}", props);
+ return props;
+ }
+
+ private synchronized void saveProperties(final Properties nifiProps) throws IOException {
+ final File statusFile = getStatusFile();
+ if (statusFile.exists() && !statusFile.delete()) {
+ logger.log(Level.WARNING, "Failed to delete {0}", statusFile);
+ }
+
+ if (!statusFile.createNewFile()) {
+ throw new IOException("Failed to create file " + statusFile);
+ }
+
+ try {
+ final Set perms = new HashSet<>();
+ perms.add(PosixFilePermission.OWNER_READ);
+ perms.add(PosixFilePermission.OWNER_WRITE);
+ Files.setPosixFilePermissions(statusFile.toPath(), perms);
+ } catch (final Exception e) {
+ logger.log(Level.WARNING, "Failed to set permissions so that only the owner can read status file {0}; "
+ + "this may allows others to have access to the key needed to communicate with NiFi. "
+ + "Permissions should be changed so that only the owner can read this file", statusFile);
+ }
- try {
- final Set perms = new HashSet<>();
- perms.add(PosixFilePermission.OWNER_READ);
- perms.add(PosixFilePermission.OWNER_WRITE);
- Files.setPosixFilePermissions(statusFile.toPath(), perms);
- } catch (final Exception e) {
- logger.warning("Failed to set permissions so that only the owner can read status file " + statusFile + "; this may allows others to have access to the key needed to communicate with NiFi. Permissions should be changed so that only the owner can read this file");
- }
-
try (final FileOutputStream fos = new FileOutputStream(statusFile)) {
nifiProps.store(fos, null);
fos.getFD().sync();
}
-
- logger.fine("Saved Properties " + nifiProps + " to " + statusFile);
- }
- private boolean isPingSuccessful(final int port, final String secretKey) {
- logger.fine("Pinging " + port);
-
- try (final Socket socket = new Socket("localhost", port)) {
+ logger.log(Level.FINE, "Saved Properties {0} to {1}", new Object[]{nifiProps, statusFile});
+ }
+
+ private boolean isPingSuccessful(final int port, final String secretKey) {
+ logger.log(Level.FINE, "Pinging {0}", port);
+
+ try (final Socket socket = new Socket("localhost", port)) {
final OutputStream out = socket.getOutputStream();
out.write((PING_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
out.flush();
@@ -270,106 +275,104 @@ public class RunNiFi {
final InputStream in = socket.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final String response = reader.readLine();
- logger.fine("PING response: " + response);
-
- return PING_CMD.equals(response);
- } catch (final IOException ioe) {
- return false;
- }
- }
-
- private Integer getCurrentPort() throws IOException {
- final Properties props = loadProperties();
- final String portVal = props.getProperty("port");
- if ( portVal == null ) {
- logger.fine("No Port found in status file");
- return null;
- } else {
- logger.fine("Port defined in status file: " + portVal);
- }
-
- final int port = Integer.parseInt(portVal);
- final boolean success = isPingSuccessful(port, props.getProperty("secret.key"));
- if ( success ) {
- logger.fine("Successful PING on port " + port);
- return port;
- }
+ logger.log(Level.FINE, "PING response: {0}", response);
- final String pid = props.getProperty("pid");
- logger.fine("PID in status file is " + pid);
- if ( pid != null ) {
- final boolean procRunning = isProcessRunning(pid);
- if ( procRunning ) {
- return port;
- } else {
- return null;
- }
- }
-
- return null;
- }
-
-
- private boolean isProcessRunning(final String pid) {
- try {
- // We use the "ps" command to check if the process is still running.
- final ProcessBuilder builder = new ProcessBuilder();
-
- builder.command("ps", "-p", pid);
- final Process proc = builder.start();
-
- // Look for the pid in the output of the 'ps' command.
- boolean running = false;
- String line;
- try (final InputStream in = proc.getInputStream();
- final Reader streamReader = new InputStreamReader(in);
- final BufferedReader reader = new BufferedReader(streamReader)) {
-
- while ((line = reader.readLine()) != null) {
- if ( line.trim().startsWith(pid) ) {
+ return PING_CMD.equals(response);
+ } catch (final IOException ioe) {
+ return false;
+ }
+ }
+
+ private Integer getCurrentPort() throws IOException {
+ final Properties props = loadProperties();
+ final String portVal = props.getProperty("port");
+ if (portVal == null) {
+ logger.fine("No Port found in status file");
+ return null;
+ } else {
+ logger.log(Level.FINE, "Port defined in status file: {0}", portVal);
+ }
+
+ final int port = Integer.parseInt(portVal);
+ final boolean success = isPingSuccessful(port, props.getProperty("secret.key"));
+ if (success) {
+ logger.log(Level.FINE, "Successful PING on port {0}", port);
+ return port;
+ }
+
+ final String pid = props.getProperty("pid");
+ logger.log(Level.FINE, "PID in status file is {0}", pid);
+ if (pid != null) {
+ final boolean procRunning = isProcessRunning(pid);
+ if (procRunning) {
+ return port;
+ } else {
+ return null;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean isProcessRunning(final String pid) {
+ try {
+ // We use the "ps" command to check if the process is still running.
+ final ProcessBuilder builder = new ProcessBuilder();
+
+ builder.command("ps", "-p", pid);
+ final Process proc = builder.start();
+
+ // Look for the pid in the output of the 'ps' command.
+ boolean running = false;
+ String line;
+ try (final InputStream in = proc.getInputStream();
+ final Reader streamReader = new InputStreamReader(in);
+ final BufferedReader reader = new BufferedReader(streamReader)) {
+
+ while ((line = reader.readLine()) != null) {
+ if (line.trim().startsWith(pid)) {
running = true;
}
- }
- }
-
- // If output of the ps command had our PID, the process is running.
- if ( running ) {
- logger.fine("Process with PID " + pid + " is running");
- } else {
- logger.fine("Process with PID " + pid + " is not running");
- }
-
- return running;
- } catch (final IOException ioe) {
- System.err.println("Failed to determine if Process " + pid + " is running; assuming that it is not");
- return false;
- }
- }
-
-
- private Status getStatus() {
- final Properties props;
- try {
- props = loadProperties();
- } catch (final IOException ioe) {
- return new Status(null, null, false, false);
- }
-
- if ( props == null ) {
- return new Status(null, null, false, false);
- }
-
+ }
+ }
+
+ // If output of the ps command had our PID, the process is running.
+ if (running) {
+ logger.log(Level.FINE, "Process with PID {0} is running", pid);
+ } else {
+ logger.log(Level.FINE, "Process with PID {0} is not running", pid);
+ }
+
+ return running;
+ } catch (final IOException ioe) {
+ System.err.println("Failed to determine if Process " + pid + " is running; assuming that it is not");
+ return false;
+ }
+ }
+
+ private Status getStatus() {
+ final Properties props;
+ try {
+ props = loadProperties();
+ } catch (final IOException ioe) {
+ return new Status(null, null, false, false);
+ }
+
+ if (props == null) {
+ return new Status(null, null, false, false);
+ }
+
final String portValue = props.getProperty("port");
final String pid = props.getProperty("pid");
final String secretKey = props.getProperty("secret.key");
-
- if ( portValue == null && pid == null ) {
+
+ if (portValue == null && pid == null) {
return new Status(null, null, false, false);
}
-
+
Integer port = null;
boolean pingSuccess = false;
- if ( portValue != null ) {
+ if (portValue != null) {
try {
port = Integer.parseInt(portValue);
pingSuccess = isPingSuccessful(port, secretKey);
@@ -377,577 +380,577 @@ public class RunNiFi {
return new Status(null, null, false, false);
}
}
-
- if ( pingSuccess ) {
+
+ if (pingSuccess) {
return new Status(port, pid, true, true);
}
-
+
final boolean alive = (pid == null) ? false : isProcessRunning(pid);
return new Status(port, pid, pingSuccess, alive);
- }
-
- public void status() throws IOException {
- final Status status = getStatus();
- if ( status.isRespondingToPing() ) {
- logger.info("Apache NiFi is currently running, listening to Bootstrap on port " + status.getPort() +
- ", PID=" + (status.getPid() == null ? "unknkown" : status.getPid()));
- return;
- }
+ }
- if ( status.isProcessRunning() ) {
- logger.info("Apache NiFi is running at PID " + status.getPid() + " but is not responding to ping requests");
- return;
- }
-
- if ( status.getPort() == null ) {
- logger.info("Apache NiFi is not running");
- return;
- }
-
- if ( status.getPid() == null ) {
- logger.info("Apache NiFi is not responding to Ping requests. The process may have died or may be hung");
- } else {
- logger.info("Apache NiFi is not running");
- }
- }
-
-
- /**
- * Writes a NiFi thread dump to the given file; if file is null, logs at INFO level instead.
- * @param dumpFile
- * @return
- * @throws IOException
- */
- public void dump(final File dumpFile) throws IOException {
- final Integer port = getCurrentPort();
- if ( port == null ) {
+ public void status() throws IOException {
+ final Status status = getStatus();
+ if (status.isRespondingToPing()) {
+ logger.log(Level.INFO, "Apache NiFi is currently running, listening to Bootstrap on port {0}, PID={1}",
+ new Object[]{status.getPort(), status.getPid() == null ? "unknkown" : status.getPid()});
+ return;
+ }
+
+ if (status.isProcessRunning()) {
+ logger.log(Level.INFO, "Apache NiFi is running at PID {0} but is not responding to ping requests", status.getPid());
+ return;
+ }
+
+ if (status.getPort() == null) {
+ logger.info("Apache NiFi is not running");
+ return;
+ }
+
+ if (status.getPid() == null) {
+ logger.info("Apache NiFi is not responding to Ping requests. The process may have died or may be hung");
+ } else {
+ logger.info("Apache NiFi is not running");
+ }
+ }
+
+ /**
+ * Writes a NiFi thread dump to the given file; if file is null, logs at
+ * INFO level instead.
+ *
+ * @param dumpFile the file to write the dump content to
+ * @throws IOException if any issues occur while writing the dump file
+ */
+ public void dump(final File dumpFile) throws IOException {
+ final Integer port = getCurrentPort();
+ if (port == null) {
System.out.println("Apache NiFi is not currently running");
}
-
+
final Properties nifiProps = loadProperties();
final String secretKey = nifiProps.getProperty("secret.key");
final StringBuilder sb = new StringBuilder();
- try (final Socket socket = new Socket()) {
+ try (final Socket socket = new Socket()) {
logger.fine("Connecting to NiFi instance");
socket.setSoTimeout(60000);
socket.connect(new InetSocketAddress("localhost", port));
logger.fine("Established connection to NiFi instance.");
socket.setSoTimeout(60000);
-
- logger.fine("Sending DUMP Command to port " + port);
+
+ logger.log(Level.FINE, "Sending DUMP Command to port {0}", port);
final OutputStream out = socket.getOutputStream();
out.write((DUMP_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
out.flush();
-
+
final InputStream in = socket.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
- while ((line = reader.readLine()) != null ) {
+ while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
}
-
- final String dump = sb.toString();
- if ( dumpFile == null ) {
- logger.info(dump);
- } else {
- try (final FileOutputStream fos = new FileOutputStream(dumpFile)) {
- fos.write(dump.getBytes(StandardCharsets.UTF_8));
- }
- logger.info("Successfully wrote thread dump to " + dumpFile.getAbsolutePath());
- }
- }
-
- public void stop() throws IOException {
- final Integer port = getCurrentPort();
- if ( port == null ) {
- System.out.println("Apache NiFi is not currently running");
- return;
- }
-
- final Properties nifiProps = loadProperties();
- final String secretKey = nifiProps.getProperty("secret.key");
-
- try (final Socket socket = new Socket()) {
- logger.fine("Connecting to NiFi instance");
- socket.setSoTimeout(60000);
- socket.connect(new InetSocketAddress("localhost", port));
- logger.fine("Established connection to NiFi instance.");
- socket.setSoTimeout(60000);
-
- logger.fine("Sending SHUTDOWN Command to port " + port);
- final OutputStream out = socket.getOutputStream();
- out.write((SHUTDOWN_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
- out.flush();
-
- final InputStream in = socket.getInputStream();
- final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- final String response = reader.readLine();
-
- logger.fine("Received response to SHUTDOWN command: " + response);
-
- if ( SHUTDOWN_CMD.equals(response) ) {
- logger.info("Apache NiFi has accepted the Shutdown Command and is shutting down now");
-
- final String pid = nifiProps.getProperty("pid");
- if ( pid != null ) {
- final Properties bootstrapProperties = new Properties();
- try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) {
- bootstrapProperties.load(fis);
- }
- String gracefulShutdown = bootstrapProperties.getProperty(GRACEFUL_SHUTDOWN_PROP, DEFAULT_GRACEFUL_SHUTDOWN_VALUE);
- int gracefulShutdownSeconds;
- try {
- gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown);
- } catch (final NumberFormatException nfe) {
- gracefulShutdownSeconds = Integer.parseInt(DEFAULT_GRACEFUL_SHUTDOWN_VALUE);
- }
-
- final long startWait = System.nanoTime();
- while ( isProcessRunning(pid) ) {
- logger.info("Waiting for Apache NiFi to finish shutting down...");
- final long waitNanos = System.nanoTime() - startWait;
- final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
- if ( waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0 ) {
- if ( isProcessRunning(pid) ) {
- logger.warning("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process.");
- try {
- killProcessTree(pid);
- } catch (final IOException ioe) {
- logger.severe("Failed to kill Process with PID " + pid);
- }
- }
- break;
- } else {
- try {
- Thread.sleep(2000L);
- } catch (final InterruptedException ie) {}
- }
- }
-
- logger.info("NiFi has finished shutting down.");
- }
-
- final File statusFile = getStatusFile();
- if ( !statusFile.delete() ) {
- logger.severe("Failed to delete status file " + statusFile + "; this file should be cleaned up manually");
- }
- } else {
- logger.severe("When sending SHUTDOWN command to NiFi, got unexpected response " + response);
- }
- } catch (final IOException ioe) {
- logger.severe("Failed to send shutdown command to port " + port + " due to " + ioe);
- return;
- }
- }
-
-
- private static List getChildProcesses(final String ppid) throws IOException {
- final Process proc = Runtime.getRuntime().exec(new String[] {"ps", "-o", "pid", "--no-headers", "--ppid", ppid});
- final List childPids = new ArrayList<>();
- try (final InputStream in = proc.getInputStream();
- final BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
-
- String line;
- while ((line = reader.readLine()) != null) {
- childPids.add(line.trim());
- }
- }
-
- return childPids;
- }
-
- private void killProcessTree(final String pid) throws IOException {
- logger.fine("Killing Process Tree for PID " + pid);
-
- final List children = getChildProcesses(pid);
- logger.fine("Children of PID " + pid + ": " + children);
-
- for ( final String childPid : children ) {
- killProcessTree(childPid);
- }
-
- Runtime.getRuntime().exec(new String[] {"kill", "-9", pid});
- }
-
- public static boolean isAlive(final Process process) {
- try {
- process.exitValue();
- return false;
- } catch (final IllegalStateException | IllegalThreadStateException itse) {
- return true;
- }
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public void start(final boolean monitor) throws IOException, InterruptedException {
- final Integer port = getCurrentPort();
- if ( port != null ) {
- System.out.println("Apache NiFi is already running, listening to Bootstrap on port " + port);
- return;
- }
-
- final ProcessBuilder builder = new ProcessBuilder();
+ final String dump = sb.toString();
+ if (dumpFile == null) {
+ logger.info(dump);
+ } else {
+ try (final FileOutputStream fos = new FileOutputStream(dumpFile)) {
+ fos.write(dump.getBytes(StandardCharsets.UTF_8));
+ }
+ logger.log(Level.INFO, "Successfully wrote thread dump to {0}", dumpFile.getAbsolutePath());
+ }
+ }
- if ( !bootstrapConfigFile.exists() ) {
- throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath());
- }
-
- final Properties properties = new Properties();
- try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) {
- properties.load(fis);
- }
-
- final Map props = new HashMap<>();
- props.putAll( (Map) properties );
+ public void stop() throws IOException {
+ final Integer port = getCurrentPort();
+ if (port == null) {
+ System.out.println("Apache NiFi is not currently running");
+ return;
+ }
- final String specifiedWorkingDir = props.get("working.dir");
- if ( specifiedWorkingDir != null ) {
- builder.directory(new File(specifiedWorkingDir));
- }
+ final Properties nifiProps = loadProperties();
+ final String secretKey = nifiProps.getProperty("secret.key");
- final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();
- final File binDir = bootstrapConfigAbsoluteFile.getParentFile();
- final File workingDir = binDir.getParentFile();
-
- if ( specifiedWorkingDir == null ) {
- builder.directory(workingDir);
- }
-
- final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim();
- File libDir = getFile(libFilename, workingDir);
-
- final String confFilename = replaceNull(props.get("conf.dir"), "./conf").trim();
- File confDir = getFile(confFilename, workingDir);
-
- String nifiPropsFilename = props.get("props.file");
- if ( nifiPropsFilename == null ) {
- if ( confDir.exists() ) {
- nifiPropsFilename = new File(confDir, "nifi.properties").getAbsolutePath();
- } else {
- nifiPropsFilename = DEFAULT_CONFIG_FILE;
- }
- }
-
- nifiPropsFilename = nifiPropsFilename.trim();
-
- final List javaAdditionalArgs = new ArrayList<>();
- for ( final Map.Entry entry : props.entrySet() ) {
- final String key = entry.getKey();
- final String value = entry.getValue();
-
- if ( key.startsWith("java.arg") ) {
- javaAdditionalArgs.add(value);
- }
- }
-
- final File[] libFiles = libDir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(final File dir, final String filename) {
- return filename.toLowerCase().endsWith(".jar");
- }
- });
-
- if ( libFiles == null || libFiles.length == 0 ) {
- throw new RuntimeException("Could not find lib directory at " + libDir.getAbsolutePath());
- }
-
- final File[] confFiles = confDir.listFiles();
- if ( confFiles == null || confFiles.length == 0 ) {
- throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath());
- }
+ try (final Socket socket = new Socket()) {
+ logger.fine("Connecting to NiFi instance");
+ socket.setSoTimeout(60000);
+ socket.connect(new InetSocketAddress("localhost", port));
+ logger.fine("Established connection to NiFi instance.");
+ socket.setSoTimeout(60000);
- final List cpFiles = new ArrayList<>(confFiles.length + libFiles.length);
- cpFiles.add(confDir.getAbsolutePath());
- for ( final File file : libFiles ) {
- cpFiles.add(file.getAbsolutePath());
- }
-
- final StringBuilder classPathBuilder = new StringBuilder();
- for (int i=0; i < cpFiles.size(); i++) {
- final String filename = cpFiles.get(i);
- classPathBuilder.append(filename);
- if ( i < cpFiles.size() - 1 ) {
- classPathBuilder.append(File.pathSeparatorChar);
- }
- }
+ logger.log(Level.FINE, "Sending SHUTDOWN Command to port {0}", port);
+ final OutputStream out = socket.getOutputStream();
+ out.write((SHUTDOWN_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
+ out.flush();
- final String classPath = classPathBuilder.toString();
- String javaCmd = props.get("java");
- if (javaCmd == null) {
- javaCmd = DEFAULT_JAVA_CMD;
- }
- if (javaCmd.equals(DEFAULT_JAVA_CMD)) {
- String javaHome = System.getenv("JAVA_HOME");
- if (javaHome != null) {
- String fileExtension = isWindows() ? ".exe" : "";
- File javaFile = new File(javaHome + File.separatorChar + "bin"
- + File.separatorChar + "java" + fileExtension);
- if (javaFile.exists() && javaFile.canExecute()) {
- javaCmd = javaFile.getAbsolutePath();
- }
- }
- }
-
- final NiFiListener listener = new NiFiListener();
- final int listenPort = listener.start(this);
-
- String runAs = isWindows() ? null : props.get(RUN_AS_PROP);
- if ( runAs != null ) {
- runAs = runAs.trim();
- if ( runAs.isEmpty() ) {
- runAs = null;
- }
- }
-
- final List cmd = new ArrayList<>();
- if ( runAs != null ) {
- cmd.add("sudo");
- cmd.add("-u");
- cmd.add(runAs);
- }
- cmd.add(javaCmd);
- cmd.add("-classpath");
- cmd.add(classPath);
- cmd.addAll(javaAdditionalArgs);
- cmd.add("-Dnifi.properties.file.path=" + nifiPropsFilename);
- cmd.add("-Dnifi.bootstrap.listen.port=" + listenPort);
- cmd.add("-Dapp=NiFi");
- cmd.add("org.apache.nifi.NiFi");
-
- builder.command(cmd);
-
- final StringBuilder cmdBuilder = new StringBuilder();
- for ( final String s : cmd ) {
- cmdBuilder.append(s).append(" ");
- }
+ final InputStream in = socket.getInputStream();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ final String response = reader.readLine();
- logger.info("Starting Apache NiFi...");
- logger.info("Working Directory: " + workingDir.getAbsolutePath());
- logger.info("Command: " + cmdBuilder.toString());
-
- if ( monitor ) {
- String gracefulShutdown = props.get(GRACEFUL_SHUTDOWN_PROP);
- if ( gracefulShutdown == null ) {
- gracefulShutdown = DEFAULT_GRACEFUL_SHUTDOWN_VALUE;
- }
+ logger.log(Level.FINE, "Received response to SHUTDOWN command: {0}", response);
- final int gracefulShutdownSeconds;
- try {
- gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown);
- } catch (final NumberFormatException nfe) {
- throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
- }
-
- if ( gracefulShutdownSeconds < 0 ) {
- throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
- }
-
- Process process = builder.start();
- Long pid = getPid(process);
- if ( pid != null ) {
+ if (SHUTDOWN_CMD.equals(response)) {
+ logger.info("Apache NiFi has accepted the Shutdown Command and is shutting down now");
+
+ final String pid = nifiProps.getProperty("pid");
+ if (pid != null) {
+ final Properties bootstrapProperties = new Properties();
+ try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) {
+ bootstrapProperties.load(fis);
+ }
+
+ String gracefulShutdown = bootstrapProperties.getProperty(GRACEFUL_SHUTDOWN_PROP, DEFAULT_GRACEFUL_SHUTDOWN_VALUE);
+ int gracefulShutdownSeconds;
+ try {
+ gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown);
+ } catch (final NumberFormatException nfe) {
+ gracefulShutdownSeconds = Integer.parseInt(DEFAULT_GRACEFUL_SHUTDOWN_VALUE);
+ }
+
+ final long startWait = System.nanoTime();
+ while (isProcessRunning(pid)) {
+ logger.info("Waiting for Apache NiFi to finish shutting down...");
+ final long waitNanos = System.nanoTime() - startWait;
+ final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
+ if (waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0) {
+ if (isProcessRunning(pid)) {
+ logger.log(Level.WARNING, "NiFi has not finished shutting down after {0} seconds. Killing process.", gracefulShutdownSeconds);
+ try {
+ killProcessTree(pid);
+ } catch (final IOException ioe) {
+ logger.log(Level.SEVERE, "Failed to kill Process with PID {0}", pid);
+ }
+ }
+ break;
+ } else {
+ try {
+ Thread.sleep(2000L);
+ } catch (final InterruptedException ie) {
+ }
+ }
+ }
+
+ logger.info("NiFi has finished shutting down.");
+ }
+
+ final File statusFile = getStatusFile();
+ if (!statusFile.delete()) {
+ logger.log(Level.SEVERE, "Failed to delete status file {0}; this file should be cleaned up manually", statusFile);
+ }
+ } else {
+ logger.log(Level.SEVERE, "When sending SHUTDOWN command to NiFi, got unexpected response {0}", response);
+ }
+ } catch (final IOException ioe) {
+ logger.log(Level.SEVERE, "Failed to send shutdown command to port {0} due to {1}", new Object[]{port, ioe});
+ }
+ }
+
+ private static List getChildProcesses(final String ppid) throws IOException {
+ final Process proc = Runtime.getRuntime().exec(new String[]{"ps", "-o", "pid", "--no-headers", "--ppid", ppid});
+ final List childPids = new ArrayList<>();
+ try (final InputStream in = proc.getInputStream();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ childPids.add(line.trim());
+ }
+ }
+
+ return childPids;
+ }
+
+ private void killProcessTree(final String pid) throws IOException {
+ logger.log(Level.FINE, "Killing Process Tree for PID {0}", pid);
+
+ final List children = getChildProcesses(pid);
+ logger.log(Level.FINE, "Children of PID {0}: {1}", new Object[]{pid, children});
+
+ for (final String childPid : children) {
+ killProcessTree(childPid);
+ }
+
+ Runtime.getRuntime().exec(new String[]{"kill", "-9", pid});
+ }
+
+ public static boolean isAlive(final Process process) {
+ try {
+ process.exitValue();
+ return false;
+ } catch (final IllegalStateException | IllegalThreadStateException itse) {
+ return true;
+ }
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public void start(final boolean monitor) throws IOException, InterruptedException {
+ final Integer port = getCurrentPort();
+ if (port != null) {
+ System.out.println("Apache NiFi is already running, listening to Bootstrap on port " + port);
+ return;
+ }
+
+ final ProcessBuilder builder = new ProcessBuilder();
+
+ if (!bootstrapConfigFile.exists()) {
+ throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath());
+ }
+
+ final Properties properties = new Properties();
+ try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) {
+ properties.load(fis);
+ }
+
+ final Map props = new HashMap<>();
+ props.putAll((Map) properties);
+
+ final String specifiedWorkingDir = props.get("working.dir");
+ if (specifiedWorkingDir != null) {
+ builder.directory(new File(specifiedWorkingDir));
+ }
+
+ final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();
+ final File binDir = bootstrapConfigAbsoluteFile.getParentFile();
+ final File workingDir = binDir.getParentFile();
+
+ if (specifiedWorkingDir == null) {
+ builder.directory(workingDir);
+ }
+
+ final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim();
+ File libDir = getFile(libFilename, workingDir);
+
+ final String confFilename = replaceNull(props.get("conf.dir"), "./conf").trim();
+ File confDir = getFile(confFilename, workingDir);
+
+ String nifiPropsFilename = props.get("props.file");
+ if (nifiPropsFilename == null) {
+ if (confDir.exists()) {
+ nifiPropsFilename = new File(confDir, "nifi.properties").getAbsolutePath();
+ } else {
+ nifiPropsFilename = DEFAULT_CONFIG_FILE;
+ }
+ }
+
+ nifiPropsFilename = nifiPropsFilename.trim();
+
+ final List javaAdditionalArgs = new ArrayList<>();
+ for (final Map.Entry entry : props.entrySet()) {
+ final String key = entry.getKey();
+ final String value = entry.getValue();
+
+ if (key.startsWith("java.arg")) {
+ javaAdditionalArgs.add(value);
+ }
+ }
+
+ final File[] libFiles = libDir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(final File dir, final String filename) {
+ return filename.toLowerCase().endsWith(".jar");
+ }
+ });
+
+ if (libFiles == null || libFiles.length == 0) {
+ throw new RuntimeException("Could not find lib directory at " + libDir.getAbsolutePath());
+ }
+
+ final File[] confFiles = confDir.listFiles();
+ if (confFiles == null || confFiles.length == 0) {
+ throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath());
+ }
+
+ final List cpFiles = new ArrayList<>(confFiles.length + libFiles.length);
+ cpFiles.add(confDir.getAbsolutePath());
+ for (final File file : libFiles) {
+ cpFiles.add(file.getAbsolutePath());
+ }
+
+ final StringBuilder classPathBuilder = new StringBuilder();
+ for (int i = 0; i < cpFiles.size(); i++) {
+ final String filename = cpFiles.get(i);
+ classPathBuilder.append(filename);
+ if (i < cpFiles.size() - 1) {
+ classPathBuilder.append(File.pathSeparatorChar);
+ }
+ }
+
+ final String classPath = classPathBuilder.toString();
+ String javaCmd = props.get("java");
+ if (javaCmd == null) {
+ javaCmd = DEFAULT_JAVA_CMD;
+ }
+ if (javaCmd.equals(DEFAULT_JAVA_CMD)) {
+ String javaHome = System.getenv("JAVA_HOME");
+ if (javaHome != null) {
+ String fileExtension = isWindows() ? ".exe" : "";
+ File javaFile = new File(javaHome + File.separatorChar + "bin"
+ + File.separatorChar + "java" + fileExtension);
+ if (javaFile.exists() && javaFile.canExecute()) {
+ javaCmd = javaFile.getAbsolutePath();
+ }
+ }
+ }
+
+ final NiFiListener listener = new NiFiListener();
+ final int listenPort = listener.start(this);
+
+ String runAs = isWindows() ? null : props.get(RUN_AS_PROP);
+ if (runAs != null) {
+ runAs = runAs.trim();
+ if (runAs.isEmpty()) {
+ runAs = null;
+ }
+ }
+
+ final List cmd = new ArrayList<>();
+ if (runAs != null) {
+ cmd.add("sudo");
+ cmd.add("-u");
+ cmd.add(runAs);
+ }
+ cmd.add(javaCmd);
+ cmd.add("-classpath");
+ cmd.add(classPath);
+ cmd.addAll(javaAdditionalArgs);
+ cmd.add("-Dnifi.properties.file.path=" + nifiPropsFilename);
+ cmd.add("-Dnifi.bootstrap.listen.port=" + listenPort);
+ cmd.add("-Dapp=NiFi");
+ cmd.add("org.apache.nifi.NiFi");
+
+ builder.command(cmd);
+
+ final StringBuilder cmdBuilder = new StringBuilder();
+ for (final String s : cmd) {
+ cmdBuilder.append(s).append(" ");
+ }
+
+ logger.info("Starting Apache NiFi...");
+ logger.log(Level.INFO, "Working Directory: {0}", workingDir.getAbsolutePath());
+ logger.log(Level.INFO, "Command: {0}", cmdBuilder.toString());
+
+ if (monitor) {
+ String gracefulShutdown = props.get(GRACEFUL_SHUTDOWN_PROP);
+ if (gracefulShutdown == null) {
+ gracefulShutdown = DEFAULT_GRACEFUL_SHUTDOWN_VALUE;
+ }
+
+ final int gracefulShutdownSeconds;
+ try {
+ gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown);
+ } catch (final NumberFormatException nfe) {
+ throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File "
+ + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
+ }
+
+ if (gracefulShutdownSeconds < 0) {
+ throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File "
+ + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer");
+ }
+
+ Process process = builder.start();
+ Long pid = getPid(process);
+ if (pid != null) {
nifiPid = pid;
final Properties nifiProps = new Properties();
nifiProps.setProperty("pid", String.valueOf(nifiPid));
saveProperties(nifiProps);
}
-
- shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds);
- final Runtime runtime = Runtime.getRuntime();
- runtime.addShutdownHook(shutdownHook);
-
- while (true) {
- final boolean alive = isAlive(process);
-
- if ( alive ) {
- try {
- Thread.sleep(1000L);
- } catch (final InterruptedException ie) {
- }
- } else {
- try {
- runtime.removeShutdownHook(shutdownHook);
- } catch (final IllegalStateException ise) {
- // happens when already shutting down
- }
-
- if (autoRestartNiFi) {
- logger.warning("Apache NiFi appears to have died. Restarting...");
- process = builder.start();
-
- pid = getPid(process);
- if ( pid != null ) {
- nifiPid = pid;
- final Properties nifiProps = new Properties();
- nifiProps.setProperty("pid", String.valueOf(nifiPid));
- saveProperties(nifiProps);
- }
-
- shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds);
- runtime.addShutdownHook(shutdownHook);
-
- final boolean started = waitForStart();
-
- if ( started ) {
- logger.info("Successfully started Apache NiFi" + (pid == null ? "" : " with PID " + pid));
- } else {
- logger.severe("Apache NiFi does not appear to have started");
- }
- } else {
- return;
- }
- }
- }
- } else {
- final Process process = builder.start();
- final Long pid = getPid(process);
-
- if ( pid != null ) {
- nifiPid = pid;
+
+ shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds);
+ final Runtime runtime = Runtime.getRuntime();
+ runtime.addShutdownHook(shutdownHook);
+
+ while (true) {
+ final boolean alive = isAlive(process);
+
+ if (alive) {
+ try {
+ Thread.sleep(1000L);
+ } catch (final InterruptedException ie) {
+ }
+ } else {
+ try {
+ runtime.removeShutdownHook(shutdownHook);
+ } catch (final IllegalStateException ise) {
+ // happens when already shutting down
+ }
+
+ if (autoRestartNiFi) {
+ logger.warning("Apache NiFi appears to have died. Restarting...");
+ process = builder.start();
+
+ pid = getPid(process);
+ if (pid != null) {
+ nifiPid = pid;
+ final Properties nifiProps = new Properties();
+ nifiProps.setProperty("pid", String.valueOf(nifiPid));
+ saveProperties(nifiProps);
+ }
+
+ shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds);
+ runtime.addShutdownHook(shutdownHook);
+
+ final boolean started = waitForStart();
+
+ if (started) {
+ logger.log(Level.INFO, "Successfully started Apache NiFi{0}", (pid == null ? "" : " with PID " + pid));
+ } else {
+ logger.severe("Apache NiFi does not appear to have started");
+ }
+ } else {
+ return;
+ }
+ }
+ }
+ } else {
+ final Process process = builder.start();
+ final Long pid = getPid(process);
+
+ if (pid != null) {
+ nifiPid = pid;
final Properties nifiProps = new Properties();
nifiProps.setProperty("pid", String.valueOf(nifiPid));
saveProperties(nifiProps);
- }
-
- boolean started = waitForStart();
-
- if ( started ) {
- logger.info("Successfully started Apache NiFi" + (pid == null ? "" : " with PID " + pid));
- } else {
- logger.severe("Apache NiFi does not appear to have started");
- }
-
- listener.stop();
- }
- }
-
-
- private Long getPid(final Process process) {
- try {
+ }
+
+ boolean started = waitForStart();
+
+ if (started) {
+ logger.log(Level.INFO, "Successfully started Apache NiFi{0}", (pid == null ? "" : " with PID " + pid));
+ } else {
+ logger.severe("Apache NiFi does not appear to have started");
+ }
+
+ listener.stop();
+ }
+ }
+
+ private Long getPid(final Process process) {
+ try {
final Class> procClass = process.getClass();
final Field pidField = procClass.getDeclaredField("pid");
pidField.setAccessible(true);
final Object pidObject = pidField.get(process);
-
- logger.fine("PID Object = " + pidObject);
-
- if ( pidObject instanceof Number ) {
+
+ logger.log(Level.FINE, "PID Object = {0}", pidObject);
+
+ if (pidObject instanceof Number) {
return ((Number) pidObject).longValue();
}
return null;
} catch (final IllegalAccessException | NoSuchFieldException nsfe) {
- logger.fine("Could not find PID for child process due to " + nsfe);
+ logger.log(Level.FINE, "Could not find PID for child process due to {0}", nsfe);
return null;
}
- }
-
- private boolean isWindows() {
- final String osName = System.getProperty("os.name");
- return osName != null && osName.toLowerCase().contains("win");
- }
-
- private boolean waitForStart() {
- lock.lock();
- try {
- final long startTime = System.nanoTime();
-
- while ( ccPort < 1 ) {
- try {
- startupCondition.await(1, TimeUnit.SECONDS);
- } catch (final InterruptedException ie) {
- return false;
- }
-
- final long waitNanos = System.nanoTime() - startTime;
- final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
- if (waitSeconds > STARTUP_WAIT_SECONDS) {
- return false;
- }
- }
- } finally {
- lock.unlock();
- }
- return true;
- }
-
- private File getFile(final String filename, final File workingDir) {
- File file = new File(filename);
- if ( !file.isAbsolute() ) {
- file = new File(workingDir, filename);
- }
-
- return file;
- }
-
- private String replaceNull(final String value, final String replacement) {
- return (value == null) ? replacement : value;
- }
-
- void setAutoRestartNiFi(final boolean restart) {
- this.autoRestartNiFi = restart;
- }
-
- void setNiFiCommandControlPort(final int port, final String secretKey) {
- this.ccPort = port;
- this.secretKey = secretKey;
-
- if ( shutdownHook != null ) {
- shutdownHook.setSecretKey(secretKey);
- }
-
- final File statusFile = getStatusFile();
-
- final Properties nifiProps = new Properties();
- if ( nifiPid != -1 ) {
- nifiProps.setProperty("pid", String.valueOf(nifiPid));
- }
- nifiProps.setProperty("port", String.valueOf(ccPort));
- nifiProps.setProperty("secret.key", secretKey);
-
- try {
- saveProperties(nifiProps);
- } catch (final IOException ioe) {
- logger.warning("Apache NiFi has started but failed to persist NiFi Port information to " + statusFile.getAbsolutePath() + " due to " + ioe);
- }
-
- logger.info("Apache NiFi now running and listening for Bootstrap requests on port " + port);
- }
-
- int getNiFiCommandControlPort() {
- return this.ccPort;
- }
-
-
- private static class Status {
- private final Integer port;
- private final String pid;
-
- private final Boolean respondingToPing;
- private final Boolean processRunning;
-
- public Status(final Integer port, final String pid, final Boolean respondingToPing, final Boolean processRunning) {
- this.port = port;
- this.pid = pid;
- this.respondingToPing = respondingToPing;
- this.processRunning = processRunning;
- }
-
- public String getPid() {
- return pid;
- }
-
- public Integer getPort() {
- return port;
- }
-
- public boolean isRespondingToPing() {
- return Boolean.TRUE.equals(respondingToPing);
- }
-
+ }
+
+ private boolean isWindows() {
+ final String osName = System.getProperty("os.name");
+ return osName != null && osName.toLowerCase().contains("win");
+ }
+
+ private boolean waitForStart() {
+ lock.lock();
+ try {
+ final long startTime = System.nanoTime();
+
+ while (ccPort < 1) {
+ try {
+ startupCondition.await(1, TimeUnit.SECONDS);
+ } catch (final InterruptedException ie) {
+ return false;
+ }
+
+ final long waitNanos = System.nanoTime() - startTime;
+ final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
+ if (waitSeconds > STARTUP_WAIT_SECONDS) {
+ return false;
+ }
+ }
+ } finally {
+ lock.unlock();
+ }
+ return true;
+ }
+
+ private File getFile(final String filename, final File workingDir) {
+ File file = new File(filename);
+ if (!file.isAbsolute()) {
+ file = new File(workingDir, filename);
+ }
+
+ return file;
+ }
+
+ private String replaceNull(final String value, final String replacement) {
+ return (value == null) ? replacement : value;
+ }
+
+ void setAutoRestartNiFi(final boolean restart) {
+ this.autoRestartNiFi = restart;
+ }
+
+ void setNiFiCommandControlPort(final int port, final String secretKey) {
+ this.ccPort = port;
+ this.secretKey = secretKey;
+
+ if (shutdownHook != null) {
+ shutdownHook.setSecretKey(secretKey);
+ }
+
+ final File statusFile = getStatusFile();
+
+ final Properties nifiProps = new Properties();
+ if (nifiPid != -1) {
+ nifiProps.setProperty("pid", String.valueOf(nifiPid));
+ }
+ nifiProps.setProperty("port", String.valueOf(ccPort));
+ nifiProps.setProperty("secret.key", secretKey);
+
+ try {
+ saveProperties(nifiProps);
+ } catch (final IOException ioe) {
+ logger.log(Level.WARNING, "Apache NiFi has started but failed to persist NiFi Port information to {0} due to {1}", new Object[]{statusFile.getAbsolutePath(), ioe});
+ }
+
+ logger.log(Level.INFO, "Apache NiFi now running and listening for Bootstrap requests on port {0}", port);
+ }
+
+ int getNiFiCommandControlPort() {
+ return this.ccPort;
+ }
+
+ private static class Status {
+
+ private final Integer port;
+ private final String pid;
+
+ private final Boolean respondingToPing;
+ private final Boolean processRunning;
+
+ public Status(final Integer port, final String pid, final Boolean respondingToPing, final Boolean processRunning) {
+ this.port = port;
+ this.pid = pid;
+ this.respondingToPing = respondingToPing;
+ this.processRunning = processRunning;
+ }
+
+ public String getPid() {
+ return pid;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public boolean isRespondingToPing() {
+ return Boolean.TRUE.equals(respondingToPing);
+ }
+
public boolean isProcessRunning() {
return Boolean.TRUE.equals(processRunning);
}
- }
+ }
}
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java
index 3d3a241328..023ab84e64 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java
@@ -24,63 +24,65 @@ import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
public class ShutdownHook extends Thread {
- private final Process nifiProcess;
- private final RunNiFi runner;
- private final int gracefulShutdownSeconds;
-
- private volatile String secretKey;
-
- public ShutdownHook(final Process nifiProcess, final RunNiFi runner, final String secretKey, final int gracefulShutdownSeconds) {
- this.nifiProcess = nifiProcess;
- this.runner = runner;
- this.secretKey = secretKey;
- this.gracefulShutdownSeconds = gracefulShutdownSeconds;
- }
-
- void setSecretKey(final String secretKey) {
- this.secretKey = secretKey;
- }
-
- @Override
- public void run() {
- runner.setAutoRestartNiFi(false);
- final int ccPort = runner.getNiFiCommandControlPort();
- if ( ccPort > 0 ) {
- System.out.println("Initiating Shutdown of NiFi...");
-
- try {
- final Socket socket = new Socket("localhost", ccPort);
- final OutputStream out = socket.getOutputStream();
- out.write(("SHUTDOWN " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
- out.flush();
-
- socket.close();
- } catch (final IOException ioe) {
- System.out.println("Failed to Shutdown NiFi due to " + ioe);
- }
- }
-
- System.out.println("Waiting for Apache NiFi to finish shutting down...");
- final long startWait = System.nanoTime();
- while ( RunNiFi.isAlive(nifiProcess) ) {
- final long waitNanos = System.nanoTime() - startWait;
- final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
- if ( waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0 ) {
- if ( RunNiFi.isAlive(nifiProcess) ) {
- System.out.println("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process.");
- nifiProcess.destroy();
- }
- break;
- } else {
- try {
- Thread.sleep(1000L);
- } catch (final InterruptedException ie) {}
- }
- }
-
- final File statusFile = runner.getStatusFile();
- if ( !statusFile.delete() ) {
- System.err.println("Failed to delete status file " + statusFile.getAbsolutePath() + "; this file should be cleaned up manually");
- }
- }
+
+ private final Process nifiProcess;
+ private final RunNiFi runner;
+ private final int gracefulShutdownSeconds;
+
+ private volatile String secretKey;
+
+ public ShutdownHook(final Process nifiProcess, final RunNiFi runner, final String secretKey, final int gracefulShutdownSeconds) {
+ this.nifiProcess = nifiProcess;
+ this.runner = runner;
+ this.secretKey = secretKey;
+ this.gracefulShutdownSeconds = gracefulShutdownSeconds;
+ }
+
+ void setSecretKey(final String secretKey) {
+ this.secretKey = secretKey;
+ }
+
+ @Override
+ public void run() {
+ runner.setAutoRestartNiFi(false);
+ final int ccPort = runner.getNiFiCommandControlPort();
+ if (ccPort > 0) {
+ System.out.println("Initiating Shutdown of NiFi...");
+
+ try {
+ final Socket socket = new Socket("localhost", ccPort);
+ final OutputStream out = socket.getOutputStream();
+ out.write(("SHUTDOWN " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
+ out.flush();
+
+ socket.close();
+ } catch (final IOException ioe) {
+ System.out.println("Failed to Shutdown NiFi due to " + ioe);
+ }
+ }
+
+ System.out.println("Waiting for Apache NiFi to finish shutting down...");
+ final long startWait = System.nanoTime();
+ while (RunNiFi.isAlive(nifiProcess)) {
+ final long waitNanos = System.nanoTime() - startWait;
+ final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos);
+ if (waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0) {
+ if (RunNiFi.isAlive(nifiProcess)) {
+ System.out.println("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process.");
+ nifiProcess.destroy();
+ }
+ break;
+ } else {
+ try {
+ Thread.sleep(1000L);
+ } catch (final InterruptedException ie) {
+ }
+ }
+ }
+
+ final File statusFile = runner.getStatusFile();
+ if (!statusFile.delete()) {
+ System.err.println("Failed to delete status file " + statusFile.getAbsolutePath() + "; this file should be cleaned up manually");
+ }
+ }
}
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java
index 962aa1c39d..52e36b9a0e 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java
@@ -17,21 +17,22 @@
package org.apache.nifi.bootstrap.exception;
public class InvalidCommandException extends Exception {
- private static final long serialVersionUID = 1L;
- public InvalidCommandException() {
- super();
- }
-
- public InvalidCommandException(final String message) {
- super(message);
- }
-
- public InvalidCommandException(final Throwable t) {
- super(t);
- }
-
- public InvalidCommandException(final String message, final Throwable t) {
- super(message, t);
- }
+ private static final long serialVersionUID = 1L;
+
+ public InvalidCommandException() {
+ super();
+ }
+
+ public InvalidCommandException(final String message) {
+ super(message);
+ }
+
+ public InvalidCommandException(final Throwable t) {
+ super(t);
+ }
+
+ public InvalidCommandException(final String message, final Throwable t) {
+ super(message, t);
+ }
}
diff --git a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java
index dc24a93fe4..4a52a89bbf 100644
--- a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java
+++ b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java
@@ -27,6 +27,7 @@ import org.apache.nifi.provenance.lineage.LineageComputationType;
*
*/
public class AsyncLineageSubmission implements ComputeLineageSubmission {
+
private final String lineageIdentifier = UUID.randomUUID().toString();
private final Date submissionTime = new Date();
diff --git a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java
index 42444762be..00c617052f 100644
--- a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java
+++ b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java
@@ -22,9 +22,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.nifi.provenance.search.Query;
import org.apache.nifi.provenance.search.QuerySubmission;
-/**
- *
- */
public class AsyncQuerySubmission implements QuerySubmission {
public static final int TTL = (int) TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS);
@@ -40,8 +37,8 @@ public class AsyncQuerySubmission implements QuerySubmission {
* number of steps, indicating how many results must be added to this
* AsyncQuerySubmission before it is considered finished
*
- * @param query
- * @param numSteps
+ * @param query the query to execute
+ * @param numSteps how many steps to include
*/
public AsyncQuerySubmission(final Query query, final int numSteps) {
this.query = query;
diff --git a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java
index 97c988029a..de62bca813 100644
--- a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java
+++ b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java
@@ -41,14 +41,21 @@ public class SearchableFields {
public static final SearchableField Details = new NamedSearchableField("Details", "details", "Details", false, SearchableFieldType.STRING);
public static final SearchableField Relationship = new NamedSearchableField("Relationship", "relationship", "Relationship", false, SearchableFieldType.STRING);
- public static final SearchableField LineageStartDate = new NamedSearchableField("LineageStartDate", "lineageStartDate", "Lineage Start Date", false, SearchableFieldType.DATE);
- public static final SearchableField LineageIdentifier = new NamedSearchableField("LineageIdentifiers", "lineageIdentifier", "Lineage Identifier", false, SearchableFieldType.STRING);
+ public static final SearchableField LineageStartDate
+ = new NamedSearchableField("LineageStartDate", "lineageStartDate", "Lineage Start Date", false, SearchableFieldType.DATE);
+ public static final SearchableField LineageIdentifier
+ = new NamedSearchableField("LineageIdentifiers", "lineageIdentifier", "Lineage Identifier", false, SearchableFieldType.STRING);
- public static final SearchableField ContentClaimSection = new NamedSearchableField("ContentClaimSection", "contentClaimSection", "Content Claim Section", false, SearchableFieldType.STRING);
- public static final SearchableField ContentClaimContainer = new NamedSearchableField("ContentClaimContainer", "contentClaimContainer", "Content Claim Container", false, SearchableFieldType.STRING);
- public static final SearchableField ContentClaimIdentifier = new NamedSearchableField("ContentClaimIdentifier", "contentClaimIdentifier", "Content Claim Identifier", false, SearchableFieldType.STRING);
- public static final SearchableField ContentClaimOffset = new NamedSearchableField("ContentClaimOffset", "contentClaimOffset", "Content Claim Offset", false, SearchableFieldType.LONG);
- public static final SearchableField SourceQueueIdentifier = new NamedSearchableField("SourceQueueIdentifier", "sourceQueueIdentifier", "Source Queue Identifier", false, SearchableFieldType.STRING);
+ public static final SearchableField ContentClaimSection
+ = new NamedSearchableField("ContentClaimSection", "contentClaimSection", "Content Claim Section", false, SearchableFieldType.STRING);
+ public static final SearchableField ContentClaimContainer
+ = new NamedSearchableField("ContentClaimContainer", "contentClaimContainer", "Content Claim Container", false, SearchableFieldType.STRING);
+ public static final SearchableField ContentClaimIdentifier
+ = new NamedSearchableField("ContentClaimIdentifier", "contentClaimIdentifier", "Content Claim Identifier", false, SearchableFieldType.STRING);
+ public static final SearchableField ContentClaimOffset
+ = new NamedSearchableField("ContentClaimOffset", "contentClaimOffset", "Content Claim Offset", false, SearchableFieldType.LONG);
+ public static final SearchableField SourceQueueIdentifier
+ = new NamedSearchableField("SourceQueueIdentifier", "sourceQueueIdentifier", "Source Queue Identifier", false, SearchableFieldType.STRING);
private static final Map standardFields;
diff --git a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/StandardLineageResult.java b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/StandardLineageResult.java
index afb56e8bdb..63c53d0635 100644
--- a/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/StandardLineageResult.java
+++ b/nifi/nifi-commons/nifi-data-provenance-utils/src/main/java/org/apache/nifi/provenance/StandardLineageResult.java
@@ -266,7 +266,8 @@ public class StandardLineageResult implements ComputeLineageResult {
final FlowFileNode childNode = new FlowFileNode(childUuid, record.getEventTime());
final boolean isNewFlowFile = nodes.add(childNode);
if (!isNewFlowFile) {
- final String msg = "Unable to generate Lineage Graph because multiple events were registered claiming to have generated the same FlowFile (UUID = " + childNode.getFlowFileUuid() + ")";
+ final String msg = "Unable to generate Lineage Graph because multiple "
+ + "events were registered claiming to have generated the same FlowFile (UUID = " + childNode.getFlowFileUuid() + ")";
logger.error(msg);
setError(msg);
return;
@@ -288,12 +289,13 @@ public class StandardLineageResult implements ComputeLineageResult {
break;
case RECEIVE:
case CREATE: {
- // for a receive event, we want to create a FlowFile Node that represents the FlowFile received
+ // for a receive event, we want to create a FlowFile Node that represents the FlowFile received
// and create an edge from the Receive Event to the FlowFile Node
final LineageNode flowFileNode = new FlowFileNode(record.getFlowFileUuid(), record.getEventTime());
final boolean isNewFlowFile = nodes.add(flowFileNode);
if (!isNewFlowFile) {
- final String msg = "Found cycle in graph. This indicates that multiple events were registered claiming to have generated the same FlowFile (UUID = " + flowFileNode.getFlowFileUuid() + ")";
+ final String msg = "Found cycle in graph. This indicates that multiple events "
+ + "were registered claiming to have generated the same FlowFile (UUID = " + flowFileNode.getFlowFileUuid() + ")";
setError(msg);
logger.error(msg);
return;
diff --git a/nifi/nifi-commons/nifi-expression-language/pom.xml b/nifi/nifi-commons/nifi-expression-language/pom.xml
index 3521b55ebf..e27f5b1e17 100644
--- a/nifi/nifi-commons/nifi-expression-language/pom.xml
+++ b/nifi/nifi-commons/nifi-expression-language/pom.xml
@@ -34,6 +34,13 @@
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+ **/antlr/AttributeExpressionParser.java,**/antlr/AttributeExpressionLexer.java
+
+
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
index e23bcc0972..a29e7922da 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
@@ -23,21 +23,22 @@ import org.apache.nifi.expression.AttributeValueDecorator;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.processor.exception.ProcessException;
-
/**
- * An implementation of PreparedQuery that throws an {@link AttributeExpressionLanguageException} when attempting
- * to evaluate the query. This allows a PreparedQuery to be created, even though it can't
- * be evaluated.
+ * An implementation of PreparedQuery that throws an
+ * {@link AttributeExpressionLanguageException} when attempting to evaluate the
+ * query. This allows a PreparedQuery to be created, even though it can't be
+ * evaluated.
*/
public class InvalidPreparedQuery implements PreparedQuery {
+
private final String query;
private final String explanation;
-
+
public InvalidPreparedQuery(final String query, final String explanation) {
this.query = query;
this.explanation = explanation;
}
-
+
@Override
public String evaluateExpressions(final FlowFile flowFile, final AttributeValueDecorator decorator) throws ProcessException {
throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation);
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
index 420a8e21c7..7e40897ac9 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
@@ -16,8 +16,6 @@
*/
package org.apache.nifi.attribute.expression.language;
-import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.*;
-
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
@@ -116,6 +114,73 @@ import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.tree.Tree;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ALL_ATTRIBUTES;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ALL_DELINEATED_VALUES;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ALL_MATCHING_ATTRIBUTES;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.AND;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ANY_ATTRIBUTE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ANY_DELINEATED_VALUE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ANY_MATCHING_ATTRIBUTE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.APPEND;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ATTRIBUTE_REFERENCE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ATTR_NAME;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.CONTAINS;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.COUNT;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.DIVIDE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.ENDS_WITH;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.EQUALS;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.EQUALS_IGNORE_CASE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.EXPRESSION;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.FALSE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.FIND;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.FORMAT;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.GREATER_THAN;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.GREATER_THAN_OR_EQUAL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.HOSTNAME;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.INDEX_OF;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.IP;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.IS_EMPTY;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.IS_NULL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.JOIN;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.LAST_INDEX_OF;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.LENGTH;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.LESS_THAN;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.LESS_THAN_OR_EQUAL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.MATCHES;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.MINUS;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.MOD;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.MULTIPLY;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.MULTI_ATTRIBUTE_REFERENCE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.NEXT_INT;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.NOT;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.NOT_NULL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.NOW;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.NUMBER;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.OR;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.PLUS;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.PREPEND;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.REPLACE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.REPLACE_ALL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.REPLACE_EMPTY;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.REPLACE_NULL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.STARTS_WITH;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.STRING_LITERAL;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.SUBSTRING;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.SUBSTRING_AFTER;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.SUBSTRING_AFTER_LAST;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.SUBSTRING_BEFORE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.SUBSTRING_BEFORE_LAST;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_DATE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_LOWER;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_NUMBER;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_RADIX;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_STRING;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TO_UPPER;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TRIM;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.TRUE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.URL_DECODE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.URL_ENCODE;
+import static org.apache.nifi.attribute.expression.language.antlr.AttributeExpressionParser.UUID;
import org.apache.nifi.attribute.expression.language.evaluation.selection.MappingEvaluator;
/**
@@ -229,11 +294,9 @@ public class Query {
}
/**
- *
- *
- * @param value
- * @param allowSurroundingCharacters
- * @throws AttributeExpressionLanguageParsingException
+ * @param value expression to validate
+ * @param allowSurroundingCharacters whether to allow surrounding chars
+ * @throws AttributeExpressionLanguageParsingException if problems parsing given expression
*/
public static void validateExpression(final String value, final boolean allowSurroundingCharacters) throws AttributeExpressionLanguageParsingException {
if (!allowSurroundingCharacters) {
@@ -333,8 +396,8 @@ public class Query {
/**
* Un-escapes ${...} patterns that were escaped
*
- * @param value
- * @return
+ * @param value to un-escape
+ * @return un-escaped value
*/
public static String unescape(final String value) {
return value.replaceAll("\\$\\$(?=\\$*\\{.*?\\})", "\\$");
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanEvaluator.java
index 6c712bbda0..af1ee1d13c 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanEvaluator.java
@@ -49,9 +49,6 @@ public class GreaterThanEvaluator extends BooleanEvaluator {
return new BooleanQueryResult(subjectValue > comparisonValue);
}
- ;
-
-
@Override
public Evaluator> getSubjectEvaluator() {
return subject;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanOrEqualEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanOrEqualEvaluator.java
index 98951f27e1..1269fc0b0a 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanOrEqualEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/GreaterThanOrEqualEvaluator.java
@@ -49,9 +49,6 @@ public class GreaterThanOrEqualEvaluator extends BooleanEvaluator {
return new BooleanQueryResult(subjectValue >= comparisonValue);
}
- ;
-
-
@Override
public Evaluator> getSubjectEvaluator() {
return subject;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/IsEmptyEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/IsEmptyEvaluator.java
index c5e3c2188f..e6e9fc9eb6 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/IsEmptyEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/IsEmptyEvaluator.java
@@ -24,12 +24,13 @@ import org.apache.nifi.attribute.expression.language.evaluation.Evaluator;
import org.apache.nifi.attribute.expression.language.evaluation.QueryResult;
public class IsEmptyEvaluator extends BooleanEvaluator {
+
private final Evaluator> subjectEvaluator;
-
+
public IsEmptyEvaluator(final Evaluator> subjectEvaluator) {
this.subjectEvaluator = subjectEvaluator;
}
-
+
@Override
public QueryResult evaluate(final Map attributes) {
final Object subjectValue = subjectEvaluator.evaluate(attributes).getValue();
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanEvaluator.java
index 9a589103c6..4b1beac776 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanEvaluator.java
@@ -49,9 +49,6 @@ public class LessThanEvaluator extends BooleanEvaluator {
return new BooleanQueryResult(subjectValue < comparisonValue);
}
- ;
-
-
@Override
public Evaluator> getSubjectEvaluator() {
return subject;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanOrEqualEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanOrEqualEvaluator.java
index 10f3f6aad8..a07e8be521 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanOrEqualEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/LessThanOrEqualEvaluator.java
@@ -49,9 +49,6 @@ public class LessThanOrEqualEvaluator extends BooleanEvaluator {
return new BooleanQueryResult(subjectValue <= comparisonValue);
}
- ;
-
-
@Override
public Evaluator> getSubjectEvaluator() {
return subject;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/ReplaceEmptyEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/ReplaceEmptyEvaluator.java
index e5c40d229b..fe08303e41 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/ReplaceEmptyEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/ReplaceEmptyEvaluator.java
@@ -23,20 +23,21 @@ import org.apache.nifi.attribute.expression.language.evaluation.QueryResult;
import org.apache.nifi.attribute.expression.language.evaluation.StringEvaluator;
public class ReplaceEmptyEvaluator extends StringEvaluator {
+
private final StringEvaluator subjectEvaluator;
private final StringEvaluator replacementEvaluator;
-
+
public ReplaceEmptyEvaluator(final StringEvaluator subjectEvaluator, final StringEvaluator replacementEvaluator) {
this.subjectEvaluator = subjectEvaluator;
this.replacementEvaluator = replacementEvaluator;
}
-
+
@Override
public QueryResult evaluate(final Map attributes) {
final QueryResult subjectResult = subjectEvaluator.evaluate(attributes);
final String subjectValue = subjectResult.getValue();
final boolean isEmpty = subjectValue == null || subjectValue.toString().trim().isEmpty();
- if ( isEmpty ) {
+ if (isEmpty) {
return replacementEvaluator.evaluate(attributes);
} else {
return subjectResult;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/CountEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/CountEvaluator.java
index f2af268813..f3fb21d638 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/CountEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/CountEvaluator.java
@@ -28,19 +28,19 @@ public class CountEvaluator extends NumberEvaluator implements ReduceEvaluator subjectEvaluator;
private long count = 0L;
-
+
public CountEvaluator(final Evaluator> subjectEvaluator) {
this.subjectEvaluator = subjectEvaluator;
}
-
+
@Override
public QueryResult evaluate(final Map attributes) {
final QueryResult> result = subjectEvaluator.evaluate(attributes);
- if ( result.getValue() == null ) {
+ if (result.getValue() == null) {
return new NumberQueryResult(count);
}
-
- if ( result.getResultType() == ResultType.BOOLEAN && ((Boolean) result.getValue()).equals(Boolean.FALSE) ) {
+
+ if (result.getResultType() == ResultType.BOOLEAN && ((Boolean) result.getValue()).equals(Boolean.FALSE)) {
return new NumberQueryResult(count);
}
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/JoinEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/JoinEvaluator.java
index eefdadad19..81c325da9e 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/JoinEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/reduce/JoinEvaluator.java
@@ -24,34 +24,35 @@ import org.apache.nifi.attribute.expression.language.evaluation.StringEvaluator;
import org.apache.nifi.attribute.expression.language.evaluation.StringQueryResult;
public class JoinEvaluator extends StringEvaluator implements ReduceEvaluator {
+
private final StringEvaluator subjectEvaluator;
private final StringEvaluator delimiterEvaluator;
-
+
private final StringBuilder sb = new StringBuilder();
private int evalCount = 0;
-
+
public JoinEvaluator(final StringEvaluator subject, final StringEvaluator delimiter) {
this.subjectEvaluator = subject;
this.delimiterEvaluator = delimiter;
}
-
+
@Override
public QueryResult evaluate(final Map attributes) {
String subject = subjectEvaluator.evaluate(attributes).getValue();
- if ( subject == null ) {
+ if (subject == null) {
subject = "";
}
-
+
final String delimiter = delimiterEvaluator.evaluate(attributes).getValue();
- if ( evalCount > 0 ) {
+ if (evalCount > 0) {
sb.append(delimiter);
}
sb.append(subject);
evalCount++;
- return new StringQueryResult( sb.toString() );
+ return new StringQueryResult(sb.toString());
}
-
+
@Override
public Evaluator> getSubjectEvaluator() {
return subjectEvaluator;
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MappingEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MappingEvaluator.java
index d872b6e4c2..2b8c488b43 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MappingEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MappingEvaluator.java
@@ -24,19 +24,20 @@ import org.apache.nifi.attribute.expression.language.evaluation.reduce.ReduceEva
import org.apache.nifi.expression.AttributeExpression.ResultType;
public class MappingEvaluator implements Evaluator {
+
private final ReduceEvaluator mappingEvaluator;
private final MultiAttributeEvaluator multiAttributeEvaluator;
-
+
public MappingEvaluator(final ReduceEvaluator mappingEvaluator, final MultiAttributeEvaluator multiAttributeEval) {
this.mappingEvaluator = mappingEvaluator;
this.multiAttributeEvaluator = multiAttributeEval;
}
-
+
@Override
public QueryResult evaluate(final Map attributes) {
QueryResult result = mappingEvaluator.evaluate(attributes);
- while ( multiAttributeEvaluator.getEvaluationsRemaining() > 0 ) {
+ while (multiAttributeEvaluator.getEvaluationsRemaining() > 0) {
result = mappingEvaluator.evaluate(attributes);
}
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MultiMatchAttributeEvaluator.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MultiMatchAttributeEvaluator.java
index 9a441ce35b..1d0be8bf61 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MultiMatchAttributeEvaluator.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/selection/MultiMatchAttributeEvaluator.java
@@ -44,7 +44,7 @@ public class MultiMatchAttributeEvaluator extends MultiAttributeEvaluator {
/**
* Can be called only after the first call to evaluate
*
- * @return
+ * @return number of remaining evaluations
*/
@Override
public int getEvaluationsRemaining() {
diff --git a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/exception/IllegalAttributeException.java b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/exception/IllegalAttributeException.java
index f6f32cac7d..ec94837c75 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/exception/IllegalAttributeException.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/exception/IllegalAttributeException.java
@@ -17,6 +17,7 @@
package org.apache.nifi.attribute.expression.language.exception;
public class IllegalAttributeException extends RuntimeException {
+
private static final long serialVersionUID = 12348721897342L;
public IllegalAttributeException() {
diff --git a/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java b/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
index 8dfbaf16b8..4bf614f0db 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
@@ -55,7 +55,7 @@ public class TestQuery {
// left here because it's convenient for looking at the output
//System.out.println(Query.compile("").evaluate(null));
}
-
+
private void assertValid(final String query) {
try {
Query.compile(query);
@@ -64,7 +64,7 @@ public class TestQuery {
Assert.fail("Expected query to be valid, but it failed to compile due to " + e);
}
}
-
+
private void assertInvalid(final String query) {
try {
Query.compile(query);
@@ -72,63 +72,61 @@ public class TestQuery {
} catch (final Exception e) {
}
}
-
+
@Test
public void testIsValidExpression() {
Query.validateExpression("${abc:substring(${xyz:length()})}", false);
Query.isValidExpression("${now():format('yyyy-MM-dd')}");
-
-
+
try {
Query.validateExpression("$${attr}", false);
Assert.fail("invalid query validated");
} catch (final AttributeExpressionLanguageParsingException e) {
}
-
+
Query.validateExpression("$${attr}", true);
-
- Query.validateExpression("${filename:startsWith('T8MTXBC')\n"
- + ":or( ${filename:startsWith('C4QXABC')} )\n"
- + ":or( ${filename:startsWith('U6CXEBC')} )"
- + ":or( ${filename:startsWith('KYM3ABC')} )}", false);
+
+ Query.validateExpression("${filename:startsWith('T8MTXBC')\n"
+ + ":or( ${filename:startsWith('C4QXABC')} )\n"
+ + ":or( ${filename:startsWith('U6CXEBC')} )"
+ + ":or( ${filename:startsWith('KYM3ABC')} )}", false);
}
-
@Test
public void testCompileEmbedded() {
final String expression = "${x:equals( ${y} )}";
final Query query = Query.compile(expression);
final Tree tree = query.getTree();
- System.out.println( printTree(tree) );
-
+ System.out.println(printTree(tree));
+
final Map attributes = new HashMap<>();
attributes.put("x", "x");
attributes.put("y", "x");
final String result = Query.evaluateExpressions(expression, attributes, null);
assertEquals("true", result);
-
+
Query.validateExpression(expression, false);
}
-
+
private String printTree(final Tree tree) {
final StringBuilder sb = new StringBuilder();
printTree(tree, 0, sb);
-
+
return sb.toString();
}
-
+
private void printTree(final Tree tree, final int spaces, final StringBuilder sb) {
- for (int i=0; i < spaces; i++) {
+ for (int i = 0; i < spaces; i++) {
sb.append(" ");
}
-
- if ( tree.getText().trim().isEmpty() ) {
+
+ if (tree.getText().trim().isEmpty()) {
sb.append(tree.toString()).append("\n");
} else {
sb.append(tree.getText()).append("\n");
}
-
- for (int i=0; i < tree.getChildCount(); i++) {
+
+ for (int i = 0; i < tree.getChildCount(); i++) {
printTree(tree.getChild(i), spaces + 2, sb);
}
}
@@ -138,7 +136,7 @@ public class TestQuery {
final Map attributes = new HashMap<>();
attributes.put("attr", "My Value");
attributes.put("${xx}", "hello");
-
+
assertEquals("My Value", evaluateQueryForEscape("${attr}", attributes));
assertEquals("${attr}", evaluateQueryForEscape("$${attr}", attributes));
assertEquals("$My Value", evaluateQueryForEscape("$$${attr}", attributes));
@@ -151,15 +149,15 @@ public class TestQuery {
final Map attributes = new HashMap<>();
attributes.put("x", "C:\\test\\1.txt");
attributes.put("y", "y\ny");
-
+
final String query = "${x:substringAfterLast( '/' ):substringAfterLast( '\\\\' )}";
verifyEquals(query, attributes, "1.txt");
attributes.put("x", "C:/test/1.txt");
verifyEquals(query, attributes, "1.txt");
-
+
verifyEquals("${y:equals('y\\ny')}", attributes, Boolean.TRUE);
}
-
+
@Test
public void testWithTicksOutside() {
final Map attributes = new HashMap<>();
@@ -174,14 +172,13 @@ public class TestQuery {
assertEquals("'My Value", Query.evaluateExpressions("'${attr}", attributes, null));
}
-
@Test
@Ignore("Depends on TimeZone")
public void testDateToNumber() {
final Query query = Query.compile("${dateTime:toDate('yyyy/MM/dd HH:mm:ss.SSS'):toNumber()}");
final Map attributes = new HashMap<>();
attributes.put("dateTime", "2013/11/18 10:22:27.678");
-
+
final QueryResult> result = query.evaluate(attributes);
assertEquals(ResultType.NUMBER, result.getResultType());
assertEquals(1384788147678L, result.getValue());
@@ -203,35 +200,34 @@ public class TestQuery {
final Query query = Query.compile("${dateTime:format('yyyy/MM/dd HH:mm:ss.SSS')}");
final Map attributes = new HashMap<>();
attributes.put("dateTime", date.toString());
-
+
// the date.toString() above will end up truncating the milliseconds. So remove millis from the Date before
// formatting it
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.US);
final long millis = date.getTime() % 1000L;
final Date roundedToNearestSecond = new Date(date.getTime() - millis);
final String formatted = sdf.format(roundedToNearestSecond);
-
+
final QueryResult> result = query.evaluate(attributes);
assertEquals(ResultType.STRING, result.getResultType());
assertEquals(formatted, result.getValue());
}
-
@Test
public void testEmbeddedExpressionsAndQuotes() {
final Map attributes = new HashMap<>();
attributes.put("x", "abc");
attributes.put("a", "abc");
-
+
verifyEquals("${x:equals(${a})}", attributes, true);
-
+
Query.validateExpression("${x:equals('${a}')}", false);
assertEquals("true", Query.evaluateExpressions("${x:equals('${a}')}", attributes, null));
-
+
Query.validateExpression("${x:equals(\"${a}\")}", false);
assertEquals("true", Query.evaluateExpressions("${x:equals(\"${a}\")}", attributes, null));
}
-
+
@Test
public void testJoin() {
final Map attributes = new HashMap<>();
@@ -243,13 +239,12 @@ public class TestQuery {
verifyEquals("${a.a:join(', ')}", attributes, "a");
verifyEquals("${allAttributes( 'x', 'y' ):join(',')}", attributes, ",");
}
-
- @Test(expected=AttributeExpressionLanguageException.class)
+
+ @Test(expected = AttributeExpressionLanguageException.class)
public void testCannotCombineWithNonReducingFunction() {
Query.compileTree("${allAttributes( 'a.1' ):plus(1)}");
}
-
@Test
public void testIsEmpty() {
final Map attributes = new HashMap<>();
@@ -263,22 +258,19 @@ public class TestQuery {
verifyEquals("${d:isEmpty()}", attributes, true);
}
-
@Test
public void testReplaceEmpty() {
final Map attributes = new HashMap<>();
attributes.put("a", "a");
attributes.put("b", "");
attributes.put("c", " \n");
-
+
verifyEquals("${a:replaceEmpty('c')}", attributes, "a");
verifyEquals("${b:replaceEmpty('c')}", attributes, "c");
verifyEquals("${c:replaceEmpty('c')}", attributes, "c");
verifyEquals("${d:replaceEmpty('c')}", attributes, "c");
}
-
-
@Test
public void testCount() {
final Map attributes = new HashMap<>();
@@ -291,20 +283,18 @@ public class TestQuery {
verifyEquals("${allMatchingAttributes( '.*' ):count()}", attributes, 6L);
verifyEquals("${allMatchingAttributes( '.*' ):length():gt(2):count()}", attributes, 5L);
- verifyEquals("${allMatchingAttributes( 'n.*' ):plus(1):count()}", attributes, 3L );
+ verifyEquals("${allMatchingAttributes( 'n.*' ):plus(1):count()}", attributes, 3L);
}
-
-
+
@Test
public void testCurlyBracesInQuotes() {
final Map attributes = new HashMap<>();
attributes.put("attr", "My Valuee");
-
+
assertEquals("Val", evaluateQueryForEscape("${attr:replaceAll('My (Val)ue{1,2}', '$1')}", attributes));
assertEquals("Val", evaluateQueryForEscape("${attr:replaceAll(\"My (Val)ue{1,2}\", '$1')}", attributes));
}
-
-
+
private String evaluateQueryForEscape(final String queryString, final Map attributes) {
FlowFile mockFlowFile = Mockito.mock(FlowFile.class);
Mockito.when(mockFlowFile.getAttributes()).thenReturn(attributes);
@@ -315,15 +305,14 @@ public class TestQuery {
Mockito.when(mockFlowFile.getLineageStartDate()).thenReturn(System.currentTimeMillis());
return Query.evaluateExpressions(queryString, mockFlowFile);
}
-
-
+
@Test
public void testGetAttributeValue() {
final Map attributes = new HashMap<>();
attributes.put("attr", "My Value");
verifyEquals("${attr}", attributes, "My Value");
}
-
+
@Test
public void testGetAttributeValueEmbedded() {
final Map attributes = new HashMap<>();
@@ -331,14 +320,14 @@ public class TestQuery {
attributes.put("XX", "My Value");
verifyEquals("${${attr:trim()}}", attributes, "My Value");
}
-
+
@Test
public void testSimpleSubstring() {
final Map attributes = new HashMap<>();
attributes.put("attr", "My Value");
verifyEquals("${attr:substring(2, 5)}", attributes, " Va");
}
-
+
@Test
public void testCallToFunctionWithSubjectResultOfAnotherFunctionCall() {
final Map attributes = new HashMap<>();
@@ -359,29 +348,28 @@ public class TestQuery {
attributes.put("attr", " XX ");
verifyEquals("${attr:trim():equals('XX')}", attributes, true);
}
-
+
@Test
public void testDeeplyEmbedded() {
final Map attributes = new HashMap<>();
attributes.put("x", "false");
attributes.put("abc", "a");
attributes.put("a", "a");
-
+
verifyEquals("${x:or( ${${abc}:length():equals(1)} )}", attributes, true);
}
-
-
+
@Test
public void testExtractExpressionRanges() {
List ranges = Query.extractExpressionRanges("hello");
assertTrue(ranges.isEmpty());
-
+
ranges = Query.extractExpressionRanges("${hello");
assertTrue(ranges.isEmpty());
-
+
ranges = Query.extractExpressionRanges("hello}");
assertTrue(ranges.isEmpty());
-
+
ranges = Query.extractExpressionRanges("$${hello");
assertTrue(ranges.isEmpty());
@@ -393,52 +381,50 @@ public class TestQuery {
Range range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(7, range.getEnd());
-
+
ranges = Query.extractExpressionRanges("${hello:equals( ${goodbye} )}");
assertEquals(1, ranges.size());
range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(28, range.getEnd());
-
+
ranges = Query.extractExpressionRanges("${hello:equals( $${goodbye} )}");
assertEquals(1, ranges.size());
range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(29, range.getEnd());
-
+
ranges = Query.extractExpressionRanges("${hello:equals( $${goodbye} )} or just hi, ${bob:or(${jerry})}");
assertEquals(2, ranges.size());
range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(29, range.getEnd());
-
+
range = ranges.get(1);
assertEquals(43, range.getStart());
assertEquals(61, range.getEnd());
-
-
+
ranges = Query.extractExpressionRanges("${hello:equals( ${goodbye} )} or just hi, ${bob}, are you ${bob.age:toNumber()} yet? $$$${bob}");
assertEquals(3, ranges.size());
range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(28, range.getEnd());
-
+
range = ranges.get(1);
assertEquals(42, range.getStart());
assertEquals(47, range.getEnd());
-
+
range = ranges.get(2);
assertEquals(58, range.getStart());
assertEquals(78, range.getEnd());
-
+
ranges = Query.extractExpressionRanges("${x:matches( '.{4}' )}");
assertEquals(1, ranges.size());
range = ranges.get(0);
assertEquals(0, range.getStart());
assertEquals(21, range.getEnd());
}
-
-
+
@Test
public void testExtractExpressionTypes() {
List types = Query.extractResultTypes("${hello:equals( ${goodbye} )} or just hi, ${bob}, are you ${bob.age:toNumber()} yet? $$$${bob}");
@@ -447,19 +433,18 @@ public class TestQuery {
assertEquals(ResultType.STRING, types.get(1));
assertEquals(ResultType.NUMBER, types.get(2));
}
-
-
+
@Test
public void testEqualsEmbedded() {
final Map attributes = new HashMap<>();
attributes.put("x", "hello");
attributes.put("y", "good-bye");
-
+
verifyEquals("${x:equals( ${y} )}", attributes, false);
-
+
attributes.put("y", "hello");
verifyEquals("${x:equals( ${y} )}", attributes, true);
-
+
attributes.put("x", "4");
attributes.put("y", "3");
attributes.put("z", "1");
@@ -474,18 +459,17 @@ public class TestQuery {
attributes.put("y", "88");
assertEquals("true", Query.evaluateExpressions("${x:equals( '${y}' )}", attributes, null));
}
-
-
+
@Test
public void testComplicatedEmbeddedExpressions() {
final Map attributes = new HashMap<>();
attributes.put("fox", "quick, brown");
attributes.put("dog", "lazy");
-
+
verifyEquals("${fox:substring( ${ 'dog' :substring(2):length()}, 5 ):equals( 'ick' )}", attributes, true);
verifyEquals("${fox:substring( ${ 'dog' :substring(2):length()}, 5 ):equals( 'ick' )}", attributes, true);
}
-
+
@Test
public void testQuotingQuotes() {
final Map attributes = new HashMap<>();
@@ -501,7 +485,7 @@ public class TestQuery {
System.out.println(query);
verifyEquals(query, attributes, "say \"hi\"");
}
-
+
@Test
public void testDoubleQuotesWithinSingleQuotes() {
final Map attributes = new HashMap<>();
@@ -511,30 +495,30 @@ public class TestQuery {
System.out.println(query);
verifyEquals(query, attributes, "say \"hello\"");
}
-
+
@Test
public void testEscapeQuotes() {
final long timestamp = 1403620278642L;
final Map attributes = new HashMap<>();
attributes.put("date", String.valueOf(timestamp));
-
+
final String format = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
-
+
final String query = "startDateTime=\"${date:toNumber():toDate():format(\"" + format + "\")}\"";
final String result = Query.evaluateExpressions(query, attributes, null);
-
+
final String expectedTime = new SimpleDateFormat(format, Locale.US).format(timestamp);
assertEquals("startDateTime=\"" + expectedTime + "\"", result);
-
+
final List ranges = Query.extractExpressionRanges(query);
assertEquals(1, ranges.size());
}
-
+
@Test
public void testDateConversion() {
final Map attributes = new HashMap<>();
attributes.put("date", "1403620278642");
-
+
verifyEquals("${date:format('yyyy')}", attributes, "2014");
verifyEquals("${date:toDate():format('yyyy')}", attributes, "2014");
verifyEquals("${date:toNumber():format('yyyy')}", attributes, "2014");
@@ -542,17 +526,16 @@ public class TestQuery {
verifyEquals("${date:toDate():toNumber():format('yyyy')}", attributes, "2014");
verifyEquals("${date:toDate():toNumber():toDate():toNumber():toDate():toNumber():format('yyyy')}", attributes, "2014");
}
-
+
@Test
public void testSingleLetterAttribute() {
final Map attributes = new HashMap<>();
attributes.put("A", "0123456789");
-
+
verifyEquals("${A}", attributes, "0123456789");
verifyEquals("${'A'}", attributes, "0123456789");
}
-
@Test
public void testImplicitConversions() {
final Map attributes = new HashMap<>();
@@ -562,7 +545,7 @@ public class TestQuery {
attributes.put("d", "Quick Brown Fox");
attributes.put("F", "-48");
attributes.put("n", "2014/04/04 00:00:00");
-
+
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2014);
cal.set(Calendar.MONTH, 3);
@@ -570,11 +553,10 @@ public class TestQuery {
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 45);
-
+
final String dateString = cal.getTime().toString();
attributes.put("z", dateString);
-
verifyEquals("${A:plus(4)}", attributes, 123456793L);
verifyEquals("${A:plus( ${F} )}", attributes, 123456741L);
@@ -582,11 +564,11 @@ public class TestQuery {
verifyEquals("${A:substring(2,3):plus(21):substring(1,2):plus(0)}", attributes, 3L);
verifyEquals("${n:format( 'yyyy' )}", attributes, "2014");
verifyEquals("${z:format( 'yyyy' )}", attributes, "2014");
-
+
attributes.put("n", "2014/04/04 00:00:00.045");
verifyEquals("${n:format( 'yyyy' ):append(','):append( ${n:format( 'SSS' )} )}", attributes, "2014,045");
}
-
+
@Test
public void testNewLinesAndTabsInQuery() {
final String query = "${ abc:equals('abc'):or( \n\t${xx:isNull()}\n) }";
@@ -594,12 +576,12 @@ public class TestQuery {
Query.validateExpression(query, false);
assertEquals("true", Query.evaluateExpressions(query));
}
-
+
@Test
public void testAttributeReferencesWithWhiteSpace() {
final Map attrs = new HashMap<>();
attrs.put("a b c,d", "abc");
-
+
final String query = "${ 'a b c,d':equals('abc') }";
verifyEquals(query, attrs, true);
}
@@ -609,68 +591,68 @@ public class TestQuery {
final Map attributes = new HashMap<>();
attributes.put("abc", "xyz");
- final String expression =
- "# hello, world\n" +
- "${# ref attr\n" +
- "\t" +
- "abc" +
- "\t" +
- "#end ref attr\n" +
- "}";
+ final String expression
+ = "# hello, world\n"
+ + "${# ref attr\n"
+ + "\t"
+ + "abc"
+ + "\t"
+ + "#end ref attr\n"
+ + "}";
Query query = Query.compile(expression);
QueryResult> result = query.evaluate(attributes);
assertEquals(ResultType.STRING, result.getResultType());
assertEquals("xyz", result.getValue());
-
+
query = Query.compile("${abc:append('# hello') #good-bye \n}");
result = query.evaluate(attributes);
assertEquals(ResultType.STRING, result.getResultType());
assertEquals("xyz# hello", result.getValue());
}
-
+
@Test
public void testAppendPrepend() {
final Map attributes = new HashMap<>();
attributes.put("attr", "XX");
attributes.put("YXXX", "bingo");
-
+
verifyEquals("${${attr:append('X'):prepend('Y')}}", attributes, "bingo");
}
-
+
@Test
public void testIsNull() {
final Map attributes = new HashMap<>();
verifyEquals("${attr:isNull()}", attributes, true);
}
-
+
@Test
public void testNotNull() {
final Map attributes = new HashMap<>();
attributes.put("attr", "");
-
+
verifyEquals("${attr:notNull()}", attributes, true);
}
-
+
@Test
public void testIsNullOrLengthEquals0() {
final Map attributes = new HashMap<>();
attributes.put("abc", "");
attributes.put("xyz", "xyz");
attributes.put("xx", " ");
-
+
verifyEquals("${abc:isNull():or( ${abc:length():equals(0)} )}", attributes, true);
verifyEquals("${xyz:isNull():or( ${xyz:length():equals(0)} )}", attributes, false);
verifyEquals("${none:isNull():or( ${none:length():equals(0)} )}", attributes, true);
verifyEquals("${xx:isNull():or( ${xx:trim():length():equals(0)} )}", attributes, true);
}
-
+
@Test
public void testReplaceNull() {
final Map attributes = new HashMap<>();
verifyEquals("${attr:replaceNull('hello')}", attributes, "hello");
}
-
+
@Test
public void testReplace() {
final Map attributes = new HashMap<>();
@@ -683,10 +665,10 @@ public class TestQuery {
final Map attributes = new HashMap<>();
attributes.put("attr", "hello");
attributes.put("xyz", "00-00TEST.2014_01_01_000000_value");
-
+
verifyEquals("${xyz:replaceAll(\"^([^.]+)\\.([0-9]{4})_([0-9]{2})_([0-9]{2}).*$\", \"$3\")}", attributes, "01");
verifyEquals("${attr:replaceAll('l+', 'r')}", attributes, "hero");
-
+
attributes.clear();
attributes.put("filename1", "abc.gz");
attributes.put("filename2", "abc.g");
@@ -705,10 +687,9 @@ public class TestQuery {
verifyEquals("${abc:replaceAll( 'xx', '$0')}", attributes, "hello world");
verifyEquals("${abc:replaceAll( '(xx)', '$1')}", attributes, "hello world");
verifyEquals("${abc:replaceAll( 'lo wor(ld)', '$1')}", attributes, "helld");
-
+
}
-
-
+
@Test
public void testReplaceAllWithOddNumberOfBackslashPairs() {
final Map attributes = new HashMap<>();
@@ -718,15 +699,15 @@ public class TestQuery {
verifyEquals("${filename:replaceAll('\\\\\\\\', '/')}", attributes, "C:/temp/.txt");
verifyEquals("${filename:replaceAll('\\\\\\.txt$', '')}", attributes, "C:\\temp");
}
-
+
@Test
public void testReplaceAllWithMatchingGroup() {
final Map attributes = new HashMap<>();
attributes.put("attr", "hello");
-
+
verifyEquals("${attr:replaceAll('.*?(l+).*', '$1')}", attributes, "ll");
}
-
+
@Test
public void testMathOperations() {
final Map attributes = new HashMap<>();
@@ -746,16 +727,16 @@ public class TestQuery {
attributes.put("attr", "https://abc.go");
verifyEquals("${attr:indexOf('/')}", attributes, 6L);
}
-
+
@Test
public void testDate() {
final Calendar now = Calendar.getInstance();
final int year = now.get(Calendar.YEAR);
final Map attributes = new HashMap<>();
attributes.put("entryDate", String.valueOf(now.getTimeInMillis()));
-
+
verifyEquals("${entryDate:toNumber():toDate():format('yyyy')}", attributes, String.valueOf(year));
-
+
attributes.clear();
attributes.put("month", "3");
attributes.put("day", "4");
@@ -765,34 +746,34 @@ public class TestQuery {
verifyEquals("${year:append('/'):append(${month}):append('/'):append(${day}):toDate('yyyy/MM/dd'):format('D')}", attributes, "63");
}
-
+
@Test
public void testSystemProperty() {
System.setProperty("hello", "good-bye");
assertEquals("good-bye", Query.evaluateExpressions("${hello}"));
assertEquals("good-bye", Query.compile("${hello}").evaluate().getValue());
}
-
+
@Test
public void testAnyAttribute() {
final Map attributes = new HashMap<>();
attributes.put("abc", "zzz");
attributes.put("xyz", "abc");
-
+
verifyEquals("${anyAttribute('abc', 'xyz', 'missingAttr'):substring(1,2):equals('b')}", attributes, true);
verifyEquals("${anyAttribute('abc', 'xyz'):substring(1,2):equals('b')}", attributes, true);
verifyEquals("${anyAttribute('xyz', 'abc'):substring(1,2):equals('b')}", attributes, true);
verifyEquals("${anyAttribute('zz'):substring(1,2):equals('b')}", attributes, false);
verifyEquals("${anyAttribute('abc', 'zz'):isNull()}", attributes, true);
}
-
+
@Test
public void testAnyMatchingAttribute() {
final Map attributes = new HashMap<>();
attributes.put("abc", "zzz");
attributes.put("xyz", "abc");
attributes.put("123.cba", "hello");
-
+
verifyEquals("${anyMatchingAttribute('.{2}x', '.{2}z'):substring(1,2):equals('b')}", attributes, true);
verifyEquals("${anyMatchingAttribute('.*'):substring(1,2):equals('b')}", attributes, true);
verifyEquals("${anyMatchingAttribute('x{44}'):substring(1,2):equals('b')}", attributes, false);
@@ -804,48 +785,46 @@ public class TestQuery {
verifyEquals("${anyMatchingAttribute('123\\.c.*'):matches('hello')}", attributes, true);
verifyEquals("${anyMatchingAttribute('123\\.c.*|a.c'):matches('zzz')}", attributes, true);
}
-
-
+
@Test
public void testAnyDelineatedValue() {
final Map attributes = new HashMap<>();
attributes.put("abc", "a,b,c");
attributes.put("xyz", "abc");
-
+
final String query = "${anyDelineatedValue('${abc}', ','):equals('b')}";
assertEquals(ResultType.BOOLEAN, Query.getResultType(query));
-
+
assertEquals("true", Query.evaluateExpressions(query, attributes, null));
assertEquals("true", Query.evaluateExpressions("${anyDelineatedValue('${abc}', ','):equals('a')}", attributes, null));
assertEquals("true", Query.evaluateExpressions("${anyDelineatedValue('${abc}', ','):equals('c')}", attributes, null));
assertEquals("false", Query.evaluateExpressions("${anyDelineatedValue('${abc}', ','):equals('d')}", attributes, null));
-
+
verifyEquals("${anyDelineatedValue(${abc}, ','):equals('b')}", attributes, true);
verifyEquals("${anyDelineatedValue(${abc}, ','):equals('a')}", attributes, true);
verifyEquals("${anyDelineatedValue(${abc}, ','):equals('c')}", attributes, true);
verifyEquals("${anyDelineatedValue(${abc}, ','):equals('d')}", attributes, false);
}
-
+
@Test
public void testAllDelineatedValues() {
final Map attributes = new HashMap<>();
attributes.put("abc", "a,b,c");
attributes.put("xyz", "abc");
-
+
final String query = "${allDelineatedValues('${abc}', ','):matches('[abc]')}";
-
+
assertEquals(ResultType.BOOLEAN, Query.getResultType(query));
assertEquals("true", Query.evaluateExpressions(query, attributes, null));
assertEquals("true", Query.evaluateExpressions(query, attributes, null));
assertEquals("false", Query.evaluateExpressions("${allDelineatedValues('${abc}', ','):matches('[abd]')}", attributes, null));
assertEquals("false", Query.evaluateExpressions("${allDelineatedValues('${abc}', ','):equals('a'):not()}", attributes, null));
-
+
verifyEquals("${allDelineatedValues(${abc}, ','):matches('[abc]')}", attributes, true);
verifyEquals("${allDelineatedValues(${abc}, ','):matches('[abd]')}", attributes, false);
verifyEquals("${allDelineatedValues(${abc}, ','):equals('a'):not()}", attributes, false);
}
-
-
+
@Test
public void testAllAttributes() {
final Map attributes = new HashMap<>();
@@ -859,7 +838,7 @@ public class TestQuery {
verifyEquals("${allAttributes('abc', 'hello'):length():equals(4)}", attributes, false);
verifyEquals("${allAttributes('abc', 'xyz'):length():equals(4)}", attributes, true);
verifyEquals("${allAttributes('abc', 'xyz', 'other'):isNull()}", attributes, false);
-
+
try {
Query.compile("${allAttributes('#ah'):equals('hello')");
Assert.fail("Was able to compile with allAttributes and an invalid attribute name");
@@ -867,8 +846,7 @@ public class TestQuery {
// expected behavior
}
}
-
-
+
@Test
public void testMathOperators() {
final Map attributes = new HashMap<>();
@@ -878,7 +856,7 @@ public class TestQuery {
verifyEquals("${xyz:toNumber():gt( ${abc:toNumber()} )}", attributes, true);
}
-
+
@Test
public void testAllMatchingAttributes() {
final Map attributes = new HashMap<>();
@@ -887,17 +865,17 @@ public class TestQuery {
attributes.put("hello", "world!");
attributes.put("123.cba", "hell.o");
- System.out.println( printTree(Query.compile("${allMatchingAttributes('(abc|xyz)'):matches('\\\\d+')}").getTree()) );
-
+ System.out.println(printTree(Query.compile("${allMatchingAttributes('(abc|xyz)'):matches('\\\\d+')}").getTree()));
+
verifyEquals("${'123.cba':matches('hell\\.o')}", attributes, true);
verifyEquals("${allMatchingAttributes('123\\.cba'):equals('hell.o')}", attributes, true);
verifyEquals("${allMatchingAttributes('(abc|xyz)'):matches('\\d+')}", attributes, true);
verifyEquals("${allMatchingAttributes('[ax].*'):toNumber():lt(99999)}", attributes, true);
verifyEquals("${allMatchingAttributes('hell.'):length():gt(3)}", attributes, true);
-
+
verifyEquals("${allMatchingAttributes('123\\.cba'):equals('no')}", attributes, false);
}
-
+
@Test
public void testMatches() {
final Map attributes = new HashMap<>();
@@ -909,15 +887,14 @@ public class TestQuery {
final String evaluated = Query.evaluateExpressions("${abc:matches('1234${end}4321')}", attributes, null);
assertEquals("true", evaluated);
-
+
attributes.put("end", "888");
final String secondEvaluation = Query.evaluateExpressions("${abc:matches('1234${end}4321')}", attributes, null);
assertEquals("false", secondEvaluation);
-
+
verifyEquals("${dotted:matches('abc\\.xyz')}", attributes, true);
- }
-
-
+ }
+
@Test
public void testFind() {
final Map attributes = new HashMap<>();
@@ -929,68 +906,67 @@ public class TestQuery {
final String evaluated = Query.evaluateExpressions("${abc:find('1234${end}4321')}", attributes, null);
assertEquals("true", evaluated);
-
+
attributes.put("end", "888");
final String secondEvaluation = Query.evaluateExpressions("${abc:find('${end}4321')}", attributes, null);
assertEquals("false", secondEvaluation);
-
+
verifyEquals("${dotted:find('\\.')}", attributes, true);
- }
-
+ }
+
@Test
public void testSubstringAfter() {
final Map attributes = new HashMap<>();
attributes.put("filename", "file-255");
-
+
verifyEquals("${filename:substringAfter('')}", attributes, "file-255");
verifyEquals("${filename:substringAfterLast('')}", attributes, "file-255");
verifyEquals("${filename:substringBefore('')}", attributes, "file-255");
verifyEquals("${filename:substringBeforeLast('')}", attributes, "file-255");
verifyEquals("${filename:substringBefore('file')}", attributes, "");
-
+
attributes.put("uri", "sftp://some.uri");
verifyEquals("${uri:substringAfter('sftp')}", attributes, "://some.uri");
}
-
+
@Test
public void testSubstringAfterLast() {
final Map attributes = new HashMap<>();
attributes.put("filename", "file-file-255");
-
+
verifyEquals("${filename:substringAfterLast('file-')}", attributes, "255");
verifyEquals("${filename:substringAfterLast('5')}", attributes, "");
verifyEquals("${filename:substringAfterLast('x')}", attributes, "file-file-255");
}
-
+
@Test
public void testSubstringBefore() {
final Map attributes = new HashMap<>();
attributes.put("something", "some {} or other");
-
+
verifyEquals("${something:substringBefore('}')}", attributes, "some {");
}
-
+
@Test
public void testSubstring() {
final Map attributes = new HashMap<>();
attributes.put("filename", "file-255");
-
+
verifyEquals("${filename:substring(1, 2)}", attributes, "i");
verifyEquals("${filename:substring(4)}", attributes, "-255");
}
-
+
@Test
public void testToRadix() {
final Map attributes = new HashMap<>();
attributes.put("filename", "file-255");
attributes.put("filename2", "file-99999");
-
verifyEquals("${filename:substringAfter('-'):toNumber():toRadix(16):toUpper()}", attributes, "FF");
verifyEquals("${filename:substringAfter('-'):toNumber():toRadix(16, 4):toUpper()}", attributes, "00FF");
verifyEquals("${filename:substringAfter('-'):toNumber():toRadix(36, 3):toUpper()}", attributes, "073");
}
-
+
@Test
public void testDateFormatConversion() {
final Map attributes = new HashMap<>();
@@ -998,23 +974,22 @@ public class TestQuery {
verifyEquals("${blue:toDate('yyyyMMddHHmmss'):format(\"yyyy/MM/dd HH:mm:ss.SSS'Z'\")}", attributes, "2013/09/17 16:26:43.000Z");
}
-
@Test
public void testNot() {
verifyEquals("${ab:notNull():not()}", new HashMap(), true);
}
-
+
@Test
public void testAttributesWithSpaces() {
final Map attributes = new HashMap<>();
attributes.put("ab", "abc");
attributes.put("a b", "abc");
-
+
verifyEquals("${ab}", attributes, "abc");
verifyEquals("${'a b'}", attributes, "abc");
verifyEquals("${'a b':replaceNull('')}", attributes, "");
}
-
+
@Test
public void testOr() {
final Map attributes = new HashMap<>();
@@ -1029,7 +1004,7 @@ public class TestQuery {
verifyEquals("${filename1:startsWith('x'):or( ${filename2:startsWith('y')} )}", attributes, true);
verifyEquals("${filename2:startsWith('x'):or( ${filename1:startsWith('y')} )}", attributes, false);
}
-
+
@Test
public void testAnd() {
final Map attributes = new HashMap<>();
@@ -1046,7 +1021,7 @@ public class TestQuery {
verifyEquals("${filename2:startsWith('x'):and( ${filename1:startsWith('y')} )}", attributes, false);
verifyEquals("${filename1:startsWith('x'):and( ${'filename 3':endsWith('y')} )}", attributes, true);
}
-
+
@Test
public void testAndOrNot() {
final Map attributes = new HashMap<>();
@@ -1054,90 +1029,90 @@ public class TestQuery {
attributes.put("filename2", "yabc");
attributes.put("filename 3", "abcxy");
- final String query =
- "${" +
- " 'non-existing':notNull():not():and(" + // true AND (
- " ${filename1:startsWith('y')" + // false
- " :or(" + // or
- " ${ filename1:startsWith('x'):and(false) }" + // false
- " ):or(" + // or
- " ${ filename2:endsWith('xxxx'):or( ${'filename 3':length():gt(1)} ) }" + // true )
- " )}" +
- " )" +
- "}";
-
+ final String query
+ = "${"
+ + " 'non-existing':notNull():not():and(" + // true AND (
+ " ${filename1:startsWith('y')" + // false
+ " :or(" + // or
+ " ${ filename1:startsWith('x'):and(false) }" + // false
+ " ):or(" + // or
+ " ${ filename2:endsWith('xxxx'):or( ${'filename 3':length():gt(1)} ) }" + // true )
+ " )}"
+ + " )"
+ + "}";
+
System.out.println(query);
verifyEquals(query, attributes, true);
}
-
+
@Test
public void testAndOrLogicWithAnyAll() {
final Map attributes = new HashMap<>();
attributes.put("filename1", "xabc");
attributes.put("filename2", "yabc");
attributes.put("filename 3", "abcxy");
-
+
verifyEquals("${anyMatchingAttribute('filename.*'):contains('abc'):and( ${filename2:equals('yabc')} )}", attributes, true);
verifyEquals("${anyMatchingAttribute('filename.*'):contains('abc'):and( ${filename2:equals('xabc')} )}", attributes, false);
verifyEquals("${anyMatchingAttribute('filename.*'):contains('abc'):not():or( ${filename2:equals('yabc')} )}", attributes, true);
verifyEquals("${anyMatchingAttribute('filename.*'):contains('abc'):not():or( ${filename2:equals('xabc')} )}", attributes, false);
}
-
+
@Test
public void testKeywords() {
final Map attributes = new HashMap<>();
attributes.put("UUID", "123");
verifyEquals("${ 'UUID':toNumber():equals(123) }", attributes, true);
}
-
+
@Test
public void testEqualsNumber() {
final Map attributes = new HashMap<>();
attributes.put("abc", "123");
verifyEquals("${ abc:toNumber():equals(123) }", attributes, true);
}
-
+
@Test
public void testSubjectAsEmbeddedExpressionWithSurroundChars() {
final Map attributes = new HashMap<>();
attributes.put("b", "x");
attributes.put("abcxcba", "hello");
-
+
final String evaluated = Query.evaluateExpressions("${ 'abc${b}cba':substring(0, 1) }", attributes, null);
assertEquals("h", evaluated);
}
-
+
@Test
public void testToNumberFunctionReturnsNumberType() {
assertEquals(ResultType.NUMBER, Query.getResultType("${header.size:toNumber()}"));
}
-
+
@Test
public void testAnyAttributeEmbedded() {
final Map attributes = new HashMap<>();
attributes.put("a1", "test1");
attributes.put("b2", "2test");
attributes.put("c3", "3test3");
-
+
final String query = "${a1:equals('test1'):and( ${anyAttribute('a1','b2','c3'):contains('2')})}";
verifyEquals(query, attributes, true);
}
-
+
private void verifyEquals(final String expression, final Map attributes, final Object expectedResult) {
Query.validateExpression(expression, false);
assertEquals(String.valueOf(expectedResult), Query.evaluateExpressions(expression, attributes, null));
-
+
Query query = Query.compile(expression);
QueryResult> result = query.evaluate(attributes);
-
- if ( expectedResult instanceof Number ) {
+
+ if (expectedResult instanceof Number) {
assertEquals(ResultType.NUMBER, result.getResultType());
- } else if ( expectedResult instanceof Boolean ) {
+ } else if (expectedResult instanceof Boolean) {
assertEquals(ResultType.BOOLEAN, result.getResultType());
} else {
assertEquals(ResultType.STRING, result.getResultType());
}
-
+
assertEquals(expectedResult, result.getValue());
}
}
diff --git a/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestStandardPreparedQuery.java b/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestStandardPreparedQuery.java
index 398a23b640..5acba8deda 100644
--- a/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestStandardPreparedQuery.java
+++ b/nifi/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestStandardPreparedQuery.java
@@ -31,34 +31,34 @@ public class TestStandardPreparedQuery {
public void testSimpleReference() {
final Map attrs = new HashMap<>();
attrs.put("xx", "world");
-
+
assertEquals("world", evaluate("${xx}", attrs));
assertEquals("hello, world!", evaluate("hello, ${xx}!", attrs));
}
-
+
@Test
public void testEmbeddedReference() {
final Map attrs = new HashMap<>();
attrs.put("xx", "yy");
attrs.put("yy", "world");
-
+
assertEquals("world", evaluate("${${xx}}", attrs));
}
-
+
@Test
public void test10MIterations() {
final Map attrs = new HashMap<>();
attrs.put("xx", "world");
-
+
final StandardPreparedQuery prepared = (StandardPreparedQuery) Query.prepare("${xx}");
final long start = System.nanoTime();
- for (int i=0; i < 10000000; i++) {
- assertEquals( "world", prepared.evaluateExpressions(attrs, null) );
+ for (int i = 0; i < 10000000; i++) {
+ assertEquals("world", prepared.evaluateExpressions(attrs, null));
}
final long nanos = System.nanoTime() - start;
System.out.println(TimeUnit.NANOSECONDS.toMillis(nanos));
}
-
+
@Test
@Ignore("Takes too long")
public void test10MIterationsWithQuery() {
@@ -66,14 +66,14 @@ public class TestStandardPreparedQuery {
attrs.put("xx", "world");
final long start = System.nanoTime();
- for (int i=0; i < 10000000; i++) {
- assertEquals( "world", Query.evaluateExpressions("${xx}", attrs) );
+ for (int i = 0; i < 10000000; i++) {
+ assertEquals("world", Query.evaluateExpressions("${xx}", attrs));
}
final long nanos = System.nanoTime() - start;
System.out.println(TimeUnit.NANOSECONDS.toMillis(nanos));
}
-
+
@Test
public void testSeveralSequentialExpressions() {
final Map attributes = new HashMap<>();
@@ -83,10 +83,10 @@ public class TestStandardPreparedQuery {
assertEquals("Hello, World, how are you?!", evaluate("Hello, ${audience}${comma}${question}!", attributes));
}
-
+
private String evaluate(final String query, final Map attrs) {
final String evaluated = ((StandardPreparedQuery) Query.prepare(query)).evaluateExpressions(attrs, null);
return evaluated;
}
-
+
}
diff --git a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
index 07baab1409..479ac588a4 100644
--- a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
+++ b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
@@ -78,7 +78,7 @@ public class FlowFilePackagerV1 implements FlowFilePackager {
entry.setMode(tarPermissions);
entry.setSize(fileSize);
tarOut.putArchiveEntry(entry);
- final byte[] buffer = new byte[512 << 10];//512KB
+ final byte[] buffer = new byte[512 << 10];//512KB
int bytesRead = 0;
while ((bytesRead = inStream.read(buffer)) != -1) { //still more data to read
if (bytesRead > 0) {
diff --git a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
index f8ef3d1ab5..b96534a6b2 100644
--- a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
+++ b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
@@ -51,7 +51,7 @@ public class FlowFileUnpackagerV1 implements FlowFileUnpackager {
final TarArchiveEntry contentEntry = tarIn.getNextTarEntry();
if (contentEntry != null && contentEntry.getName().equals(FlowFilePackagerV1.FILENAME_CONTENT)) {
- final byte[] buffer = new byte[512 << 10];//512KB
+ final byte[] buffer = new byte[512 << 10];//512KB
int bytesRead = 0;
while ((bytesRead = tarIn.read(buffer)) != -1) { //still more data to read
if (bytesRead > 0) {
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml
index 7daa400835..bcd489effe 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml
+++ b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml
@@ -14,109 +14,115 @@
limitations under the License.
-->
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
-
- org.apache.nifi
- nifi-commons
- 0.1.0-incubating-SNAPSHOT
-
+
+ org.apache.nifi
+ nifi-commons
+ 0.1.0-incubating-SNAPSHOT
+
- nifi-hl7-query-language
- jar
-
-
-
- maven-compiler-plugin
-
-
- 1.7
-
-
-
- org.antlr
- antlr3-maven-plugin
-
-
-
- antlr
-
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- src/test/resources/hypoglycemia
- src/test/resources/hyperglycemia
-
-
-
-
-
+ nifi-hl7-query-language
+ jar
+
+
+
+ maven-compiler-plugin
+
+
+ 1.7
+
+
+
+ org.antlr
+ antlr3-maven-plugin
+
+
+
+ antlr
+
+
+
+
+
+ org.apache.rat
+ apache-rat-plugin
+
+
+ src/test/resources/hypoglycemia
+ src/test/resources/hyperglycemia
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+ **/HL7QueryParser.java,**/HL7QueryLexer.java
+
+
+
+
-
-
- org.antlr
- antlr-runtime
- 3.5.2
-
+
+
+ org.antlr
+ antlr-runtime
+
-
-
- ca.uhn.hapi
- hapi-base
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v21
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v22
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v23
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v231
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v24
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v25
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v251
- 2.2
-
-
- ca.uhn.hapi
- hapi-structures-v26
- 2.2
-
+
+
+ ca.uhn.hapi
+ hapi-base
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v21
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v22
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v23
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v231
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v24
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v25
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v251
+ 2.2
+
+
+ ca.uhn.hapi
+ hapi-structures-v26
+ 2.2
+
-
- junit
- junit
- test
-
-
+
+ junit
+ junit
+ test
+
+
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java
index be645e59c8..dc73efbea7 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java
@@ -24,14 +24,14 @@ import org.apache.nifi.hl7.model.HL7Field;
public class EmptyField implements HL7Field {
- @Override
- public String getValue() {
- return null;
- }
+ @Override
+ public String getValue() {
+ return null;
+ }
- @Override
- public List getComponents() {
- return Collections.emptyList();
- }
+ @Override
+ public List getComponents() {
+ return Collections.emptyList();
+ }
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java
index 056b6b677d..94cce5c1a9 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java
@@ -32,52 +32,53 @@ import ca.uhn.hl7v2.parser.EncodingCharacters;
import ca.uhn.hl7v2.parser.PipeParser;
public class HapiField implements HL7Field, HL7Component {
- private final String value;
- private final List components;
-
- public HapiField(final Type type) {
- this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance());
-
- final List componentList = new ArrayList<>();
- if ( type instanceof Composite ) {
- final Composite composite = (Composite) type;
-
- for ( final Type component : composite.getComponents() ) {
- componentList.add(new HapiField(component));
- }
- }
-
- final ExtraComponents extra = type.getExtraComponents();
- if ( extra != null && extra.numComponents() > 0 ) {
- final String singleFieldValue;
- if ( type instanceof Primitive ) {
- singleFieldValue = ((Primitive) type).getValue();
- } else {
- singleFieldValue = this.value;
- }
- componentList.add(new SingleValueField(singleFieldValue));
-
- for (int i=0; i < extra.numComponents(); i++) {
- final Varies varies = extra.getComponent(i);
- componentList.add(new HapiField(varies));
- }
- }
-
- this.components = Collections.unmodifiableList(componentList);
- }
-
- @Override
- public String getValue() {
- return value;
- }
- @Override
- public List getComponents() {
- return components;
- }
-
- @Override
- public String toString() {
- return value;
- }
+ private final String value;
+ private final List components;
+
+ public HapiField(final Type type) {
+ this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance());
+
+ final List componentList = new ArrayList<>();
+ if (type instanceof Composite) {
+ final Composite composite = (Composite) type;
+
+ for (final Type component : composite.getComponents()) {
+ componentList.add(new HapiField(component));
+ }
+ }
+
+ final ExtraComponents extra = type.getExtraComponents();
+ if (extra != null && extra.numComponents() > 0) {
+ final String singleFieldValue;
+ if (type instanceof Primitive) {
+ singleFieldValue = ((Primitive) type).getValue();
+ } else {
+ singleFieldValue = this.value;
+ }
+ componentList.add(new SingleValueField(singleFieldValue));
+
+ for (int i = 0; i < extra.numComponents(); i++) {
+ final Varies varies = extra.getComponent(i);
+ componentList.add(new HapiField(varies));
+ }
+ }
+
+ this.components = Collections.unmodifiableList(componentList);
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public List getComponents() {
+ return components;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java
index ddd28b2bf9..74a8f6cada 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java
@@ -32,63 +32,64 @@ import ca.uhn.hl7v2.model.Segment;
import ca.uhn.hl7v2.model.Structure;
public class HapiMessage implements HL7Message {
- private final Message message;
- private final List allSegments;
- private final Map> segmentMap;
-
- public HapiMessage(final Message message) throws HL7Exception {
- this.message = message;
-
- allSegments = new ArrayList<>();
- populateSegments(message, allSegments);
-
- segmentMap = new HashMap<>();
- for ( final HL7Segment segment : allSegments ) {
- final String segmentName = segment.getName();
- List segmentList = segmentMap.get(segmentName);
- if ( segmentList == null ) {
- segmentList = new ArrayList<>();
- segmentMap.put(segmentName, segmentList);
- }
-
- segmentList.add(segment);
- }
- }
-
- private void populateSegments(final Group group, final List segments) throws HL7Exception {
- for ( final String structureName : group.getNames() ) {
- final Structure[] structures = group.getAll(structureName);
- if ( group.isGroup(structureName) ) {
- for ( final Structure structure : structures ) {
- populateSegments((Group) structure, segments);
- }
- } else {
- for ( final Structure structure : structures ) {
- final Segment segment = (Segment) structure;
- final HapiSegment hapiSegment = new HapiSegment(segment);
- segments.add(hapiSegment);
- }
- }
- }
- }
-
- @Override
- public List getSegments() {
- return Collections.unmodifiableList(allSegments);
- }
- @Override
- public List getSegments(final String segmentType) {
- final List segments = segmentMap.get(segmentType);
- if ( segments == null ) {
- return Collections.emptyList();
- }
-
- return Collections.unmodifiableList(segments);
- }
+ private final Message message;
+ private final List allSegments;
+ private final Map> segmentMap;
- @Override
- public String toString() {
- return message.toString();
- }
+ public HapiMessage(final Message message) throws HL7Exception {
+ this.message = message;
+
+ allSegments = new ArrayList<>();
+ populateSegments(message, allSegments);
+
+ segmentMap = new HashMap<>();
+ for (final HL7Segment segment : allSegments) {
+ final String segmentName = segment.getName();
+ List segmentList = segmentMap.get(segmentName);
+ if (segmentList == null) {
+ segmentList = new ArrayList<>();
+ segmentMap.put(segmentName, segmentList);
+ }
+
+ segmentList.add(segment);
+ }
+ }
+
+ private void populateSegments(final Group group, final List segments) throws HL7Exception {
+ for (final String structureName : group.getNames()) {
+ final Structure[] structures = group.getAll(structureName);
+ if (group.isGroup(structureName)) {
+ for (final Structure structure : structures) {
+ populateSegments((Group) structure, segments);
+ }
+ } else {
+ for (final Structure structure : structures) {
+ final Segment segment = (Segment) structure;
+ final HapiSegment hapiSegment = new HapiSegment(segment);
+ segments.add(hapiSegment);
+ }
+ }
+ }
+ }
+
+ @Override
+ public List getSegments() {
+ return Collections.unmodifiableList(allSegments);
+ }
+
+ @Override
+ public List getSegments(final String segmentType) {
+ final List segments = segmentMap.get(segmentType);
+ if (segments == null) {
+ return Collections.emptyList();
+ }
+
+ return Collections.unmodifiableList(segments);
+ }
+
+ @Override
+ public String toString() {
+ return message.toString();
+ }
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java
index d50afdb960..20e646ccb0 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java
@@ -28,42 +28,42 @@ import ca.uhn.hl7v2.model.Segment;
import ca.uhn.hl7v2.model.Type;
public class HapiSegment implements HL7Segment {
- private final Segment segment;
- private final List fields;
-
- public HapiSegment(final Segment segment) throws HL7Exception {
- this.segment = segment;
-
- final List fieldList = new ArrayList<>();
- for (int i=1; i <= segment.numFields(); i++) {
- final Type[] types = segment.getField(i);
- if ( types == null || types.length == 0 ) {
- fieldList.add(new EmptyField());
- continue;
- }
-
- for ( final Type type : types ) {
- fieldList.add(new HapiField(type));
- }
- }
-
- this.fields = Collections.unmodifiableList(fieldList);
- }
-
-
- @Override
- public String getName() {
- return segment.getName();
- }
+ private final Segment segment;
+ private final List fields;
- @Override
- public List getFields() {
- return fields;
- }
+ public HapiSegment(final Segment segment) throws HL7Exception {
+ this.segment = segment;
- @Override
- public String toString() {
- return segment.toString();
- }
+ final List fieldList = new ArrayList<>();
+ for (int i = 1; i <= segment.numFields(); i++) {
+ final Type[] types = segment.getField(i);
+
+ if (types == null || types.length == 0) {
+ fieldList.add(new EmptyField());
+ continue;
+ }
+
+ for (final Type type : types) {
+ fieldList.add(new HapiField(type));
+ }
+ }
+
+ this.fields = Collections.unmodifiableList(fieldList);
+ }
+
+ @Override
+ public String getName() {
+ return segment.getName();
+ }
+
+ @Override
+ public List getFields() {
+ return fields;
+ }
+
+ @Override
+ public String toString() {
+ return segment.toString();
+ }
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java
index ed99077b45..b8a63510a0 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java
@@ -23,20 +23,21 @@ import org.apache.nifi.hl7.model.HL7Component;
import org.apache.nifi.hl7.model.HL7Field;
public class SingleValueField implements HL7Field {
- private final String value;
-
- public SingleValueField(final String value) {
- this.value = value;
- }
-
- @Override
- public String getValue() {
- return value;
- }
- @Override
- public List getComponents() {
- return Collections.emptyList();
- }
+ private final String value;
+
+ public SingleValueField(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public List getComponents() {
+ return Collections.emptyList();
+ }
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java
index e7b31a4c4a..4d2f2768db 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java
@@ -22,6 +22,6 @@ import org.apache.nifi.hl7.model.HL7Message;
public interface HL7Reader {
- HL7Message nextMessage() throws IOException;
-
+ HL7Message nextMessage() throws IOException;
+
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java
index 669f40c6bc..c0c74f95df 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java
@@ -19,22 +19,23 @@ package org.apache.nifi.hl7.io.exception;
import java.io.IOException;
public class InvalidHL7Exception extends IOException {
- private static final long serialVersionUID = -5675416667224562441L;
- public InvalidHL7Exception() {
- super();
- }
+ private static final long serialVersionUID = -5675416667224562441L;
- public InvalidHL7Exception(String message, Throwable cause) {
- super(message, cause);
- }
+ public InvalidHL7Exception() {
+ super();
+ }
- public InvalidHL7Exception(String message) {
- super(message);
- }
+ public InvalidHL7Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidHL7Exception(String message) {
+ super(message);
+ }
+
+ public InvalidHL7Exception(Throwable cause) {
+ super(cause);
+ }
- public InvalidHL7Exception(Throwable cause) {
- super(cause);
- }
-
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java
index cf355041b1..d8c1495a1b 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java
@@ -19,6 +19,8 @@ package org.apache.nifi.hl7.model;
import java.util.List;
public interface HL7Component {
- String getValue();
- List getComponents();
+
+ String getValue();
+
+ List getComponents();
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java
index 4086e581d1..ff58d962ef 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java
@@ -16,6 +16,5 @@
*/
package org.apache.nifi.hl7.model;
-
public interface HL7Field extends HL7Component {
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java
index dd9c2a9ff4..dc68c2b4ed 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java
@@ -20,8 +20,8 @@ import java.util.List;
public interface HL7Message {
- List getSegments();
-
- List getSegments(String segmentType);
-
+ List getSegments();
+
+ List getSegments(String segmentType);
+
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java
index de5aaa1d4b..d5d67aea05 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java
@@ -20,8 +20,8 @@ import java.util.List;
public interface HL7Segment {
- String getName();
-
- List getFields();
-
+ String getName();
+
+ List getFields();
+
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java
index 0903cc8d30..94998e78c8 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java
@@ -20,10 +20,10 @@ import org.apache.nifi.hl7.model.HL7Message;
public interface Declaration {
- String getAlias();
-
- boolean isRequired();
-
- Object getDeclaredValue(HL7Message message);
-
+ String getAlias();
+
+ boolean isRequired();
+
+ Object getDeclaredValue(HL7Message message);
+
}
diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
index a036106481..3734b4fe08 100644
--- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
+++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
@@ -16,8 +16,6 @@
*/
package org.apache.nifi.hl7.query;
-import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.*;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -58,196 +56,211 @@ import org.apache.nifi.hl7.query.result.StandardQueryResult;
import org.apache.nifi.hl7.query.antlr.HL7QueryLexer;
import org.apache.nifi.hl7.query.antlr.HL7QueryParser;
-
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.AND;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.DECLARE;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.DOT;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.EQUALS;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.GE;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.GT;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.IDENTIFIER;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.IS_NULL;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.LE;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.LT;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.MESSAGE;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT_EQUALS;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT_NULL;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NUMBER;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.OR;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.REQUIRED;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.SEGMENT_NAME;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.SELECT;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.STRING_LITERAL;
+import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.WHERE;
public class HL7Query {
- private final Tree tree;
- private final String query;
- private final Set declarations = new HashSet<>();
-
- private final List selections;
- private final BooleanEvaluator whereEvaluator;
-
- private HL7Query(final Tree tree, final String query) {
- this.tree = tree;
- this.query = query;
- List select = null;
- BooleanEvaluator where = null;
- for (int i=0; i < tree.getChildCount(); i++) {
- final Tree child = tree.getChild(i);
-
- switch (child.getType()) {
- case DECLARE:
- processDeclare(child);
- break;
- case SELECT:
- select = processSelect(child);
- break;
- case WHERE:
- where = processWhere(child);
- break;
- default:
- throw new HL7QueryParsingException("Found unexpected clause at root level: " + tree.getText());
- }
- }
-
- this.whereEvaluator = where;
- this.selections = select;
- }
-
- private void processDeclare(final Tree declare) {
- for (int i=0; i < declare.getChildCount(); i++) {
- final Tree declarationTree = declare.getChild(i);
-
- final String identifier = declarationTree.getChild(0).getText();
- final Tree requiredOrOptionalTree = declarationTree.getChild(1);
- final boolean required = requiredOrOptionalTree.getType() == REQUIRED;
-
- final String segmentName = declarationTree.getChild(2).getText();
-
- final Declaration declaration = new Declaration() {
- @Override
- public String getAlias() {
- return identifier;
- }
+ private final Tree tree;
+ private final String query;
+ private final Set declarations = new HashSet<>();
- @Override
- public boolean isRequired() {
- return required;
- }
+ private final List selections;
+ private final BooleanEvaluator whereEvaluator;
- @Override
- public Object getDeclaredValue(final HL7Message message) {
- if ( message == null ) {
- return null;
- }
-
- return message.getSegments(segmentName);
- }
- };
-
- declarations.add(declaration);
- }
- }
+ private HL7Query(final Tree tree, final String query) {
+ this.tree = tree;
+ this.query = query;
- private List processSelect(final Tree select) {
- final List selections = new ArrayList<>();
+ List select = null;
+ BooleanEvaluator where = null;
+ for (int i = 0; i < tree.getChildCount(); i++) {
+ final Tree child = tree.getChild(i);
- for (int i=0; i < select.getChildCount(); i++) {
- final Tree selectable = select.getChild(i);
-
- final String alias = getSelectedName(selectable);
- final Evaluator> selectionEvaluator = buildReferenceEvaluator(selectable);
- final Selection selection = new Selection(selectionEvaluator, alias);
- selections.add(selection);
- }
-
- return selections;
- }
-
-
- private String getSelectedName(final Tree selectable) {
- if ( selectable.getChildCount() == 0 ) {
- return selectable.getText();
- } else if (selectable.getType() == DOT ) {
- return getSelectedName(selectable.getChild(0)) + "." + getSelectedName(selectable.getChild(1));
- } else {
- return selectable.getChild(selectable.getChildCount() - 1).getText();
- }
- }
-
+ switch (child.getType()) {
+ case DECLARE:
+ processDeclare(child);
+ break;
+ case SELECT:
+ select = processSelect(child);
+ break;
+ case WHERE:
+ where = processWhere(child);
+ break;
+ default:
+ throw new HL7QueryParsingException("Found unexpected clause at root level: " + tree.getText());
+ }
+ }
- private BooleanEvaluator processWhere(final Tree where) {
- return buildBooleanEvaluator(where.getChild(0));
- }
-
+ this.whereEvaluator = where;
+ this.selections = select;
+ }
- private Evaluator> buildReferenceEvaluator(final Tree tree) {
- switch (tree.getType()) {
- case MESSAGE:
- return new MessageEvaluator();
- case SEGMENT_NAME:
- return new SegmentEvaluator(new StringLiteralEvaluator(tree.getText()));
- case IDENTIFIER:
- return new DeclaredReferenceEvaluator(new StringLiteralEvaluator(tree.getText()));
- case DOT:
- final Tree firstChild = tree.getChild(0);
- final Tree secondChild = tree.getChild(1);
- return new DotEvaluator(buildReferenceEvaluator(firstChild), buildIntegerEvaluator(secondChild));
- case STRING_LITERAL:
- return new StringLiteralEvaluator(tree.getText());
- case NUMBER:
- return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText()));
- default:
- throw new HL7QueryParsingException("Failed to build evaluator for " + tree.getText());
- }
- }
-
-
- private IntegerEvaluator buildIntegerEvaluator(final Tree tree) {
- switch (tree.getType()) {
- case NUMBER:
- return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText()));
- default:
- throw new HL7QueryParsingException("Failed to build Integer Evaluator for " + tree.getText());
- }
- }
-
-
- private BooleanEvaluator buildBooleanEvaluator(final Tree tree) {
- // TODO: add Date comparisons
- // LT/GT/GE/GE should allow for dates based on Field's Type
- // BETWEEN
- // DATE('2015/01/01')
- // DATE('2015/01/01 12:00:00')
- // DATE('24 HOURS AGO')
- // DATE('YESTERDAY')
-
- switch (tree.getType()) {
- case EQUALS:
- return new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case NOT_EQUALS:
- return new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case GT:
- return new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case LT:
- return new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case GE:
- return new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case LE:
- return new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
- case NOT:
- return new NotEvaluator(buildBooleanEvaluator(tree.getChild(0)));
- case AND:
- return new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
- case OR:
- return new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
- case IS_NULL:
- return new IsNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
- case NOT_NULL:
- return new NotNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
- default:
- throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'");
- }
- }
-
-
- Tree getTree() {
- return tree;
- }
-
- public String getQuery() {
- return query;
- }
-
- @Override
- public String toString() {
- return "HL7Query[" + query + "]";
- }
-
- public static HL7Query compile(final String query) {
- try {
+ private void processDeclare(final Tree declare) {
+ for (int i = 0; i < declare.getChildCount(); i++) {
+ final Tree declarationTree = declare.getChild(i);
+
+ final String identifier = declarationTree.getChild(0).getText();
+ final Tree requiredOrOptionalTree = declarationTree.getChild(1);
+ final boolean required = requiredOrOptionalTree.getType() == REQUIRED;
+
+ final String segmentName = declarationTree.getChild(2).getText();
+
+ final Declaration declaration = new Declaration() {
+ @Override
+ public String getAlias() {
+ return identifier;
+ }
+
+ @Override
+ public boolean isRequired() {
+ return required;
+ }
+
+ @Override
+ public Object getDeclaredValue(final HL7Message message) {
+ if (message == null) {
+ return null;
+ }
+
+ return message.getSegments(segmentName);
+ }
+ };
+
+ declarations.add(declaration);
+ }
+ }
+
+ private List processSelect(final Tree select) {
+ final List selections = new ArrayList<>();
+
+ for (int i = 0; i < select.getChildCount(); i++) {
+ final Tree selectable = select.getChild(i);
+
+ final String alias = getSelectedName(selectable);
+ final Evaluator> selectionEvaluator = buildReferenceEvaluator(selectable);
+ final Selection selection = new Selection(selectionEvaluator, alias);
+ selections.add(selection);
+ }
+
+ return selections;
+ }
+
+ private String getSelectedName(final Tree selectable) {
+ if (selectable.getChildCount() == 0) {
+ return selectable.getText();
+ } else if (selectable.getType() == DOT) {
+ return getSelectedName(selectable.getChild(0)) + "." + getSelectedName(selectable.getChild(1));
+ } else {
+ return selectable.getChild(selectable.getChildCount() - 1).getText();
+ }
+ }
+
+ private BooleanEvaluator processWhere(final Tree where) {
+ return buildBooleanEvaluator(where.getChild(0));
+ }
+
+ private Evaluator> buildReferenceEvaluator(final Tree tree) {
+ switch (tree.getType()) {
+ case MESSAGE:
+ return new MessageEvaluator();
+ case SEGMENT_NAME:
+ return new SegmentEvaluator(new StringLiteralEvaluator(tree.getText()));
+ case IDENTIFIER:
+ return new DeclaredReferenceEvaluator(new StringLiteralEvaluator(tree.getText()));
+ case DOT:
+ final Tree firstChild = tree.getChild(0);
+ final Tree secondChild = tree.getChild(1);
+ return new DotEvaluator(buildReferenceEvaluator(firstChild), buildIntegerEvaluator(secondChild));
+ case STRING_LITERAL:
+ return new StringLiteralEvaluator(tree.getText());
+ case NUMBER:
+ return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText()));
+ default:
+ throw new HL7QueryParsingException("Failed to build evaluator for " + tree.getText());
+ }
+ }
+
+ private IntegerEvaluator buildIntegerEvaluator(final Tree tree) {
+ switch (tree.getType()) {
+ case NUMBER:
+ return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText()));
+ default:
+ throw new HL7QueryParsingException("Failed to build Integer Evaluator for " + tree.getText());
+ }
+ }
+
+ private BooleanEvaluator buildBooleanEvaluator(final Tree tree) {
+ // TODO: add Date comparisons
+ // LT/GT/GE/GE should allow for dates based on Field's Type
+ // BETWEEN
+ // DATE('2015/01/01')
+ // DATE('2015/01/01 12:00:00')
+ // DATE('24 HOURS AGO')
+ // DATE('YESTERDAY')
+
+ switch (tree.getType()) {
+ case EQUALS:
+ return new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case NOT_EQUALS:
+ return new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case GT:
+ return new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case LT:
+ return new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case GE:
+ return new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case LE:
+ return new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ case NOT:
+ return new NotEvaluator(buildBooleanEvaluator(tree.getChild(0)));
+ case AND:
+ return new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
+ case OR:
+ return new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
+ case IS_NULL:
+ return new IsNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
+ case NOT_NULL:
+ return new NotNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
+ default:
+ throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'");
+ }
+ }
+
+ Tree getTree() {
+ return tree;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ @Override
+ public String toString() {
+ return "HL7Query[" + query + "]";
+ }
+
+ public static HL7Query compile(final String query) {
+ try {
final CommonTokenStream lexerTokenStream = createTokenStream(query);
final HL7QueryParser parser = new HL7QueryParser(lexerTokenStream);
final Tree tree = (Tree) parser.query().getTree();
@@ -258,155 +271,114 @@ public class HL7Query {
} catch (final Exception e) {
throw new HL7QueryParsingException(e);
}
- }
-
- private static CommonTokenStream createTokenStream(final String expression) throws HL7QueryParsingException {
+ }
+
+ private static CommonTokenStream createTokenStream(final String expression) throws HL7QueryParsingException {
final CharStream input = new ANTLRStringStream(expression);
final HL7QueryLexer lexer = new HL7QueryLexer(input);
return new CommonTokenStream(lexer);
}
-
- public List> getReturnTypes() {
- final List