Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NiFi 2.x #19

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

stevedlawrence
Copy link
Member

The latest versions of NiFi change/remove API functions that are used by the Daffodil processors. Trying to use the current version of these processors in newer versions of Daffodil leads to NoClassDefFoundErrors and breaks NiFi.

To fix this, this replaces those API functions/classes with variants that exist in both older and newer versions of NiFi. This allows this processor to maintain compatibility with older versions of NiFi while still working with newer versions.

Specific changes include:

  • NiFi 2.x removes support for EventDriven processors. This is likely rarely used in NiFi 1.x flows so support for EventDriven is removed for DaffodilParse/Unparse processors
  • NiFi 2.x replaces the allowableValues(AllowableValues...) function with allowableValues(DescribedValue...). The DescribedValue variant does not exist in older versions of NiFi, so we instead just use the allowableValues(String...) variant, which exists in all versions of NiFi. This loses the human readable description of the field, but the allowable values are mostly self-descriptive. And in case there is still confusion, descriptions of the possible values are added to additionalDetails.html

Closes #18

The latest versions of NiFi change/remove API functions that are used by
the Daffodil processors. Trying to use the current version of these
processors in newer versions of Daffodil leads to NoClassDefFoundErrors
and breaks NiFi.

To fix this, this replaces those API functions/classes with variants
that exist in both older and newer versions of NiFi. This allows this
processor to maintain compatibility with older versions of NiFi while
still working with newer versions.

Specific changes include:

- NiFi 2.x removes support for EventDriven processors. This is likely
  rarely used in NiFi 1.x flows so support for EventDriven is removed
  for DaffodilParse/Unparse processors
- NiFi 2.x replaces the allowableValues(AllowableValues...) function
  with allowableValues(DescribedValue...). The DescribedValue variant
  does not exist in older versions of NiFi, so we instead just use the
  allowableValues(String...) variant, which exists in all versions of
  NiFi. This loses the human readable description of the field, but the
  allowable values are mostly self-descriptive. And in case there is
  still confusion, descriptions of the possible values are added to
  additionalDetails.html

Closes OwlCyberDefense#18
Copy link
Collaborator

@mbeckerle mbeckerle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Changes look fine. I am not a NiFi expert so I really cannot spot whether there are key details missing.

It's shame NiFi doesn't use Scala. I believe this AllowableValues thing could be done elegantly in Scala in a way that would be as simple in the code as just using strings, but which would be type safe at compile time and avoid the need for runtime checking code.

@stevedlawrence
Copy link
Member Author

but which would be type safe at compile time and avoid the need for runtime checking code.

Definitely. Unfortunately, the NiFi property API is pretty much all string based, with a few helper functions to convert to primitives.

@stevedlawrence stevedlawrence merged commit 9afafd0 into OwlCyberDefense:master Oct 9, 2024
6 checks passed
@stevedlawrence stevedlawrence deleted the 18-nifi-2.x branch October 9, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use Nifi 2.0.0-M4 after copy Daffodil nar file into /lib
2 participants