NIFI-10617: Add missing DynamicProperty annotation to processors that use them (#6509)

This closes #6509
This commit is contained in:
Matt Burgess 2022-10-17 12:46:37 -04:00 committed by GitHub
parent a76abef270
commit f43b989c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package org.apache.nifi.elasticsearch;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnEnabled;
@ -51,6 +52,8 @@ import java.util.stream.Collectors;
@CapabilityDescription("Lookup a record from Elasticsearch Server associated with the specified document ID. " +
"The coordinates that are passed to the lookup must contain the key 'id'.")
@Tags({"lookup", "enrich", "record", "elasticsearch"})
@DynamicProperty(name = "A JSONPath expression", value = "A Record Path expression",
description = "Retrieves an object using JSONPath from the result document and places it in the return Record at the specified Record Path.")
public class ElasticSearchLookupService extends JsonInferenceSchemaRegistryService implements LookupService<Record> {
public static final PropertyDescriptor CLIENT_SERVICE = new PropertyDescriptor.Builder()
.name("el-rest-client-service")

View File

@ -302,6 +302,7 @@ public class ConsumeEWS extends AbstractProcessor {
return service;
}
// TODO remove this at next major release as dynamic properties are not used by this processor
@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new PropertyDescriptor.Builder()

View File

@ -17,6 +17,7 @@
package org.apache.nifi.processors.standard;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.WritesAttribute;
import org.apache.nifi.annotation.behavior.WritesAttributes;
@ -55,8 +56,12 @@ import java.util.stream.Collectors;
@CapabilityDescription("A processor that can count the number of items in a record set, as well as provide counts based on " +
"user-defined criteria on subsets of the record set.")
@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED)
@DynamicProperty(name = "Record Path property", value = "The Record Path value",
expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
description = "A Record Path value, pointing to a field to be counted")
@WritesAttributes({
@WritesAttribute(attribute = CalculateRecordStats.RECORD_COUNT_ATTR, description = "A count of the records in the record set in the flowfile."),
@WritesAttribute(attribute = CalculateRecordStats.RECORD_COUNT_ATTR, description = "A count of the records in the record set in the FlowFile."),
@WritesAttribute(attribute = "recordStats.<User Defined Property Name>.count", description = "A count of the records that contain a value for the user defined property."),
@WritesAttribute(attribute = "recordStats.<User Defined Property Name>.<value>.count",
description = "Each value discovered for the user defined property will have its own count attribute. " +

View File

@ -18,6 +18,7 @@
package org.apache.nifi.processors.standard;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
import org.apache.nifi.annotation.behavior.SideEffectFree;
@ -86,6 +87,9 @@ import java.util.concurrent.atomic.AtomicInteger;
+ "all the fields of the parent records from the root level to the extracted record. This assumes that the fields to add in "
+ "the record are defined in the schema of the Record Writer controller service. See examples in the additional details "
+ "documentation of this processor.")
@DynamicProperty(name = "Record Path property", value = "The Record Path value",
expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
description = "A Record Path value, pointing to a field of type ARRAY containing RECORD objects")
@WritesAttributes({
@WritesAttribute(attribute = "record.count", description = "The generated FlowFile will have a 'record.count' attribute indicating "
+ "the number of records that were written to the FlowFile."),

View File

@ -420,6 +420,7 @@ public class PutDatabaseRecord extends AbstractProcessor {
return propDescriptors;
}
// TODO remove this at next major release as dynamic properties are not used by this processor
@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new Builder()

View File

@ -86,6 +86,7 @@ public class DistributedMapCacheLookupService extends AbstractControllerService
return STANDARD_CHARSETS.stream().map(c -> c.displayName()).collect(Collectors.toSet());
}
// TODO remove this at next major release as dynamic properties are not used by this component
@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new PropertyDescriptor.Builder()

View File

@ -16,6 +16,7 @@
*/
package org.apache.nifi.processors.gettcp;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.SideEffectFree;
import org.apache.nifi.annotation.behavior.TriggerSerially;
@ -55,6 +56,8 @@ import java.util.concurrent.TimeUnit;
@Tags({"get", "fetch", "poll", "tcp", "ingest", "source", "input"})
@InputRequirement(InputRequirement.Requirement.INPUT_FORBIDDEN)
@CapabilityDescription("Connects over TCP to the provided endpoint(s). Received data will be written as content to the FlowFile")
@DynamicProperty(name = "A FlowFile attribute to set", value = "The value to set it to",
description = "Sets a FlowFile attribute specified by the Dynamic Property's key with the value specified by the Dynamic Property's value")
@WritesAttribute(attribute = "source.endpoint", description = "The address of the source endpoint the message came from")
public class GetTCP extends AbstractSessionFactoryProcessor {