You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/05/31 14:32:00 UTC

[GitHub] [nifi-minifi] apiri commented on a change in pull request #187: MINIFI-492 - Generic reporting tasks

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



##########
File path: minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/ConfigTransformer.java
##########
@@ -22,25 +22,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeException;
 import org.apache.nifi.minifi.bootstrap.exception.InvalidConfigurationException;
-import org.apache.nifi.minifi.commons.schema.ComponentStatusRepositorySchema;
-import org.apache.nifi.minifi.commons.schema.ConfigSchema;
-import org.apache.nifi.minifi.commons.schema.ConnectionSchema;
-import org.apache.nifi.minifi.commons.schema.ContentRepositorySchema;
-import org.apache.nifi.minifi.commons.schema.ControllerServiceSchema;
-import org.apache.nifi.minifi.commons.schema.CorePropertiesSchema;
-import org.apache.nifi.minifi.commons.schema.FlowControllerSchema;
-import org.apache.nifi.minifi.commons.schema.FlowFileRepositorySchema;
-import org.apache.nifi.minifi.commons.schema.FunnelSchema;
-import org.apache.nifi.minifi.commons.schema.PortSchema;
-import org.apache.nifi.minifi.commons.schema.ProcessGroupSchema;
-import org.apache.nifi.minifi.commons.schema.ProcessorSchema;
-import org.apache.nifi.minifi.commons.schema.ProvenanceReportingSchema;
-import org.apache.nifi.minifi.commons.schema.ProvenanceRepositorySchema;
-import org.apache.nifi.minifi.commons.schema.RemotePortSchema;
-import org.apache.nifi.minifi.commons.schema.RemoteProcessGroupSchema;
-import org.apache.nifi.minifi.commons.schema.SecurityPropertiesSchema;
-import org.apache.nifi.minifi.commons.schema.SensitivePropsSchema;
-import org.apache.nifi.minifi.commons.schema.SwapSchema;
+import org.apache.nifi.minifi.commons.schema.*;

Review comment:
       This will cause a contrib-check failure.  Conventions do not allow the use of * imports.
   
   running with mvn -Pcontrib-check will catch these 

##########
File path: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/ReportingSchema.java
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.minifi.commons.schema;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchemaWithIdAndName;
+import org.apache.nifi.scheduling.SchedulingStrategy;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.*;
+import static org.apache.nifi.minifi.commons.schema.ProcessorSchema.IT_IS_NOT_A_VALID_SCHEDULING_STRATEGY;
+
+/**

Review comment:
       Would give a description here or remove

##########
File path: minifi-toolkit/minifi-toolkit-configuration/src/test/resources/1.5_RPG_Handling.yml
##########
@@ -112,3 +112,5 @@ Remote Process Groups:
     use compression: false
   Output Ports: []
 NiFi Properties Overrides: {}
+Reporting Tasks: []

Review comment:
       Seems this was duplicated.  I also think it should be okay to not have a Reporting Tasks section from a config standpoint.  For existing flows, we do not wish to break them.

##########
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:
       given the generic (and correct) handling of the properties below, I believe we need to see if we are performing this override and provide special handling.




----------------------------------------------------------------
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:
users@infra.apache.org