You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2022/03/18 12:43:27 UTC
[nifi] branch main updated: NIFI-9806 Introduce ConfigurableExtensionDefinition and VersionedConfigurableExtension (#5875)
This is an automated email from the ASF dual-hosted git repository.
bbende pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 193bcbe NIFI-9806 Introduce ConfigurableExtensionDefinition and VersionedConfigurableExtension (#5875)
193bcbe is described below
commit 193bcbe33a320699eb2c6c62a16072830422cab7
Author: Bryan Bende <bb...@gmail.com>
AuthorDate: Fri Mar 18 08:43:17 2022 -0400
NIFI-9806 Introduce ConfigurableExtensionDefinition and VersionedConfigurableExtension (#5875)
---
...n.java => ConfigurableExtensionDefinition.java} | 10 ++---
.../component/api/ControllerServiceDefinition.java | 32 +------------
.../component/api/ProcessorDefinition.java | 28 +-----------
.../component/api/ReportingTaskDefinition.java | 27 +----------
...ce.java => VersionedConfigurableExtension.java} | 49 +++-----------------
.../nifi/flow/VersionedControllerService.java | 52 +---------------------
.../org/apache/nifi/flow/VersionedProcessor.java | 52 +---------------------
.../apache/nifi/flow/VersionedReportingTask.java | 52 +---------------------
8 files changed, 16 insertions(+), 286 deletions(-)
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/ConfigurableExtensionDefinition.java
similarity index 83%
copy from c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ControllerServiceDefinition.java
copy to c2/c2-protocol/c2-protocol-component-api/src/main/java/org/apache/nifi/c2/protocol/component/api/ConfigurableExtensionDefinition.java
index f7b3952..3324519 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/ConfigurableExtensionDefinition.java
@@ -14,25 +14,21 @@
* 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.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 {
- private static final long serialVersionUID = 1L;
+public abstract class ConfigurableExtensionDefinition extends ExtensionComponent implements ConfigurableComponentDefinition {
private Map<String, PropertyDescriptor> propertyDescriptors;
private boolean supportsDynamicProperties;
@Override
- @ApiModelProperty("Descriptions of configuration properties applicable to this controller service")
+ @ApiModelProperty("Descriptions of configuration properties applicable to this component.")
public Map<String, PropertyDescriptor> getPropertyDescriptors() {
return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null);
}
@@ -43,7 +39,7 @@ public class ControllerServiceDefinition extends ExtensionComponent implements C
}
@Override
- @ApiModelProperty("Whether or not this processor makes use of dynamic (user-set) properties")
+ @ApiModelProperty("Whether or not this component makes use of dynamic (user-set) properties.")
public boolean getSupportsDynamicProperties() {
return 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 f7b3952..89279e0 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<String, PropertyDescriptor> propertyDescriptors;
- private boolean supportsDynamicProperties;
-
- @Override
- @ApiModelProperty("Descriptions of configuration properties applicable to this controller service")
- public Map<String, PropertyDescriptor> getPropertyDescriptors() {
- return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null);
- }
-
- @Override
- public void setPropertyDescriptors(LinkedHashMap<String, PropertyDescriptor> 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 0d61495..b28ae06 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<String, PropertyDescriptor> propertyDescriptors;
- private boolean supportsDynamicProperties;
private InputRequirement.Requirement inputRequirement;
-
private List<Relationship> 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<String, PropertyDescriptor> getPropertyDescriptors() {
- return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null);
- }
-
- @Override
- public void setPropertyDescriptors(LinkedHashMap<String, PropertyDescriptor> 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 d231796..aa51e36 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<String, PropertyDescriptor> propertyDescriptors;
private List<String> supportedSchedulingStrategies;
private String defaultSchedulingStrategy;
private Map<String, String> defaultSchedulingPeriodBySchedulingStrategy;
- private boolean supportsDynamicProperties;
-
- @Override
- @ApiModelProperty("Descriptions of configuration properties applicable to this reporting task")
- public Map<String, PropertyDescriptor> getPropertyDescriptors() {
- return (propertyDescriptors != null ? Collections.unmodifiableMap(propertyDescriptors) : null);
- }
-
- @Override
- public void setPropertyDescriptors(LinkedHashMap<String, PropertyDescriptor> 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<String> getSupportedSchedulingStrategies() {
diff --git a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java
similarity index 51%
copy from nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java
copy to nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java
index bd6d8dc..5e3b507 100644
--- a/nifi-api/src/main/java/org/apache/nifi/flow/VersionedControllerService.java
+++ b/nifi-api/src/main/java/org/apache/nifi/flow/VersionedConfigurableExtension.java
@@ -14,39 +14,34 @@
* 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.List;
import java.util.Map;
-public class VersionedControllerService extends VersionedComponent
- implements VersionedConfigurableComponent, VersionedExtensionComponent {
+public abstract class VersionedConfigurableExtension extends VersionedComponent
+ implements VersionedExtensionComponent, VersionedConfigurableComponent {
private String type;
private Bundle bundle;
- private List<ControllerServiceAPI> controllerServiceApis;
private Map<String, String> properties;
private Map<String, VersionedPropertyDescriptor> propertyDescriptors;
- private String annotationData;
- private ScheduledState scheduledState;
@Override
- @ApiModelProperty(value = "The type of the controller service.")
+ @ApiModelProperty("The type of the extension component")
public String getType() {
return type;
}
@Override
- public void setType(String type) {
+ public void setType(final String type) {
this.type = type;
}
@Override
- @ApiModelProperty(value = "The details of the artifact that bundled this controller service type.")
+ @ApiModelProperty("Information about the bundle from which the component came")
public Bundle getBundle() {
return bundle;
}
@@ -56,17 +51,9 @@ public class VersionedControllerService extends VersionedComponent
this.bundle = bundle;
}
- @ApiModelProperty(value = "Lists the APIs this Controller Service implements.")
- public List<ControllerServiceAPI> getControllerServiceApis() {
- return controllerServiceApis;
- }
-
- public void setControllerServiceApis(List<ControllerServiceAPI> controllerServiceApis) {
- this.controllerServiceApis = controllerServiceApis;
- }
@Override
- @ApiModelProperty(value = "The properties of the controller service.")
+ @ApiModelProperty("The properties for the component. Properties whose value is not set will only contain the property name.")
public Map<String, String> getProperties() {
return properties;
}
@@ -77,7 +64,7 @@ public class VersionedControllerService extends VersionedComponent
}
@Override
- @ApiModelProperty("The property descriptors for the controller service.")
+ @ApiModelProperty("The property descriptors for the component.")
public Map<String, VersionedPropertyDescriptor> getPropertyDescriptors() {
return propertyDescriptors;
}
@@ -87,26 +74,4 @@ public class VersionedControllerService extends VersionedComponent
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;
- }
-
- public void setAnnotationData(String annotationData) {
- this.annotationData = annotationData;
- }
-
- @Override
- public ComponentType getComponentType() {
- return ComponentType.CONTROLLER_SERVICE;
- }
-
- @ApiModelProperty("The ScheduledState denoting whether the Controller Service is ENABLED or DISABLED")
- public ScheduledState getScheduledState() {
- return scheduledState;
- }
-
- public void setScheduledState(final ScheduledState scheduledState) {
- this.scheduledState = scheduledState;
- }
}
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 bd6d8dc..ecb3c98 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<ControllerServiceAPI> controllerServiceApis;
- private Map<String, String> properties;
- private Map<String, VersionedPropertyDescriptor> 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<ControllerServiceAPI> 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<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- @Override
- @ApiModelProperty("The property descriptors for the controller service.")
- public Map<String, VersionedPropertyDescriptor> getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- @Override
- public void setPropertyDescriptors(Map<String, VersionedPropertyDescriptor> 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 67d5b1a..3b0eb26 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<String, String> style;
-
- private String type;
- private Map<String, String> properties;
- private Map<String, VersionedPropertyDescriptor> 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<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- @Override
- @ApiModelProperty("The property descriptors for the processor.")
- public Map<String, VersionedPropertyDescriptor> getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- @Override
- public void setPropertyDescriptors(Map<String, VersionedPropertyDescriptor> 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<String, String> 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 38ca294..4450ced 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<String, String> properties;
- private Map<String, VersionedPropertyDescriptor> 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<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- @Override
- @ApiModelProperty("The property descriptors for the reporting task.")
- public Map<String, VersionedPropertyDescriptor> getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- @Override
- public void setPropertyDescriptors(Map<String, VersionedPropertyDescriptor> 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;