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 new file mode 100644 index 0000000000..3324519a39 --- /dev/null +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java @@ -0,0 +1,52 @@ +/* + * 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; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public abstract class ConfigurableExtensionDefinition extends ExtensionComponent implements ConfigurableComponentDefinition { + + private Map propertyDescriptors; + private boolean supportsDynamicProperties; + + @Override + @ApiModelProperty("Descriptions of configuration properties applicable to this component.") + public Map getPropertyDescriptors() { + return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null); + } + + @Override + public void setPropertyDescriptors(LinkedHashMap propertyDescriptors) { + this.propertyDescriptors = propertyDescriptors; + } + + @Override + @ApiModelProperty("Whether or not this component makes use of dynamic (user-set) properties.") + public boolean getSupportsDynamicProperties() { + return supportsDynamicProperties; + } + + @Override + public void setSupportsDynamicProperties(boolean supportsDynamicProperties) { + this.supportsDynamicProperties = supportsDynamicProperties; + } + +} diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java index f7b3952895..89279e04d7 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java @@ -18,39 +18,9 @@ package org.apache.nifi.c2.protocol.component.api; import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; @ApiModel -public class ControllerServiceDefinition extends ExtensionComponent implements ConfigurableComponentDefinition { +public class ControllerServiceDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; - private Map propertyDescriptors; - private boolean supportsDynamicProperties; - - @Override - @ApiModelProperty("Descriptions of configuration properties applicable to this controller service") - public Map getPropertyDescriptors() { - return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null); - } - - @Override - public void setPropertyDescriptors(LinkedHashMap propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - - @Override - @ApiModelProperty("Whether or not this processor makes use of dynamic (user-set) properties") - public boolean getSupportsDynamicProperties() { - return supportsDynamicProperties; - } - - @Override - public void setSupportsDynamicProperties(boolean supportsDynamicProperties) { - this.supportsDynamicProperties = supportsDynamicProperties; - } - } diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java index 0d614953db..b28ae06bb1 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ProcessorDefinition.java @@ -22,18 +22,14 @@ import io.swagger.annotations.ApiModelProperty; import org.apache.nifi.annotation.behavior.InputRequirement; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @ApiModel -public class ProcessorDefinition extends ExtensionComponent implements ConfigurableComponentDefinition { +public class ProcessorDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; - private Map propertyDescriptors; - private boolean supportsDynamicProperties; private InputRequirement.Requirement inputRequirement; - private List supportedRelationships; private boolean supportsDynamicRelationships; @@ -54,28 +50,6 @@ public class ProcessorDefinition extends ExtensionComponent implements Configura private String defaultYieldDuration; private String defaultBulletinLevel; - @Override - @ApiModelProperty("Descriptions of configuration properties applicable to this processor.") - public Map getPropertyDescriptors() { - return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null); - } - - @Override - public void setPropertyDescriptors(LinkedHashMap propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - - @Override - @ApiModelProperty("Whether or not this processor makes use of dynamic (user-set) properties.") - public boolean getSupportsDynamicProperties() { - return supportsDynamicProperties; - } - - @Override - public void setSupportsDynamicProperties(boolean supportsDynamicProperties) { - this.supportsDynamicProperties = supportsDynamicProperties; - } - @ApiModelProperty("Any input requirements this processor has.") public InputRequirement.Requirement getInputRequirement() { return inputRequirement; diff --git a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java index d2317962c0..aa51e36c76 100644 --- a/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java +++ b/c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ReportingTaskDefinition.java @@ -21,41 +21,16 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @ApiModel -public class ReportingTaskDefinition extends ExtensionComponent implements ConfigurableComponentDefinition { +public class ReportingTaskDefinition extends ConfigurableExtensionDefinition { private static final long serialVersionUID = 1L; - private Map propertyDescriptors; private List supportedSchedulingStrategies; private String defaultSchedulingStrategy; private Map defaultSchedulingPeriodBySchedulingStrategy; - private boolean supportsDynamicProperties; - - @Override - @ApiModelProperty("Descriptions of configuration properties applicable to this reporting task") - public Map getPropertyDescriptors() { - return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null); - } - - @Override - public void setPropertyDescriptors(LinkedHashMap propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - - @Override - @ApiModelProperty("Whether or not this reporting task makes use of dynamic (user-set) properties") - public boolean getSupportsDynamicProperties() { - return supportsDynamicProperties; - } - - @Override - public void setSupportsDynamicProperties(boolean supportsDynamicProperties) { - this.supportsDynamicProperties = supportsDynamicProperties; - } @ApiModelProperty("The supported scheduling strategies, such as TIME_DRIVER or CRON.") public List getSupportedSchedulingStrategies() { diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java new file mode 100644 index 0000000000..5e3b5076d8 --- /dev/null +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java @@ -0,0 +1,77 @@ +/* + * 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.flow; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.Map; + +public abstract class VersionedConfigurableExtension extends VersionedComponent + implements VersionedExtensionComponent, VersionedConfigurableComponent { + + private String type; + private Bundle bundle; + + private Map properties; + private Map propertyDescriptors; + + @Override + @ApiModelProperty("The type of the extension component") + public String getType() { + return type; + } + + @Override + public void setType(final String type) { + this.type = type; + } + + @Override + @ApiModelProperty("Information about the bundle from which the component came") + public Bundle getBundle() { + return bundle; + } + + @Override + public void setBundle(Bundle bundle) { + this.bundle = bundle; + } + + + @Override + @ApiModelProperty("The properties for the component. Properties whose value is not set will only contain the property name.") + public Map getProperties() { + return properties; + } + + @Override + public void setProperties(Map properties) { + this.properties = properties; + } + + @Override + @ApiModelProperty("The property descriptors for the component.") + public Map getPropertyDescriptors() { + return propertyDescriptors; + } + + @Override + public void setPropertyDescriptors(Map propertyDescriptors) { + this.propertyDescriptors = propertyDescriptors; + } + +} diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java index bd6d8dced9..ecb3c982f9 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java @@ -20,42 +20,14 @@ package org.apache.nifi.flow; import io.swagger.annotations.ApiModelProperty; import java.util.List; -import java.util.Map; -public class VersionedControllerService extends VersionedComponent - implements VersionedConfigurableComponent, VersionedExtensionComponent { +public class VersionedControllerService extends VersionedConfigurableExtension { - private String type; - private Bundle bundle; private List controllerServiceApis; - private Map properties; - private Map propertyDescriptors; private String annotationData; private ScheduledState scheduledState; - @Override - @ApiModelProperty(value = "The type of the controller service.") - public String getType() { - return type; - } - - @Override - public void setType(String type) { - this.type = type; - } - - @Override - @ApiModelProperty(value = "The details of the artifact that bundled this controller service type.") - public Bundle getBundle() { - return bundle; - } - - @Override - public void setBundle(Bundle bundle) { - this.bundle = bundle; - } - @ApiModelProperty(value = "Lists the APIs this Controller Service implements.") public List getControllerServiceApis() { return controllerServiceApis; @@ -65,28 +37,6 @@ public class VersionedControllerService extends VersionedComponent this.controllerServiceApis = controllerServiceApis; } - @Override - @ApiModelProperty(value = "The properties of the controller service.") - public Map getProperties() { - return properties; - } - - @Override - public void setProperties(Map properties) { - this.properties = properties; - } - - @Override - @ApiModelProperty("The property descriptors for the controller service.") - public Map getPropertyDescriptors() { - return propertyDescriptors; - } - - @Override - public void setPropertyDescriptors(Map propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - @ApiModelProperty(value = "The annotation for the controller service. This is how the custom UI relays configuration to the controller service.") public String getAnnotationData() { return annotationData; diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java index 67d5b1ab77..3b0eb260f5 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedProcessor.java @@ -22,15 +22,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Map; import java.util.Set; -public class VersionedProcessor extends VersionedComponent - implements VersionedConfigurableComponent, VersionedExtensionComponent { +public class VersionedProcessor extends VersionedConfigurableExtension { - private Bundle bundle; private Map style; - - private String type; - private Map properties; - private Map propertyDescriptors; private String annotationData; private String schedulingPeriod; @@ -67,17 +61,6 @@ public class VersionedProcessor extends VersionedComponent this.schedulingStrategy = schedulingStrategy; } - @Override - @ApiModelProperty("The type of Processor") - public String getType() { - return type; - } - - @Override - public void setType(final String type) { - this.type = type; - } - @ApiModelProperty("Indicates the node where the process will execute.") public String getExecutionNode() { return executionNode; @@ -123,28 +106,6 @@ public class VersionedProcessor extends VersionedComponent this.concurrentlySchedulableTaskCount = concurrentlySchedulableTaskCount; } - @Override - @ApiModelProperty("The properties for the processor. Properties whose value is not set will only contain the property name.") - public Map getProperties() { - return properties; - } - - @Override - public void setProperties(Map properties) { - this.properties = properties; - } - - @Override - @ApiModelProperty("The property descriptors for the processor.") - public Map getPropertyDescriptors() { - return propertyDescriptors; - } - - @Override - public void setPropertyDescriptors(Map propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - @ApiModelProperty("The annotation data for the processor used to relay configuration between a custom UI and the procesosr.") public String getAnnotationData() { return annotationData; @@ -175,17 +136,6 @@ public class VersionedProcessor extends VersionedComponent this.runDurationMillis = runDurationMillis; } - @Override - @ApiModelProperty("Information about the bundle from which the component came") - public Bundle getBundle() { - return bundle; - } - - @Override - public void setBundle(Bundle bundle) { - this.bundle = bundle; - } - @ApiModelProperty("Stylistic data for rendering in a UI") public Map getStyle() { return style; diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java index 38ca29485b..4450cedf3f 100644 --- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java +++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedReportingTask.java @@ -19,63 +19,13 @@ package org.apache.nifi.flow; import io.swagger.annotations.ApiModelProperty; -import java.util.Map; +public class VersionedReportingTask extends VersionedConfigurableExtension { -public class VersionedReportingTask extends VersionedComponent implements VersionedConfigurableComponent, VersionedExtensionComponent { - private String type; - private Bundle bundle; - private Map properties; - private Map propertyDescriptors; private String annotationData; private ScheduledState scheduledState; private String schedulingPeriod; private String schedulingStrategy; - - @Override - @ApiModelProperty(value = "The type of the reporting task.") - public String getType() { - return type; - } - - @Override - public void setType(final String type) { - this.type = type; - } - - @Override - @ApiModelProperty(value = "The details of the artifact that bundled this reporting task type.") - public Bundle getBundle() { - return bundle; - } - - @Override - public void setBundle(Bundle bundle) { - this.bundle = bundle; - } - - @Override - @ApiModelProperty(value = "The properties of the reporting task.") - public Map getProperties() { - return properties; - } - - @Override - public void setProperties(Map properties) { - this.properties = properties; - } - - @Override - @ApiModelProperty("The property descriptors for the reporting task.") - public Map getPropertyDescriptors() { - return propertyDescriptors; - } - - @Override - public void setPropertyDescriptors(Map propertyDescriptors) { - this.propertyDescriptors = propertyDescriptors; - } - @ApiModelProperty(value = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.") public String getAnnotationData() { return annotationData;