From 3451cc8c4a7f3e900b36842fadfe3a49c53f3bd3 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Wed, 24 Jun 2026 16:40:21 -0400 Subject: [PATCH 1/2] NIFI-16038: Added setValueReference/setValueReferences methods to ConnectorMigrationContext --- .../migration/ConnectorMigrationContext.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java b/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java index 1594d27..7fa3e9a 100644 --- a/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java +++ b/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java @@ -20,6 +20,7 @@ import org.apache.nifi.components.connector.AssetReference; import org.apache.nifi.components.connector.ConfigurationStep; import org.apache.nifi.components.connector.ConnectorInitializationContext; +import org.apache.nifi.components.connector.ConnectorValueReference; import org.apache.nifi.components.connector.components.FlowContext; import org.apache.nifi.flow.VersionedComponentState; import org.apache.nifi.flow.VersionedExternalFlow; @@ -110,6 +111,31 @@ public interface ConnectorMigrationContext { */ void replaceProperties(String stepName, Map propertyValues); + /** + * Records a single property value reference to merge into the named {@link ConfigurationStep}. This allows a + * property to be set directly to a {@link ConnectorValueReference}, such as an {@link AssetReference} returned by + * {@link #copyAssetFromSource(String)}, rather than a plain string value. A {@code null} value reference removes + * the property. + * + * @param stepName configuration step name + * @param propertyName the name of the property to set + * @param valueReference the value reference to record, or {@code null} to remove the property + * @throws IllegalStateException when called outside {@code migrateConfiguration(...)} + */ + void setValueReference(String stepName, String propertyName, ConnectorValueReference valueReference); + + /** + * Records property value references to merge into the named {@link ConfigurationStep}. This allows properties to be + * set directly to {@link ConnectorValueReference}s, such as {@link AssetReference}s returned by + * {@link #copyAssetFromSource(String)}, rather than plain string values. A {@code null} value for a property + * removes that property. + * + * @param stepName configuration step name + * @param valueReferences the value references to record, keyed by property name + * @throws IllegalStateException when called outside {@code migrateConfiguration(...)} + */ + void setValueReferences(String stepName, Map valueReferences); + /** * Records the {@link VersionedComponentState} for a managed component. * Repeated calls for the same component replace prior recorded state; an empty state clears previously recorded state. From 972c689ce6a3d4987e1d4e1e3692758baed64162 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Wed, 24 Jun 2026 16:48:29 -0400 Subject: [PATCH 2/2] NIFI-16038: Added default impl for setValueReference/setValueReferences that throw UnsupportedOperationException --- .../connector/migration/ConnectorMigrationContext.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java b/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java index 7fa3e9a..6304790 100644 --- a/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java +++ b/src/main/java/org/apache/nifi/components/connector/migration/ConnectorMigrationContext.java @@ -122,7 +122,9 @@ public interface ConnectorMigrationContext { * @param valueReference the value reference to record, or {@code null} to remove the property * @throws IllegalStateException when called outside {@code migrateConfiguration(...)} */ - void setValueReference(String stepName, String propertyName, ConnectorValueReference valueReference); + default void setValueReference(final String stepName, final String propertyName, final ConnectorValueReference valueReference) { + throw new UnsupportedOperationException(); + } /** * Records property value references to merge into the named {@link ConfigurationStep}. This allows properties to be @@ -134,7 +136,9 @@ public interface ConnectorMigrationContext { * @param valueReferences the value references to record, keyed by property name * @throws IllegalStateException when called outside {@code migrateConfiguration(...)} */ - void setValueReferences(String stepName, Map valueReferences); + default void setValueReferences(final String stepName, final Map valueReferences) { + throw new UnsupportedOperationException(); + } /** * Records the {@link VersionedComponentState} for a managed component.