diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java index d7199d5467..3c15969611 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ComponentManifest.java @@ -30,6 +30,8 @@ public class ComponentManifest implements Serializable { private List controllerServices; private List processors; private List reportingTasks; + private List parameterProviders; + private List flowAnalysisRules; @Schema(description = "Public interfaces defined in this bundle") public List getApis() { @@ -67,4 +69,22 @@ public class ComponentManifest implements Serializable { this.reportingTasks = reportingTasks; } + @Schema(description = "Parameter Providers provided in this bundle") + public List getParameterProviders() { + return (parameterProviders != null ? Collections.unmodifiableList(parameterProviders) : null); + } + + public void setParameterProviders(List parameterProviders) { + this.parameterProviders = parameterProviders; + } + + @Schema(description = "Flow Analysis Rules provided in this bundle") + public List getFlowAnalysisRules() { + return (flowAnalysisRules != null ? Collections.unmodifiableList(flowAnalysisRules) : null); + } + + public void setFlowAnalysisRules(List flowAnalysisRules) { + this.flowAnalysisRules = flowAnalysisRules; + } + } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/FlowAnalysisRuleDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/FlowAnalysisRuleDefinition.java new file mode 100644 index 0000000000..efc2889d15 --- /dev/null +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/FlowAnalysisRuleDefinition.java @@ -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; + +} diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ParameterProviderDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ParameterProviderDefinition.java new file mode 100644 index 0000000000..8a05a1fd2b --- /dev/null +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ParameterProviderDefinition.java @@ -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; + +} diff --git a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionType.java b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionType.java index 14b1d8cd97..20654c53cd 100644 --- a/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionType.java +++ b/nifi-manifest/nifi-extension-manifest-model/src/main/java/org/apache/nifi/extension/manifest/ExtensionType.java @@ -25,6 +25,10 @@ public enum ExtensionType { CONTROLLER_SERVICE, - REPORTING_TASK; + REPORTING_TASK, + + FLOW_ANALYSIS_RULE, + + PARAMETER_PROVIDER; } diff --git a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/ComponentManifestBuilder.java b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/ComponentManifestBuilder.java index b649f69ccd..204f6c4f96 100644 --- a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/ComponentManifestBuilder.java +++ b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/ComponentManifestBuilder.java @@ -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 */ diff --git a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardComponentManifestBuilder.java b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardComponentManifestBuilder.java index 8b76e72f32..8edb662757 100644 --- a/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardComponentManifestBuilder.java +++ b/nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardComponentManifestBuilder.java @@ -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 processors = new ArrayList<>(); private final List controllerServices = new ArrayList<>(); private final List reportingTasks = new ArrayList<>(); + private final List parameterProviders = new ArrayList<>(); + private final List 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(processors)); + componentManifest.setControllerServices(new ArrayList(controllerServices)); + componentManifest.setReportingTasks(new ArrayList(reportingTasks)); + componentManifest.setParameterProviders(new ArrayList(parameterProviders)); + componentManifest.setFlowAnalysisRules(new ArrayList(flowAnalysisRules)); return componentManifest; } 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 9472c95ef7..753221a13c 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 @@ -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(); diff --git a/pom.xml b/pom.xml index 637ed2975a..df53c6879a 100644 --- a/pom.xml +++ b/pom.xml @@ -104,7 +104,7 @@ 21 v22.1.0 1.15.0 - 1.5.1 + 2.0.0 1706227889 UTF-8 UTF-8