From b6d4099a1499caa6d1cc577a0ea88d97789276e2 Mon Sep 17 00:00:00 2001 From: greyp9 Date: Thu, 15 Jun 2023 11:27:51 -0400 Subject: [PATCH] =?UTF-8?q?NIFI-11690=20-=20include=20extension=20info=20f?= =?UTF-8?q?or=20SupportsSensitiveDynamicPrope=E2=80=A6=20(#7379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NIFI-11690 - include extension info for SupportsSensitiveDynamicProperties in C2 manifest * NIFI-11690 - include extension info for SupportsSensitiveDynamicProperties in C2 manifest * NIFI-11690 - include extension info for SupportsSensitiveDynamicProperties in C2 manifest --- .../api/ConfigurableComponentDefinition.java | 4 ++++ .../api/ConfigurableExtensionDefinition.java | 13 +++++++++++++ .../apache/nifi/extension/manifest/Extension.java | 10 ++++++++++ .../impl/StandardRuntimeManifestBuilder.java | 1 + .../nifi/runtime/manifest/TestRuntimeManifest.java | 3 +++ 5 files changed, 31 insertions(+) diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableComponentDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableComponentDefinition.java index b6d41a33b8..cd7347eff8 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableComponentDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableComponentDefinition.java @@ -34,6 +34,10 @@ public interface ConfigurableComponentDefinition { void setSupportsDynamicProperties(boolean supportsDynamicProperties); + boolean getSupportsSensitiveDynamicProperties(); + + void setSupportsSensitiveDynamicProperties(boolean supportsSensitiveDynamicProperties); + List getDynamicProperties(); void setDynamicProperties(List dynamicProperties); diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java index 3ef484a0b1..99216c7cf9 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java @@ -28,6 +28,8 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent private Map propertyDescriptors; private boolean supportsDynamicProperties; + private boolean supportsSensitiveDynamicProperties; + private List dynamicProperties; @Override @@ -52,6 +54,17 @@ public abstract class ConfigurableExtensionDefinition extends ExtensionComponent this.supportsDynamicProperties = supportsDynamicProperties; } + @Override + @ApiModelProperty("Whether or not this component makes use of sensitive dynamic (user-set) properties.") + public boolean getSupportsSensitiveDynamicProperties() { + return supportsSensitiveDynamicProperties; + } + + @Override + public void setSupportsSensitiveDynamicProperties(boolean supportsSensitiveDynamicProperties) { + this.supportsSensitiveDynamicProperties = supportsSensitiveDynamicProperties; + } + @Override @ApiModelProperty("Describes the dynamic properties supported by this component") public List getDynamicProperties() { diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java index b238debb45..2346e31e9f 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/Extension.java @@ -51,6 +51,8 @@ public class Extension { @XmlElement(name = "property") private List properties; + private boolean supportsSensitiveDynamicProperties; + @XmlElementWrapper @XmlElement(name = "dynamicProperty") private List dynamicProperties; @@ -154,6 +156,14 @@ public class Extension { this.properties = properties; } + public boolean getSupportsSensitiveDynamicProperties() { + return supportsSensitiveDynamicProperties; + } + + public void setSupportsSensitiveDynamicProperties(boolean supportsSensitiveDynamicProperties) { + this.supportsSensitiveDynamicProperties = supportsSensitiveDynamicProperties; + } + @ApiModelProperty(value = "The dynamic properties of the extension") public List getDynamicProperties() { return dynamicProperties; diff --git a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardRuntimeManifestBuilder.java b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardRuntimeManifestBuilder.java index 9139206833..09593a47b6 100644 --- a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardRuntimeManifestBuilder.java +++ b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardRuntimeManifestBuilder.java @@ -504,6 +504,7 @@ public class StandardRuntimeManifestBuilder implements RuntimeManifestBuilder { final List dynamicProperties = extension.getDynamicProperties(); if (isNotEmpty(dynamicProperties)) { configurableComponentDefinition.setSupportsDynamicProperties(true); + configurableComponentDefinition.setSupportsSensitiveDynamicProperties(extension.getSupportsSensitiveDynamicProperties()); configurableComponentDefinition.setDynamicProperties( dynamicProperties.stream() .map(this::getDynamicProperty) diff --git a/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java b/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java index 633d776637..7dfa1536ab 100644 --- a/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java +++ b/nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java @@ -105,6 +105,7 @@ class TestRuntimeManifest { assertFalse(listHdfsDefinition.getSideEffectFree()); assertFalse(listHdfsDefinition.getTriggerWhenAnyDestinationAvailable()); assertFalse(listHdfsDefinition.getSupportsDynamicProperties()); + assertFalse(listHdfsDefinition.getSupportsSensitiveDynamicProperties()); assertNull(listHdfsDefinition.getDynamicProperties()); assertFalse(listHdfsDefinition.getSupportsDynamicRelationships()); assertNull(listHdfsDefinition.getDynamicRelationship()); @@ -251,6 +252,7 @@ class TestRuntimeManifest { assertFalse(executeSqlDef.getReadsAttributes().isEmpty()); assertNotNull(executeSqlDef.getReadsAttributes().get(0).getName()); assertNotNull(executeSqlDef.getReadsAttributes().get(0).getDescription()); + assertTrue(executeSqlDef.getSupportsSensitiveDynamicProperties()); // Verify RouteOnAttribute dynamic relationships and dynamic properties final ProcessorDefinition routeOnAttributeDef = getProcessorDefinition(bundles, "nifi-standard-nar", @@ -262,6 +264,7 @@ class TestRuntimeManifest { assertNotNull(routeOnAttributeDef.getDynamicRelationship().getDescription()); assertTrue(routeOnAttributeDef.getSupportsDynamicProperties()); + assertFalse(routeOnAttributeDef.getSupportsSensitiveDynamicProperties()); assertNotNull(routeOnAttributeDef.getDynamicProperties()); assertFalse(routeOnAttributeDef.getDynamicProperties().isEmpty()); assertNotNull(routeOnAttributeDef.getDynamicProperties().get(0).getName());