nghiaxlee commented on a change in pull request #187:
URL: https://github.com/apache/nifi-minifi/pull/187#discussion_r434704877



##########
File path: 
minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/ConfigTransformer.java
##########
@@ -508,34 +500,29 @@ protected static void addFunnel(final Element 
parentElement, FunnelSchema funnel
         addPosition(element);
     }
 
-    protected static void addProvenanceReportingTask(final Element element, 
ConfigSchema configSchema) throws ConfigurationChangeException {
+    protected static void addReportingTask(final Element parentElement, 
ReportingSchema reportingSchema) throws ConfigurationChangeException {
         try {
-            ProvenanceReportingSchema provenanceProperties = 
configSchema.getProvenanceReportingProperties();
-            final Element taskElement = 
element.getOwnerDocument().createElement("reportingTask");
-            addTextElement(taskElement, "id", "Provenance-Reporting");
-            addTextElement(taskElement, "name", 
"Site-To-Site-Provenance-Reporting");
-            addTextElement(taskElement, "comment", 
provenanceProperties.getComment());
-            addTextElement(taskElement, "class", 
DEFAULT_PROV_REPORTING_TASK_CLASS);
-            addTextElement(taskElement, "schedulingPeriod", 
provenanceProperties.getSchedulingPeriod());
-            addTextElement(taskElement, "scheduledState", "RUNNING");
-            addTextElement(taskElement, "schedulingStrategy", 
provenanceProperties.getSchedulingStrategy());
+            final Document doc = parentElement.getOwnerDocument();
+            final Element element = doc.createElement("reportingTask");
+            parentElement.appendChild(element);
 
-            Map<String, Object> attributes = new HashMap<>();
-            attributes.put("Destination URL", 
provenanceProperties.getDestinationUrl());
-            attributes.put("Input Port Name", 
provenanceProperties.getPortName());
-            attributes.put("Instance URL", 
provenanceProperties.getOriginatingUrl());
-            attributes.put("Compress Events", 
provenanceProperties.getUseCompression());
-            attributes.put("Batch Size", provenanceProperties.getBatchSize());
-            attributes.put("Communications Timeout", 
provenanceProperties.getTimeout());
-
-            SecurityPropertiesSchema securityProps = 
configSchema.getSecurityProperties();
-            if (securityProps.useSSL()) {
-                attributes.put("SSL Context Service", "SSL-Context-Service");
-            }
+            addTextElement(element, "id", reportingSchema.getId());
+            addTextElement(element, "name", reportingSchema.getName());
+            addTextElement(element, "comment", reportingSchema.getComment());
+            addTextElement(element, "class", 
reportingSchema.getReportingClass());
+            addTextElement(element, "schedulingPeriod", 
reportingSchema.getSchedulingPeriod());
+            addTextElement(element, "scheduledState", "RUNNING");
+            addTextElement(element, "schedulingStrategy", 
reportingSchema.getSchedulingStrategy());
 
-            addConfiguration(taskElement, attributes);
+            // TODO: Clarify this

Review comment:
       For backward compatibility, if SSL is enabled, the Provenance Reporting 
task declared in `Provenance Reporting` node will have secure connect as well. 
If a provenance reporting task is declared in `Reporting Tasks:` node, user has 
to set it manually.

##########
File path: 
minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/ConfigTransformer.java
##########
@@ -508,34 +500,29 @@ protected static void addFunnel(final Element 
parentElement, FunnelSchema funnel
         addPosition(element);
     }
 
-    protected static void addProvenanceReportingTask(final Element element, 
ConfigSchema configSchema) throws ConfigurationChangeException {
+    protected static void addReportingTask(final Element parentElement, 
ReportingSchema reportingSchema) throws ConfigurationChangeException {
         try {
-            ProvenanceReportingSchema provenanceProperties = 
configSchema.getProvenanceReportingProperties();
-            final Element taskElement = 
element.getOwnerDocument().createElement("reportingTask");
-            addTextElement(taskElement, "id", "Provenance-Reporting");
-            addTextElement(taskElement, "name", 
"Site-To-Site-Provenance-Reporting");
-            addTextElement(taskElement, "comment", 
provenanceProperties.getComment());
-            addTextElement(taskElement, "class", 
DEFAULT_PROV_REPORTING_TASK_CLASS);
-            addTextElement(taskElement, "schedulingPeriod", 
provenanceProperties.getSchedulingPeriod());
-            addTextElement(taskElement, "scheduledState", "RUNNING");
-            addTextElement(taskElement, "schedulingStrategy", 
provenanceProperties.getSchedulingStrategy());
+            final Document doc = parentElement.getOwnerDocument();
+            final Element element = doc.createElement("reportingTask");
+            parentElement.appendChild(element);
 
-            Map<String, Object> attributes = new HashMap<>();
-            attributes.put("Destination URL", 
provenanceProperties.getDestinationUrl());
-            attributes.put("Input Port Name", 
provenanceProperties.getPortName());
-            attributes.put("Instance URL", 
provenanceProperties.getOriginatingUrl());
-            attributes.put("Compress Events", 
provenanceProperties.getUseCompression());
-            attributes.put("Batch Size", provenanceProperties.getBatchSize());
-            attributes.put("Communications Timeout", 
provenanceProperties.getTimeout());
-
-            SecurityPropertiesSchema securityProps = 
configSchema.getSecurityProperties();
-            if (securityProps.useSSL()) {
-                attributes.put("SSL Context Service", "SSL-Context-Service");
-            }
+            addTextElement(element, "id", reportingSchema.getId());
+            addTextElement(element, "name", reportingSchema.getName());
+            addTextElement(element, "comment", reportingSchema.getComment());
+            addTextElement(element, "class", 
reportingSchema.getReportingClass());
+            addTextElement(element, "schedulingPeriod", 
reportingSchema.getSchedulingPeriod());
+            addTextElement(element, "scheduledState", "RUNNING");
+            addTextElement(element, "schedulingStrategy", 
reportingSchema.getSchedulingStrategy());
 
-            addConfiguration(taskElement, attributes);
+            // TODO: Clarify this

Review comment:
       Done, for backward compatibility, if SSL is enabled, the Provenance 
Reporting task declared in `Provenance Reporting` node will have secure connect 
as well. If a provenance reporting task is declared in `Reporting Tasks:` node, 
user has to set it manually.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to