Skip to content

Commit

Permalink
NIFI-14109 Ensured the variables of property descriptors are called P…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
dan-s1 committed Jan 6, 2025
1 parent 5dcf84f commit c05a2c0
Show file tree
Hide file tree
Showing 350 changed files with 1,157 additions and 1,052 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public class QueryAirtableTable extends AbstractProcessor {
.description("For FlowFiles created as a result of a successful query.")
.build();

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
API_URL,
PAT,
BASE_ID,
Expand All @@ -217,7 +217,7 @@ public class QueryAirtableTable extends AbstractProcessor {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,19 @@ abstract class AbstractAMQPProcessor<T extends AMQPWorker> extends AbstractProce
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
.build();

protected static final List<PropertyDescriptor> PARENT_PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
BROKERS,
HOST, PORT,
V_HOST,
USER,
PASSWORD,
AMQP_VERSION,
SSL_CONTEXT_SERVICE,
USE_CERT_AUTHENTICATION
);
USE_CERT_AUTHENTICATION);

protected static List<PropertyDescriptor> getCommonPropertyDescriptors() {
return PROPERTY_DESCRIPTORS;
}

private BlockingQueue<AMQPResource<T>> resourceQueue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public class ConsumeAMQP extends AbstractAMQPProcessor<AMQPConsumer> {
.description("All FlowFiles that are received from the AMQP queue are routed to this relationship")
.build();

private static final List<PropertyDescriptor> PROPERTIES = Stream.concat(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = Stream.concat(
Stream.of(
QUEUE,
AUTO_ACKNOWLEDGE,
Expand All @@ -172,7 +172,7 @@ public class ConsumeAMQP extends AbstractAMQPProcessor<AMQPConsumer> {
HEADER_KEY_PREFIX,
HEADER_SEPARATOR,
REMOVE_CURLY_BRACES
), PARENT_PROPERTIES.stream()
), getCommonPropertyDescriptors().stream()
).toList();

private static final Set<Relationship> RELATIONSHIPS = Set.of(
Expand Down Expand Up @@ -315,7 +315,7 @@ protected synchronized AMQPConsumer createAMQPWorker(final ProcessContext contex

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ public class PublishAMQP extends AbstractAMQPProcessor<AMQPPublisher> {
.description("All FlowFiles that cannot be routed to the AMQP destination are routed to this relationship")
.build();

private final static List<PropertyDescriptor> PROPERTIES = Stream.concat(
private final static List<PropertyDescriptor> PROPERTY_DESCRIPTORS = Stream.concat(
Stream.of(
EXCHANGE,
ROUTING_KEY,
HEADERS_SOURCE,
HEADERS_PATTERN,
HEADER_SEPARATOR
),
PARENT_PROPERTIES.stream()
getCommonPropertyDescriptors().stream()
).toList();

private final static Set<Relationship> RELATIONSHIPS = Set.of(
Expand Down Expand Up @@ -203,7 +203,7 @@ protected void processResource(final Connection connection, final AMQPPublisher

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class ApicurioSchemaRegistry extends AbstractControllerService implements
.identifiesControllerService(WebClientServiceProvider.class)
.build();

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
SCHEMA_REGISTRY_URL,
SCHEMA_GROUP_ID,
CACHE_SIZE,
Expand All @@ -105,7 +105,7 @@ public class ApicurioSchemaRegistry extends AbstractControllerService implements

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

private volatile SchemaRegistryClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public class GetAsanaObject extends AbstractProcessor {
.addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
.build();

protected static final List<PropertyDescriptor> DESCRIPTORS = List.of(
protected static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
PROP_ASANA_CLIENT_SERVICE,
PROP_DISTRIBUTED_CACHE_SERVICE,
PROP_ASANA_OBJECT_TYPE,
Expand Down Expand Up @@ -236,7 +236,7 @@ public Set<Relationship> getRelationships() {

@Override
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return DESCRIPTORS;
return PROPERTY_DESCRIPTORS;
}

@OnScheduled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class StandardAsanaClientProviderService extends AbstractControllerServic
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
.build();

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
PROP_ASANA_API_BASE_URL,
PROP_ASANA_PERSONAL_ACCESS_TOKEN,
PROP_ASANA_WORKSPACE_NAME
Expand All @@ -83,7 +83,7 @@ public class StandardAsanaClientProviderService extends AbstractControllerServic

@Override
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@OnEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class ExtractAvroMetadata extends AbstractProcessor {
static final String SCHEMA_FINGERPRINT_ATTR = "schema.fingerprint";
static final String ITEM_COUNT_ATTR = "item.count";

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
FINGERPRINT_ALGORITHM,
METADATA_KEYS,
COUNT_ITEMS
Expand All @@ -131,7 +131,7 @@ protected void init(ProcessorInitializationContext context) {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class SplitAvro extends AbstractProcessor {
"avro.codec"
);

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
SPLIT_STRATEGY,
OUTPUT_SIZE,
OUTPUT_STRATEGY,
Expand All @@ -170,7 +170,7 @@ public Set<Relationship> getRelationships() {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void migrateProperties(final PropertyConfiguration config) {
config.renameProperty("aws-region", REGION.getName());
}

protected static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
MANDATORY_AWS_CREDENTIALS_PROVIDER_SERVICE,
REGION,
TIMEOUT,
Expand All @@ -95,14 +95,18 @@ public void migrateProperties(final PropertyConfiguration config) {
REL_FAILURE
);

protected static List<PropertyDescriptor> getCommonPropertyDescriptors() {
return PROPERTY_DESCRIPTORS;
}

@Override
public Set<Relationship> getRelationships() {
return RELATIONSHIPS;
}

@Override
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public abstract class AbstractAwsMachineLearningJobStatusProcessor<
.autoTerminateDefault(true)
.build();
public static final String FAILURE_REASON_ATTRIBUTE = "failure.reason";
protected static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
TASK_ID,
MANDATORY_AWS_CREDENTIALS_PROVIDER_SERVICE,
REGION,
Expand All @@ -92,6 +92,10 @@ public abstract class AbstractAwsMachineLearningJobStatusProcessor<
.findAndAddModules()
.build();

protected static List<PropertyDescriptor> getCommonPropertyDescriptors() {
return PROPERTY_DESCRIPTORS;
}

@Override
public void migrateProperties(final PropertyConfiguration config) {
config.renameProperty("aws-region", REGION.getName());
Expand All @@ -112,7 +116,7 @@ public Set<Relationship> getRelationships() {

@Override
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

protected FlowFile writeToFlowFile(final ProcessSession session, final FlowFile flowFile, final AwsResponse response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public String getDescription() {

private static final String DEFAULT_USER_AGENT = "NiFi";
private static final Protocol DEFAULT_PROTOCOL = Protocol.HTTPS;
private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
SECRET_LISTING_STRATEGY,
SECRET_NAME_PATTERN,
SECRET_NAMES,
Expand All @@ -179,7 +179,7 @@ public String getDescription() {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public ValidationResult validate(String subject, String input, ValidationContext
.addValidator(DOUBLE_VALIDATOR)
.build();

public static final List<PropertyDescriptor> PROPERTIES = List.of(
public static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
NAMESPACE,
METRIC_NAME,
REGION,
Expand All @@ -216,7 +216,7 @@ protected CloudWatchClientBuilder createClientBuilder(final ProcessContext conte

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public class AWSCredentialsProviderControllerService extends AbstractControllerS
.build();


private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
USE_DEFAULT_CREDENTIALS,
ACCESS_KEY_ID,
SECRET_KEY,
Expand Down Expand Up @@ -304,7 +304,7 @@ public class AWSCredentialsProviderControllerService extends AbstractControllerS

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
})
public class DeleteDynamoDB extends AbstractDynamoDBProcessor {

public static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
TABLE,
REGION,
AWS_CREDENTIALS_PROVIDER_SERVICE,
Expand All @@ -88,7 +88,7 @@ public class DeleteDynamoDB extends AbstractDynamoDBProcessor {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class GetDynamoDB extends AbstractDynamoDBProcessor {
.required(false)
.build();

public static final List<PropertyDescriptor> PROPERTIES = List.of(
public static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
TABLE,
REGION,
AWS_CREDENTIALS_PROVIDER_SERVICE,
Expand Down Expand Up @@ -117,7 +117,7 @@ public Set<Relationship> getRelationships() {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
@SystemResourceConsideration(resource = SystemResource.MEMORY)
public class PutDynamoDB extends AbstractDynamoDBProcessor {

public static final List<PropertyDescriptor> PROPERTIES = List.of(
public static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
TABLE,
REGION,
AWS_CREDENTIALS_PROVIDER_SERVICE,
Expand All @@ -99,7 +99,7 @@ public class PutDynamoDB extends AbstractDynamoDBProcessor {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor {
.description("Defines the name of the sort key field in the DynamoDB table. Sort key is also known as range key.")
.build();

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
TABLE,
REGION,
AWS_CREDENTIALS_PROVIDER_SERVICE,
Expand All @@ -190,7 +190,7 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor {

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class PutKinesisFirehose extends AbstractAwsSyncProcessor<FirehoseClient,
.sensitive(false)
.build();

private static final List<PropertyDescriptor> PROPERTIES = List.of(
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
KINESIS_FIREHOSE_DELIVERY_STREAM_NAME,
BATCH_SIZE,
REGION,
Expand All @@ -101,7 +101,7 @@ public class PutKinesisFirehose extends AbstractAwsSyncProcessor<FirehoseClient,

@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTIES;
return PROPERTY_DESCRIPTORS;
}

@Override
Expand Down
Loading

0 comments on commit c05a2c0

Please sign in to comment.