-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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-14109 Refactored remaining processors and control services to be uniform when creating properties and relationships. #9600
base: main
Are you sure you want to change the base?
Conversation
relationships.addAll(getAdditionalRelationships()); | ||
this.relationships = Collections.unmodifiableSet(relationships); | ||
this.descriptors = Stream.concat( | ||
PROPERTIES.stream(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no simpler/cleaner option than Stream.concat ... list.stream().... .toList()? Overall this is cleanear in some ways but does seem like there is a cleaner/simpler way of saying 'List from these lists'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this as I saw that being used in other parts of the code e.g. ElasticSearchLookupService
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would surprise me if this is the best way to express these declarations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was the cleanest way to make an unmodifiable list. A quick Google search indicates that is the Java 9 way to combine lists and make them unmodifiable.
...rocessors/src/main/java/org/apache/nifi/services/azure/eventhub/AzureEventHubRecordSink.java
Outdated
Show resolved
Hide resolved
AMQP_VERSION, | ||
SSL_CONTEXT_SERVICE, | ||
USE_CERT_AUTHENTICATION | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the parent class 'getCommonPropertyDescriptors' method is removed and instead a subclass is supposed to know to use the static list of descriptors as they build their own lists. I think this weakens what the author intended in building that class.
Also there is at least one example much later on in this PR where you kept the parent method. I think keeping the parent method better conveys intent to any subclassers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert this back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up adding 'getCommonPropertyDescriptors' for all the parent children relationships I saw. Below are the ones I made changes for (Parents on the left and children who use the method on the right).
- AbstractAMQPProcessor - ConsumeAMQP, PublishAMQP
- AbstractAwsMachineLearningJobStarter - StartAwsTextractJob
- AbstractAwsMachineLearningJobStatusProcessor - GetAwsTextractJobStatus
- AbstractAzureCosmosDBProcessor - PutAzureCosmosDBRecord
- AbstractEmailProcessor - ConsumeIMAP, ConsumePOP3
- AbstractGridFSProcessor (applies this also to relationships) - FetchGridFS, PutGridFS
- AbstractHadoopProcessor - AbstractFetchHDFSRecord, AbstractPutHDFSRecord (PutParquet but doesn't use common method), CreateHadoopSequenceFile, DeleteHDFS, FetchHDFS, GetHDFS, GetHDFSEvents, GetHDFSFileInfo, ListHDFS, MoveHDFS, PutHDFS
- AbstractJoltTransform - JoltTransformJSON, JoltTransformRecord
- AbstractMongoProcessor - DeleteMongo, GetMongo, PutMongo, PutMongoBulkOperations, PutMongoRecord, RunMongoAggregation
- SplunkAPICall - PutSplunkHTTP, QuerySplunkIndexingStatus
… uniform when creating properties and relationships.
…ROPERTY_DESCRIPTORS. For parent processor classes which defined common properties, made getCommonPropertyDescriptors() method for children to use to load them. Ensured lists of PropertyDescriptor objects has each PropertyDescriptor on its own line and sets of RelationShip objects has each Relationship on its own line to improve readability.
Summary
NIFI-14109
This PR aims to have a lists of
PropertyDescriptor
objects and sets ofRelationship
objects all be defined with onePropertyDescriptor
andRelationship
per line for increased readability. The list variables are namedPROPERTY_DESCRIPTORS
and the set variables are namedRELATIONSHIPS
. Also for commonPropertyDescriptor
objects defined in a parent a method, a methodgetCommonPropertyDescriptors
is defined to allow children to use them. This was done for the following parent and children classes (parents on left and children which use the method are on the right).Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation