adamdebreceni commented on code in PR #1391:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1391#discussion_r979884804


##########
libminifi/include/core/flow/StructuredConfiguration.h:
##########
@@ -0,0 +1,234 @@
+/**
+ *
+ * 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.
+ */
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+#include <unordered_set>
+
+#include "core/FlowConfiguration.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "core/ProcessorConfig.h"
+#include "Exception.h"
+#include "io/StreamFactory.h"
+#include "io/validation.h"
+#include "sitetosite/SiteToSite.h"
+#include "utils/Id.h"
+#include "utils/StringUtils.h"
+#include "utils/file/FileSystem.h"
+#include "core/flow/Node.h"
+
+namespace org::apache::nifi::minifi::core {
+
+static constexpr char const* CONFIG_FLOW_CONTROLLER_KEY = "Flow Controller";
+static constexpr char const* CONFIG_PROCESSORS_KEY = "Processors";
+static constexpr char const* CONFIG_CONTROLLER_SERVICES_KEY = "Controller 
Services";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY = "Remote 
Processing Groups";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY_V3 = "Remote 
Process Groups";
+static constexpr char const* CONFIG_PROVENANCE_REPORT_KEY = "Provenance 
Reporting";
+static constexpr char const* CONFIG_FUNNELS_KEY = "Funnels";
+
+#define CONFIGURATION_USE_REGEX
+
+// Disable regex in EL for incompatible compilers
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#undef CONFIGURATION_USE_REGEX
+#endif

Review Comment:
   removed



##########
libminifi/include/core/flow/StructuredConfiguration.h:
##########
@@ -0,0 +1,234 @@
+/**
+ *
+ * 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.
+ */
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+#include <unordered_set>
+
+#include "core/FlowConfiguration.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "core/ProcessorConfig.h"
+#include "Exception.h"
+#include "io/StreamFactory.h"
+#include "io/validation.h"
+#include "sitetosite/SiteToSite.h"
+#include "utils/Id.h"
+#include "utils/StringUtils.h"
+#include "utils/file/FileSystem.h"
+#include "core/flow/Node.h"
+
+namespace org::apache::nifi::minifi::core {
+
+static constexpr char const* CONFIG_FLOW_CONTROLLER_KEY = "Flow Controller";
+static constexpr char const* CONFIG_PROCESSORS_KEY = "Processors";
+static constexpr char const* CONFIG_CONTROLLER_SERVICES_KEY = "Controller 
Services";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY = "Remote 
Processing Groups";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY_V3 = "Remote 
Process Groups";
+static constexpr char const* CONFIG_PROVENANCE_REPORT_KEY = "Provenance 
Reporting";
+static constexpr char const* CONFIG_FUNNELS_KEY = "Funnels";
+
+#define CONFIGURATION_USE_REGEX
+
+// Disable regex in EL for incompatible compilers
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#undef CONFIGURATION_USE_REGEX
+#endif
+
+class StructuredConfiguration : public FlowConfiguration {
+ public:
+  StructuredConfiguration(ConfigurationContext ctx, 
std::shared_ptr<logging::Logger> logger);
+
+  /**
+   * Iterates all component property validation rules and checks that 
configured state
+   * is valid. If state is determined to be invalid, conf parsing ends and an 
error is raised.
+   *
+   * @param component
+   * @param component_name
+   * @param section
+   */
+  void validateComponentProperties(ConfigurableComponent& component, const 
std::string &component_name, const std::string &section) const;
+
+ protected:
+  /**
+   * Returns a shared pointer to a ProcessGroup object containing the
+   * flow configuration.
+   *
+   * @param root_node a pointer to a flow::Node object containing the root
+   *                       node of the parsed document
+   * @return             the root ProcessGroup node of the flow
+   *                       configuration tree
+   */
+  std::unique_ptr<core::ProcessGroup> getRootFrom(const flow::Node& root_node);
+
+  std::unique_ptr<core::ProcessGroup> createProcessGroup(const flow::Node& 
node, bool is_root = false);
+
+  std::unique_ptr<core::ProcessGroup> parseProcessGroup(const flow::Node& 
header_node, const flow::Node& node, bool is_root = false);
+  /**
+   * Parses processors from its corresponding config node and adds
+   * them to a parent ProcessGroup. The processors_node argument must point

Review Comment:
   renamed



##########
libminifi/include/core/flow/StructuredConfiguration.h:
##########
@@ -0,0 +1,234 @@
+/**
+ *
+ * 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.
+ */
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+#include <unordered_set>
+
+#include "core/FlowConfiguration.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "core/ProcessorConfig.h"
+#include "Exception.h"
+#include "io/StreamFactory.h"
+#include "io/validation.h"
+#include "sitetosite/SiteToSite.h"
+#include "utils/Id.h"
+#include "utils/StringUtils.h"
+#include "utils/file/FileSystem.h"
+#include "core/flow/Node.h"
+
+namespace org::apache::nifi::minifi::core {
+
+static constexpr char const* CONFIG_FLOW_CONTROLLER_KEY = "Flow Controller";
+static constexpr char const* CONFIG_PROCESSORS_KEY = "Processors";
+static constexpr char const* CONFIG_CONTROLLER_SERVICES_KEY = "Controller 
Services";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY = "Remote 
Processing Groups";
+static constexpr char const* CONFIG_REMOTE_PROCESS_GROUP_KEY_V3 = "Remote 
Process Groups";
+static constexpr char const* CONFIG_PROVENANCE_REPORT_KEY = "Provenance 
Reporting";
+static constexpr char const* CONFIG_FUNNELS_KEY = "Funnels";
+
+#define CONFIGURATION_USE_REGEX
+
+// Disable regex in EL for incompatible compilers
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#undef CONFIGURATION_USE_REGEX
+#endif
+
+class StructuredConfiguration : public FlowConfiguration {
+ public:
+  StructuredConfiguration(ConfigurationContext ctx, 
std::shared_ptr<logging::Logger> logger);
+
+  /**
+   * Iterates all component property validation rules and checks that 
configured state
+   * is valid. If state is determined to be invalid, conf parsing ends and an 
error is raised.
+   *
+   * @param component
+   * @param component_name
+   * @param section
+   */
+  void validateComponentProperties(ConfigurableComponent& component, const 
std::string &component_name, const std::string &section) const;
+
+ protected:
+  /**
+   * Returns a shared pointer to a ProcessGroup object containing the
+   * flow configuration.
+   *
+   * @param root_node a pointer to a flow::Node object containing the root
+   *                       node of the parsed document
+   * @return             the root ProcessGroup node of the flow
+   *                       configuration tree
+   */
+  std::unique_ptr<core::ProcessGroup> getRootFrom(const flow::Node& root_node);
+
+  std::unique_ptr<core::ProcessGroup> createProcessGroup(const flow::Node& 
node, bool is_root = false);
+
+  std::unique_ptr<core::ProcessGroup> parseProcessGroup(const flow::Node& 
header_node, const flow::Node& node, bool is_root = false);
+  /**
+   * Parses processors from its corresponding config node and adds
+   * them to a parent ProcessGroup. The processors_node argument must point
+   * to a flow::Node containing the processors configuration. Processor
+   * objects will be created and added to the parent ProcessGroup specified
+   * by the parent argument.
+   *
+   * @param processor_node_seq  the flow::Node containing the processor 
configuration
+   * @param parent              the parent ProcessGroup to which the the 
created
+   *                            Processor should be added
+   */
+  void parseProcessorNode(const flow::Node& processor_node_seq, 
core::ProcessGroup* parent);
+
+  /**
+   * Parses a port from its corresponding config node and adds
+   * it to a parent ProcessGroup. The port_node argument must point
+   * to a flow::Node containing the port configuration. A 
RemoteProcessorGroupPort
+   * object will be created a added to the parent ProcessGroup specified
+   * by the parent argument.
+   *
+   * @param port_node  the flow::Node containing the port configuration
+   * @param parent    the parent ProcessGroup for the port
+   * @param direction the TransferDirection of the port
+   */
+  void parsePort(const flow::Node& port_node, core::ProcessGroup* parent, 
sitetosite::TransferDirection direction);
+
+  /**
+   * Parses the root level node for the flow configuration and
+   * returns a ProcessGroup containing the tree of flow configuration
+   * objects.
+   *
+   * @param root_flow_node
+   * @return
+   */
+  std::unique_ptr<core::ProcessGroup> parseRootProcessGroup(const flow::Node& 
root_flow_node);
+
+  void parseProcessorProperty(const flow::Node& doc, const flow::Node& node, 
std::shared_ptr<core::Processor> processor);
+
+  void parseControllerServices(const flow::Node& controller_services_node);
+
+  /**
+   * Parses the Connections section of a configuration.
+   * The resulting Connections are added to the parent ProcessGroup.
+   *
+   * @param connection_node_seq   the Node containing the Connections section
+   *                              of the configuration
+   * @param parent                the root node of flow configuration to which
+   *                              to add the connections that are parsed
+   */
+  void parseConnection(const flow::Node& connection_node_seq, 
core::ProcessGroup* parent);
+
+  /**
+   * Parses the Remote Process Group section of a configuration.
+   * The resulting Process Group is added to the parent ProcessGroup.
+   *
+   * @param rpg_node_seq  the flow::Node containing the Remote Process Group
+   *                      section of the configuration YAML

Review Comment:
   removed



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to