martinzink commented on code in PR #2083:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2083#discussion_r2721480526


##########
libminifi/include/core/RepositoryFactory.h:
##########
@@ -32,8 +32,11 @@ namespace org::apache::nifi::minifi::core {
  * @param configuration_class_name configuration class name
  * @param fail_safe determines whether or not to make the default class if 
configuration_class_name is invalid

Review Comment:
   good idea, and since the only nontrivial argument was fail_safe I doubt this 
documentation style comment add anything useful so I've removed it entirely 
https://github.com/apache/nifi-minifi-cpp/pull/2083/changes/3812bc5013cb4d3b8c8597e73677870c39e9a210



##########
libminifi/src/core/RepositoryFactory.cpp:
##########
@@ -28,33 +28,31 @@ using namespace std::literals::chrono_literals;
 
 namespace org::apache::nifi::minifi::core {
 
-std::unique_ptr<core::ContentRepository> createContentRepository(const 
std::string& configuration_class_name, bool fail_safe, const std::string& 
repo_name) {
+std::unique_ptr<core::ContentRepository> createContentRepository(const 
std::string& configuration_class_name,
+    const std::string& repo_name,
+    logging::Logger* logger) {
   std::string class_name_lc = configuration_class_name;
   std::transform(class_name_lc.begin(), class_name_lc.end(), 
class_name_lc.begin(), ::tolower);
-  try {
-    auto return_obj = 
core::ClassLoader::getDefaultClassLoader().instantiate<core::ContentRepository>(class_name_lc,
-                                                                               
                       class_name_lc);
-    if (return_obj) {
-      return_obj->setName(repo_name);
-      return return_obj;
-    }
-    if (class_name_lc == "volatilecontentrepository") {
-      return 
std::make_unique<core::repository::VolatileContentRepository>(repo_name);
-    } else if (class_name_lc == "filesystemrepository") {
-      return 
std::make_unique<core::repository::FileSystemRepository>(repo_name);
-    }
-    if (fail_safe) {
-      return 
std::make_unique<core::repository::VolatileContentRepository>("fail_safe");
-    } else {
-      throw std::runtime_error("Support for the provided configuration class 
could not be found");
-    }
-  } catch (const std::runtime_error&) {
-    if (fail_safe) {
-      return 
std::make_unique<core::repository::VolatileContentRepository>("fail_safe");
-    }
+
+  auto return_obj = 
core::ClassLoader::getDefaultClassLoader().instantiate<core::ContentRepository>(class_name_lc,
+                                                                               
                   class_name_lc);

Review Comment:
   👍 
https://github.com/apache/nifi-minifi-cpp/pull/2083/changes/3812bc5013cb4d3b8c8597e73677870c39e9a210



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