NIFI-13267 - Bump NiFi NAR Maven plugin version (#8860)

* NIFI-13267 - Bump NiFi NAR Maven plugin version
* Review - adding Parameter Providers and Flow Analaysis Rules in c2-protocol-component-api ComponentManifest
* Review - fix build() of ComponentManifest
This commit is contained in:
Pierre Villard 2024-05-31 16:19:50 +02:00 committed by GitHub
parent 6c8cc2dd3a
commit 9606102c49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 139 additions and 5 deletions

View File

@ -30,6 +30,8 @@ public class ComponentManifest implements Serializable {
private List<ControllerServiceDefinition> controllerServices;
private List<ProcessorDefinition> processors;
private List<ReportingTaskDefinition> reportingTasks;
private List<ParameterProviderDefinition> parameterProviders;
private List<FlowAnalysisRuleDefinition> flowAnalysisRules;
@Schema(description = "Public interfaces defined in this bundle")
public List<DefinedType> getApis() {
@ -67,4 +69,22 @@ public class ComponentManifest implements Serializable {
this.reportingTasks = reportingTasks;
}
@Schema(description = "Parameter Providers provided in this bundle")
public List<ParameterProviderDefinition> getParameterProviders() {
return (parameterProviders != null ? Collections.unmodifiableList(parameterProviders) : null);
}
public void setParameterProviders(List<ParameterProviderDefinition> parameterProviders) {
this.parameterProviders = parameterProviders;
}
@Schema(description = "Flow Analysis Rules provided in this bundle")
public List<FlowAnalysisRuleDefinition> getFlowAnalysisRules() {
return (flowAnalysisRules != null ? Collections.unmodifiableList(flowAnalysisRules) : null);
}
public void setFlowAnalysisRules(List<FlowAnalysisRuleDefinition> flowAnalysisRules) {
this.flowAnalysisRules = flowAnalysisRules;
}
}

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.c2.protocol.component.api;
public class FlowAnalysisRuleDefinition extends ConfigurableExtensionDefinition {
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.c2.protocol.component.api;
public class ParameterProviderDefinition extends ConfigurableExtensionDefinition {
private static final long serialVersionUID = 1L;
}

View File

@ -25,6 +25,10 @@ public enum ExtensionType {
CONTROLLER_SERVICE,
REPORTING_TASK;
REPORTING_TASK,
FLOW_ANALYSIS_RULE,
PARAMETER_PROVIDER;
}

View File

@ -18,6 +18,8 @@ package org.apache.nifi.runtime.manifest;
import org.apache.nifi.c2.protocol.component.api.ComponentManifest;
import org.apache.nifi.c2.protocol.component.api.ControllerServiceDefinition;
import org.apache.nifi.c2.protocol.component.api.FlowAnalysisRuleDefinition;
import org.apache.nifi.c2.protocol.component.api.ParameterProviderDefinition;
import org.apache.nifi.c2.protocol.component.api.ProcessorDefinition;
import org.apache.nifi.c2.protocol.component.api.ReportingTaskDefinition;
@ -44,6 +46,18 @@ public interface ComponentManifestBuilder {
*/
ComponentManifestBuilder addReportingTask(ReportingTaskDefinition reportingTaskDefinition);
/**
* @param parameterProviderDefinition a parameter provider definition to add
* @return the builder
*/
ComponentManifestBuilder addParameterProvider(ParameterProviderDefinition parameterProviderDefinition);
/**
* @param flowAnalysisRuleDefinition a flow analysis rule definition to add
* @return the builder
*/
ComponentManifestBuilder addFlowAnalysisRule(FlowAnalysisRuleDefinition flowAnalysisRuleDefinition);
/**
* @return a component manifest containing all the added definitions
*/

View File

@ -18,6 +18,8 @@ package org.apache.nifi.runtime.manifest.impl;
import org.apache.nifi.c2.protocol.component.api.ComponentManifest;
import org.apache.nifi.c2.protocol.component.api.ControllerServiceDefinition;
import org.apache.nifi.c2.protocol.component.api.FlowAnalysisRuleDefinition;
import org.apache.nifi.c2.protocol.component.api.ParameterProviderDefinition;
import org.apache.nifi.c2.protocol.component.api.ProcessorDefinition;
import org.apache.nifi.c2.protocol.component.api.ReportingTaskDefinition;
import org.apache.nifi.runtime.manifest.ComponentManifestBuilder;
@ -33,6 +35,8 @@ public class StandardComponentManifestBuilder implements ComponentManifestBuilde
private final List<ProcessorDefinition> processors = new ArrayList<>();
private final List<ControllerServiceDefinition> controllerServices = new ArrayList<>();
private final List<ReportingTaskDefinition> reportingTasks = new ArrayList<>();
private final List<ParameterProviderDefinition> parameterProviders = new ArrayList<>();
private final List<FlowAnalysisRuleDefinition> flowAnalysisRules = new ArrayList<>();
@Override
public ComponentManifestBuilder addProcessor(final ProcessorDefinition processorDefinition) {
@ -61,12 +65,32 @@ public class StandardComponentManifestBuilder implements ComponentManifestBuilde
return this;
}
@Override
public ComponentManifestBuilder addParameterProvider(ParameterProviderDefinition parameterProviderDefinition) {
if (parameterProviderDefinition == null) {
throw new IllegalArgumentException("Parameter Provider definition cannot be null");
}
parameterProviders.add(parameterProviderDefinition);
return this;
}
@Override
public ComponentManifestBuilder addFlowAnalysisRule(FlowAnalysisRuleDefinition flowAnalysisRuleDefinition) {
if (flowAnalysisRuleDefinition == null) {
throw new IllegalArgumentException("Flow Analysis Rule definition cannot be null");
}
flowAnalysisRules.add(flowAnalysisRuleDefinition);
return this;
}
@Override
public ComponentManifest build() {
final ComponentManifest componentManifest = new ComponentManifest();
componentManifest.setProcessors(new ArrayList<>(processors));
componentManifest.setControllerServices(new ArrayList<>(controllerServices));
componentManifest.setReportingTasks(new ArrayList<>(reportingTasks));
componentManifest.setProcessors(new ArrayList<ProcessorDefinition>(processors));
componentManifest.setControllerServices(new ArrayList<ControllerServiceDefinition>(controllerServices));
componentManifest.setReportingTasks(new ArrayList<ReportingTaskDefinition>(reportingTasks));
componentManifest.setParameterProviders(new ArrayList<ParameterProviderDefinition>(parameterProviders));
componentManifest.setFlowAnalysisRules(new ArrayList<FlowAnalysisRuleDefinition>(flowAnalysisRules));
return componentManifest;
}

View File

@ -23,7 +23,9 @@ import org.apache.nifi.c2.protocol.component.api.ConfigurableComponentDefinition
import org.apache.nifi.c2.protocol.component.api.ControllerServiceDefinition;
import org.apache.nifi.c2.protocol.component.api.DefinedType;
import org.apache.nifi.c2.protocol.component.api.ExtensionComponent;
import org.apache.nifi.c2.protocol.component.api.FlowAnalysisRuleDefinition;
import org.apache.nifi.c2.protocol.component.api.MultiProcessorUseCase;
import org.apache.nifi.c2.protocol.component.api.ParameterProviderDefinition;
import org.apache.nifi.c2.protocol.component.api.ProcessorConfiguration;
import org.apache.nifi.c2.protocol.component.api.ProcessorDefinition;
import org.apache.nifi.c2.protocol.component.api.PropertyAllowableValue;
@ -201,6 +203,12 @@ public class StandardRuntimeManifestBuilder implements RuntimeManifestBuilder {
case REPORTING_TASK:
addReportingTaskDefinition(extensionManifest, extension, additionalDetails, componentManifestBuilder);
break;
case FLOW_ANALYSIS_RULE:
addFlowAnalysisRuleDefinition(extensionManifest, extension, additionalDetails, componentManifestBuilder);
break;
case PARAMETER_PROVIDER:
addParameterProviderDefinition(extensionManifest, extension, additionalDetails, componentManifestBuilder);
break;
default:
throw new IllegalArgumentException("Unknown extension type: " + extension.getType());
}
@ -369,6 +377,24 @@ public class StandardRuntimeManifestBuilder implements RuntimeManifestBuilder {
componentManifestBuilder.addControllerService(controllerServiceDefinition);
}
private void addParameterProviderDefinition(final ExtensionManifest extensionManifest, final Extension extension, final String additionalDetails,
final ComponentManifestBuilder componentManifestBuilder) {
final ParameterProviderDefinition parameterProviderDefinition = new ParameterProviderDefinition();
populateDefinedType(extensionManifest, extension, parameterProviderDefinition);
populateExtensionComponent(extensionManifest, extension, additionalDetails, parameterProviderDefinition);
populateConfigurableComponent(extension, parameterProviderDefinition);
componentManifestBuilder.addParameterProvider(parameterProviderDefinition);
}
private void addFlowAnalysisRuleDefinition(final ExtensionManifest extensionManifest, final Extension extension, final String additionalDetails,
final ComponentManifestBuilder componentManifestBuilder) {
final FlowAnalysisRuleDefinition flowAnalysisRuleDefinition = new FlowAnalysisRuleDefinition();
populateDefinedType(extensionManifest, extension, flowAnalysisRuleDefinition);
populateExtensionComponent(extensionManifest, extension, additionalDetails, flowAnalysisRuleDefinition);
populateConfigurableComponent(extension, flowAnalysisRuleDefinition);
componentManifestBuilder.addFlowAnalysisRule(flowAnalysisRuleDefinition);
}
private void addReportingTaskDefinition(final ExtensionManifest extensionManifest, final Extension extension, final String additionalDetails,
final ComponentManifestBuilder componentManifestBuilder) {
final ReportingTaskDefinition reportingTaskDefinition = new ReportingTaskDefinition();

View File

@ -104,7 +104,7 @@
<docker.image.tag>21</docker.image.tag>
<node.version>v22.1.0</node.version>
<frontend.mvn.plugin.version>1.15.0</frontend.mvn.plugin.version>
<nifi.nar.maven.plugin.version>1.5.1</nifi.nar.maven.plugin.version>
<nifi.nar.maven.plugin.version>2.0.0</nifi.nar.maven.plugin.version>
<project.build.outputTimestamp>1706227889</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>