From 8eb013a813ad5e8452a3eacd9774068a7bb4d3b3 Mon Sep 17 00:00:00 2001 From: Peter Turcsanyi Date: Fri, 22 Mar 2024 13:13:29 +0100 Subject: [PATCH] NIFI-12933 Rearranged properties on GCP processors Also used current API methods for relationships/properties collections Signed-off-by: Pierre Villard This closes #8545. --- .../processors/gcp/AbstractGCPProcessor.java | 9 ----- .../bigquery/AbstractBigQueryProcessor.java | 17 +-------- .../processors/gcp/bigquery/PutBigQuery.java | 12 ++---- .../AbstractGCPubSubWithProxyProcessor.java | 10 ----- .../gcp/pubsub/ConsumeGCPubSub.java | 35 +++++++++++------- .../gcp/pubsub/PublishGCPubSub.java | 37 ++++++++++--------- .../gcp/pubsub/lite/ConsumeGCPubSubLite.java | 34 +++++++++-------- .../gcp/pubsub/lite/PublishGCPubSubLite.java | 25 +++++++------ .../gcp/storage/AbstractGCSProcessor.java | 15 +------- .../gcp/storage/DeleteGCSObject.java | 19 ++++++---- .../gcp/storage/FetchGCSObject.java | 26 ++++++++----- .../processors/gcp/storage/ListGCSBucket.java | 31 +++++++++------- .../processors/gcp/storage/PutGCSObject.java | 33 ++++++++++------- 13 files changed, 146 insertions(+), 157 deletions(-) diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/AbstractGCPProcessor.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/AbstractGCPProcessor.java index 0650451a5b..db6fc1e722 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/AbstractGCPProcessor.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/AbstractGCPProcessor.java @@ -85,15 +85,6 @@ public abstract class AbstractGCPProcessor< return cloudService; } - @Override - public List getSupportedPropertyDescriptors() { - return List.of(PROJECT_ID, - GCP_CREDENTIALS_PROVIDER_SERVICE, - RETRY_COUNT, - PROXY_CONFIGURATION_SERVICE - ); - } - @Override public void migrateProperties(final PropertyConfiguration config) { diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java index c2652b29f2..2012c4c474 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java @@ -39,10 +39,8 @@ import org.apache.nifi.proxy.ProxyConfiguration; import org.apache.nifi.util.StringUtils; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -63,8 +61,7 @@ public abstract class AbstractBigQueryProcessor extends AbstractGCPProcessor relationships = Collections.unmodifiableSet( - new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE))); + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE); public static final PropertyDescriptor DATASET = new PropertyDescriptor.Builder() .name(BigQueryAttributes.DATASET_ATTR) @@ -98,17 +95,7 @@ public abstract class AbstractBigQueryProcessor extends AbstractGCPProcessor getRelationships() { - return relationships; - } - - @Override - public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(); - descriptors.addAll(super.getSupportedPropertyDescriptors()); - descriptors.add(DATASET); - descriptors.add(TABLE_NAME); - descriptors.add(IGNORE_UNKNOWN); - return Collections.unmodifiableList(descriptors); + return RELATIONSHIPS; } @Override diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java index 8536f232c7..cb51362a08 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQuery.java @@ -62,7 +62,6 @@ import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.processors.gcp.ProxyAwareTransportFactory; import org.apache.nifi.processors.gcp.bigquery.proto.ProtoUtils; import org.apache.nifi.proxy.ProxyConfiguration; import org.apache.nifi.serialization.RecordReader; @@ -80,7 +79,6 @@ import java.sql.Timestamp; import java.time.LocalTime; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -88,10 +86,6 @@ import java.util.Optional; import java.util.concurrent.Phaser; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Stream; - -import static java.util.stream.Collectors.collectingAndThen; -import static java.util.stream.Collectors.toList; @TriggerSerially @Tags({"google", "google cloud", "bq", "bigquery"}) @@ -179,7 +173,7 @@ public class PutBigQuery extends AbstractBigQueryProcessor { .defaultValue("false") .build(); - private static final List DESCRIPTORS = Stream.of( + private static final List DESCRIPTORS = List.of( GCP_CREDENTIALS_PROVIDER_SERVICE, PROJECT_ID, BIGQUERY_API_ENDPOINT, @@ -190,8 +184,8 @@ public class PutBigQuery extends AbstractBigQueryProcessor { APPEND_RECORD_COUNT, RETRY_COUNT, SKIP_INVALID_ROWS, - ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxyAwareTransportFactory.PROXY_SPECS) - ).collect(collectingAndThen(toList(), Collections::unmodifiableList)); + PROXY_CONFIGURATION_SERVICE + ); @Override public List getSupportedPropertyDescriptors() { diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/AbstractGCPubSubWithProxyProcessor.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/AbstractGCPubSubWithProxyProcessor.java index 636a9b7729..aed2b945a5 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/AbstractGCPubSubWithProxyProcessor.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/AbstractGCPubSubWithProxyProcessor.java @@ -24,21 +24,11 @@ import io.grpc.ProxyDetector; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.SocketAddress; -import java.util.List; import javax.annotation.Nullable; -import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.proxy.ProxyConfiguration; public abstract class AbstractGCPubSubWithProxyProcessor extends AbstractGCPubSubProcessor { - @Override - public List getSupportedPropertyDescriptors() { - return List.of( - PROJECT_ID, - PROXY_CONFIGURATION_SERVICE, - GCP_CREDENTIALS_PROVIDER_SERVICE - ); - } protected TransportChannelProvider getTransportChannelProvider(ProcessContext context) { final ProxyConfiguration proxyConfiguration = ProxyConfiguration.getConfiguration(context); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java index 5e93eeebf3..377b9275f3 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java @@ -95,11 +95,32 @@ public class ConsumeGCPubSub extends AbstractGCPubSubWithProxyProcessor { .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + SUBSCRIPTION, + BATCH_SIZE_THRESHOLD, + API_ENDPOINT, + PROXY_CONFIGURATION_SERVICE + ); + + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS); + private SubscriberStub subscriber = null; private PullRequest pullRequest; private final AtomicReference storedException = new AtomicReference<>(); + @Override + public List getSupportedPropertyDescriptors() { + return DESCRIPTORS; + } + + @Override + public Set getRelationships() { + return RELATIONSHIPS; + } + @OnScheduled public void onScheduled(ProcessContext context) { final Integer batchSize = context.getProperty(BATCH_SIZE_THRESHOLD).asInteger(); @@ -188,20 +209,6 @@ public class ConsumeGCPubSub extends AbstractGCPubSubWithProxyProcessor { } } - @Override - public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(super.getSupportedPropertyDescriptors()); - descriptors.add(SUBSCRIPTION); - descriptors.add(BATCH_SIZE_THRESHOLD); - descriptors.add(API_ENDPOINT); - return Collections.unmodifiableList(descriptors); - } - - @Override - public Set getRelationships() { - return Collections.singleton(REL_SUCCESS); - } - @Override public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException { if (subscriber == null) { diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSub.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSub.java index 4c95e466ef..0d43ef06d1 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSub.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSub.java @@ -75,10 +75,8 @@ import org.threeten.bp.Duration; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -173,22 +171,29 @@ public class PublishGCPubSub extends AbstractGCPubSubWithProxyProcessor { .description("FlowFiles are routed to this relationship if the Google Cloud Pub/Sub operation fails but attempting the operation again may succeed.") .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + TOPIC_NAME, + MESSAGE_DERIVATION_STRATEGY, + RECORD_READER, + RECORD_WRITER, + MAX_BATCH_SIZE, + MAX_MESSAGE_SIZE, + BATCH_SIZE_THRESHOLD, + BATCH_BYTES_THRESHOLD, + BATCH_DELAY_THRESHOLD, + API_ENDPOINT, + PROXY_CONFIGURATION_SERVICE + ); + + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE, REL_RETRY); + protected Publisher publisher = null; @Override public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(super.getSupportedPropertyDescriptors()); - descriptors.add(MAX_BATCH_SIZE); - descriptors.add(MESSAGE_DERIVATION_STRATEGY); - descriptors.add(RECORD_READER); - descriptors.add(RECORD_WRITER); - descriptors.add(MAX_MESSAGE_SIZE); - descriptors.add(TOPIC_NAME); - descriptors.add(BATCH_SIZE_THRESHOLD); - descriptors.add(BATCH_BYTES_THRESHOLD); - descriptors.add(BATCH_DELAY_THRESHOLD); - descriptors.add(API_ENDPOINT); - return Collections.unmodifiableList(descriptors); + return DESCRIPTORS; } @Override @@ -205,9 +210,7 @@ public class PublishGCPubSub extends AbstractGCPubSubWithProxyProcessor { @Override public Set getRelationships() { - return Collections.unmodifiableSet( - new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE, REL_RETRY)) - ); + return RELATIONSHIPS; } @Override diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/ConsumeGCPubSubLite.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/ConsumeGCPubSubLite.java index e223f06d43..9cab4f6383 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/ConsumeGCPubSubLite.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/ConsumeGCPubSubLite.java @@ -52,9 +52,7 @@ import org.apache.nifi.processor.util.StandardValidators; import org.apache.nifi.processors.gcp.pubsub.AbstractGCPubSubProcessor; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -116,9 +114,28 @@ public class ConsumeGCPubSubLite extends AbstractGCPubSubProcessor implements Ve .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + SUBSCRIPTION, + BYTES_OUTSTANDING, + MESSAGES_OUTSTANDING + ); + + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS); + private Subscriber subscriber = null; private BlockingQueue messages = new LinkedBlockingQueue<>(); + @Override + public List getSupportedPropertyDescriptors() { + return DESCRIPTORS; + } + + @Override + public Set getRelationships() { + return RELATIONSHIPS; + } + @Override protected Collection customValidate(final ValidationContext validationContext) { final Collection results = new ArrayList(1); @@ -168,19 +185,6 @@ public class ConsumeGCPubSubLite extends AbstractGCPubSubProcessor implements Ve } } - @Override - public List getSupportedPropertyDescriptors() { - return Collections.unmodifiableList(Arrays.asList(SUBSCRIPTION, - GCP_CREDENTIALS_PROVIDER_SERVICE, - BYTES_OUTSTANDING, - MESSAGES_OUTSTANDING)); - } - - @Override - public Set getRelationships() { - return Collections.singleton(REL_SUCCESS); - } - @Override public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException { if (subscriber == null) { diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/PublishGCPubSubLite.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/PublishGCPubSubLite.java index 17ec36e679..931f535817 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/PublishGCPubSubLite.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/lite/PublishGCPubSubLite.java @@ -61,11 +61,8 @@ import org.threeten.bp.Duration; import java.io.ByteArrayOutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -112,16 +109,22 @@ public class PublishGCPubSubLite extends AbstractGCPubSubProcessor implements Ve .addValidator(StandardValidators.NON_BLANK_VALIDATOR) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + TOPIC_NAME, + ORDERING_KEY, + BATCH_SIZE_THRESHOLD, + BATCH_BYTES_THRESHOLD, + BATCH_DELAY_THRESHOLD + ); + + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE); + private Publisher publisher = null; @Override public List getSupportedPropertyDescriptors() { - return Collections.unmodifiableList(Arrays.asList(TOPIC_NAME, - GCP_CREDENTIALS_PROVIDER_SERVICE, - ORDERING_KEY, - BATCH_SIZE_THRESHOLD, - BATCH_BYTES_THRESHOLD, - BATCH_DELAY_THRESHOLD)); + return DESCRIPTORS; } @Override @@ -138,9 +141,7 @@ public class PublishGCPubSubLite extends AbstractGCPubSubProcessor implements Ve @Override public Set getRelationships() { - return Collections.unmodifiableSet( - new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE)) - ); + return RELATIONSHIPS; } @Override diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/AbstractGCSProcessor.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/AbstractGCSProcessor.java index 213ff6d31e..cf343389f8 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/AbstractGCSProcessor.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/AbstractGCSProcessor.java @@ -39,10 +39,7 @@ import org.apache.nifi.proxy.ProxyConfiguration; import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -62,12 +59,11 @@ public abstract class AbstractGCSProcessor extends AbstractGCPProcessor relationships = Collections.unmodifiableSet( - new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE))); + public static final Set RELATIONSHIPS = Set.of(REL_SUCCESS, REL_FAILURE); @Override public Set getRelationships() { - return relationships; + return RELATIONSHIPS; } // https://cloud.google.com/storage/docs/request-endpoints#storage-set-client-endpoint-java @@ -81,13 +77,6 @@ public abstract class AbstractGCSProcessor extends AbstractGCPProcessor getSupportedPropertyDescriptors() { - final List propertyDescriptors = new ArrayList<>(super.getSupportedPropertyDescriptors()); - propertyDescriptors.add(STORAGE_API_URL); - return Collections.unmodifiableList(propertyDescriptors); - } - @Override public List verify(final ProcessContext context, final ComponentLog verificationLogger, final Map attributes) { final List results = new ArrayList<>(verifyCloudService(context, verificationLogger, attributes)); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObject.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObject.java index ec8ed1bf42..0c34d5878a 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObject.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObject.java @@ -31,7 +31,6 @@ import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.util.StandardValidators; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; @@ -77,14 +76,20 @@ public class DeleteGCSObject extends AbstractGCSProcessor { .required(false) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + BUCKET, + KEY, + GENERATION, + RETRY_COUNT, + STORAGE_API_URL, + PROXY_CONFIGURATION_SERVICE + ); + @Override public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(); - descriptors.addAll(super.getSupportedPropertyDescriptors()); - descriptors.add(BUCKET); - descriptors.add(KEY); - descriptors.add(GENERATION); - return Collections.unmodifiableList(descriptors); + return DESCRIPTORS; } @Override diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/FetchGCSObject.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/FetchGCSObject.java index ee9a6d6b5a..12376abf7a 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/FetchGCSObject.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/FetchGCSObject.java @@ -170,7 +170,7 @@ public class FetchGCSObject extends AbstractGCSProcessor { public static final PropertyDescriptor KEY = new PropertyDescriptor .Builder().name("gcs-key") - .displayName("Name") + .displayName("Key") .description(KEY_DESC) .required(true) .defaultValue("${" + CoreAttributes.FILENAME.key() + "}") @@ -217,17 +217,23 @@ public class FetchGCSObject extends AbstractGCSProcessor { .required(false) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + BUCKET, + KEY, + GENERATION, + ENCRYPTION_KEY, + RANGE_START, + RANGE_LENGTH, + RETRY_COUNT, + STORAGE_API_URL, + PROXY_CONFIGURATION_SERVICE + ); + @Override public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(); - descriptors.add(BUCKET); - descriptors.add(KEY); - descriptors.addAll(super.getSupportedPropertyDescriptors()); - descriptors.add(GENERATION); - descriptors.add(ENCRYPTION_KEY); - descriptors.add(RANGE_START); - descriptors.add(RANGE_LENGTH); - return Collections.unmodifiableList(descriptors); + return DESCRIPTORS; } @Override diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/ListGCSBucket.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/ListGCSBucket.java index 25583b87ce..aed69ba1ee 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/ListGCSBucket.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/ListGCSBucket.java @@ -250,27 +250,32 @@ public class ListGCSBucket extends AbstractGCSProcessor { .identifiesControllerService(RecordSetWriterFactory.class) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + BUCKET, + PREFIX, + LISTING_STRATEGY, + TRACKING_STATE_CACHE, + INITIAL_LISTING_TARGET, + TRACKING_TIME_WINDOW, + RECORD_WRITER, + USE_GENERATIONS, + RETRY_COUNT, + STORAGE_API_URL, + PROXY_CONFIGURATION_SERVICE + ); @Override public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(); - descriptors.add(LISTING_STRATEGY); - descriptors.add(TRACKING_STATE_CACHE); - descriptors.add(INITIAL_LISTING_TARGET); - descriptors.add(TRACKING_TIME_WINDOW); - descriptors.add(BUCKET); - descriptors.add(RECORD_WRITER); - descriptors.addAll(super.getSupportedPropertyDescriptors()); - descriptors.add(PREFIX); - descriptors.add(USE_GENERATIONS); - return Collections.unmodifiableList(descriptors); + return DESCRIPTORS; } - private static final Set relationships = Collections.singleton(REL_SUCCESS); + private static final Set RELATIONSHIPS = Set.of(REL_SUCCESS); @Override public Set getRelationships() { - return relationships; + return RELATIONSHIPS; } // State tracking diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java index 438fac19b8..6063896504 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/PutGCSObject.java @@ -289,21 +289,28 @@ public class PutGCSObject extends AbstractGCSProcessor { .allowableValues(CD_INLINE, CD_ATTACHMENT) .build(); + private static final List DESCRIPTORS = List.of( + GCP_CREDENTIALS_PROVIDER_SERVICE, + PROJECT_ID, + BUCKET, + KEY, + RESOURCE_TRANSFER_SOURCE, + FILE_RESOURCE_SERVICE, + CONTENT_TYPE, + CRC32C, + ACL, + ENCRYPTION_KEY, + OVERWRITE, + CONTENT_DISPOSITION_TYPE, + GZIPCONTENT, + STORAGE_API_URL, + RETRY_COUNT, + PROXY_CONFIGURATION_SERVICE + ); + @Override public List getSupportedPropertyDescriptors() { - final List descriptors = new ArrayList<>(super.getSupportedPropertyDescriptors()); - descriptors.add(BUCKET); - descriptors.add(KEY); - descriptors.add(RESOURCE_TRANSFER_SOURCE); - descriptors.add(FILE_RESOURCE_SERVICE); - descriptors.add(CONTENT_TYPE); - descriptors.add(CRC32C); - descriptors.add(ACL); - descriptors.add(ENCRYPTION_KEY); - descriptors.add(OVERWRITE); - descriptors.add(CONTENT_DISPOSITION_TYPE); - descriptors.add(GZIPCONTENT); - return Collections.unmodifiableList(descriptors); + return DESCRIPTORS; } @Override