diff --git a/src/main/java/org/apache/nifi/parameter/ParameterProvider.java b/src/main/java/org/apache/nifi/parameter/ParameterProvider.java index 7179bfb..f97d529 100644 --- a/src/main/java/org/apache/nifi/parameter/ParameterProvider.java +++ b/src/main/java/org/apache/nifi/parameter/ParameterProvider.java @@ -19,6 +19,7 @@ import org.apache.nifi.annotation.lifecycle.OnConfigurationRestored; import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.migration.PropertyConfiguration; import org.apache.nifi.reporting.InitializationException; import java.io.IOException; @@ -84,4 +85,21 @@ public interface ParameterProvider extends ConfigurableComponent { * @throws IOException if there is an I/O problem while fetching the Parameters */ List fetchParameters(ConfigurationContext context) throws IOException; + + /** + *

+ * Allows for the migration of an old property configuration to a new configuration. This allows the Parameter Provider to evolve over time, + * as it allows properties to be renamed, removed, or reconfigured. + *

+ * + *

+ * This method is called only when a Parameter Provider is restored from a previous configuration. For example, when NiFi is restarted and the + * flow is restored from disk, or when a node joins a cluster and inherits a flow that has a new Parameter Provider. Once called, the method + * will not be invoked again for this Parameter Provider until NiFi is restarted. + *

+ * + * @param config the current property configuration + */ + default void migrateProperties(PropertyConfiguration config) { + } } diff --git a/src/main/java/org/apache/nifi/registry/flow/FlowRegistryClient.java b/src/main/java/org/apache/nifi/registry/flow/FlowRegistryClient.java index 76845c6..2f7d467 100644 --- a/src/main/java/org/apache/nifi/registry/flow/FlowRegistryClient.java +++ b/src/main/java/org/apache/nifi/registry/flow/FlowRegistryClient.java @@ -17,6 +17,7 @@ package org.apache.nifi.registry.flow; import org.apache.nifi.components.ConfigurableComponent; +import org.apache.nifi.migration.PropertyConfiguration; import java.io.IOException; import java.util.Optional; @@ -284,4 +285,21 @@ default String generateFlowId(final String flowName) { return UUID.randomUUID().toString(); } + /** + *

+ * Allows for the migration of an old property configuration to a new configuration. This allows the Flow Registry Client to evolve over time, + * as it allows properties to be renamed, removed, or reconfigured. + *

+ * + *

+ * This method is called only when a Flow Registry Client is restored from a previous configuration. For example, when NiFi is restarted and the + * flow is restored from disk, or when a node joins a cluster and inherits a flow that has a new Flow Registry Client. Once called, the method + * will not be invoked again for this Flow Registry Client until NiFi is restarted. + *

+ * + * @param config the current property configuration + */ + default void migrateProperties(PropertyConfiguration config) { + } + }