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

NIFI-4130 Add lookup controller service in TransformXML to define XSL… #1953

Closed
wants to merge 2 commits into from

Conversation

pvillard31
Copy link
Contributor

…T from the UI

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

@jfrazee
Copy link
Member

jfrazee commented Jul 11, 2017

@pvillard31 It seems like we should just use LookupAttribute for this use case. Thoughts?

@pvillard31
Copy link
Contributor Author

Yes @jfrazee, that could be an option. However, do you think that's a good idea to have the XSLT as an attribute of the flow files? The XSLT could be really big and I'm not sure users will have the reflex to use an UpdateAttribute to remove it after the TransformXml.

@jfrazee
Copy link
Member

jfrazee commented Jul 12, 2017

@pvillard31 Right, wouldn't want to do that. I misunderstood what you were doing. This makes sense.

@bdesert
Copy link
Contributor

bdesert commented Nov 12, 2018

Reviewing...

@pvillard31
Copy link
Contributor Author

Hey @bdesert - I just rebased the PR. I'll probably add a warning about adding large XSLTs in a StringLookupService as it'll be in memory.

Copy link
Contributor

@bdesert bdesert left a comment

Choose a reason for hiding this comment

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

Although JUnits aren't failing and look good (covering all the use cases), actual implementation is failing, when cache is in use. It works fine when cache is 0.
Exception I'm getting:

Caused by: java.lang.NullPointerException: null
        at org.apache.nifi.processor.StandardProcessContext.getControllerService(StandardProcessContext.java:137)
        at org.apache.nifi.attribute.expression.language.StandardPropertyValue.asControllerService(StandardPropertyValue.java:187)
        at org.apache.nifi.processors.standard.TransformXml.newTemplates(TransformXml.java:270)
        at org.apache.nifi.processors.standard.TransformXml.access$000(TransformXml.java:93)

I think it is related to cache creation in onSchedule and context.
Looks like in Junits and in actual running app, this is different.

.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.addValidator(StandardValidators.FILE_EXISTS_VALIDATOR)
.build();

public static final PropertyDescriptor XSLT_CONTROLLER = new PropertyDescriptor.Builder()
.name("xslt-controller")
.displayName("XSLT controller")
Copy link
Contributor

Choose a reason for hiding this comment

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

"XSLT Lookup" Would be more readable.
Description: "Lookup controller used to store..."
And: XSLT_CONTROLLER_KEY: "XSLT Lookup Key" (description looks fine)

+ "the XSLT controller property.")
.required(false)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
Copy link
Contributor

Choose a reason for hiding this comment

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

since this property supports EL, shouldn't it be NON_EMPTY_EL_VALIDATOR?

@pvillard31
Copy link
Contributor Author

Hey @bdesert - thanks a lot for the review, I just pushed a commit that should address your comments.

@bdesert
Copy link
Contributor

bdesert commented Nov 14, 2018

+1 LGTM. Tested on local env, with XSLT as a file (regression), with lookup service, cache size 0 and >0, all works as expected. Ready for merge. @mattyb149 , please could you please give a final look?

@mattyb149
Copy link
Contributor

+1 LGTM, thanks for the review @bdesert and the improvement @pvillard31 ! Merging to master

@asfgit asfgit closed this in 4112af0 Nov 14, 2018
snagafritz pushed a commit to Snagajob/nifi that referenced this pull request Nov 15, 2018
…T from the UI

addressed review comments

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes apache#1953
snagafritz pushed a commit to Snagajob/nifi that referenced this pull request Dec 2, 2018
…T from the UI

addressed review comments

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes apache#1953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants