MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / createContentRepository

Function createContentRepository

libminifi/src/core/RepositoryFactory.cpp:77–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77std::shared_ptr<core::ContentRepository> createContentRepository(const std::string configuration_class_name, bool fail_safe, const std::string repo_name) {
78 std::shared_ptr<core::ContentRepository> return_obj = nullptr;
79 std::string class_name_lc = configuration_class_name;
80 std::transform(class_name_lc.begin(), class_name_lc.end(), class_name_lc.begin(), ::tolower);
81 try {
82 std::shared_ptr<core::ContentRepository> return_obj = nullptr;
83
84 auto ptr = core::ClassLoader::getDefaultClassLoader().instantiate<core::ContentRepository>(class_name_lc, class_name_lc);
85 if (nullptr != ptr) {
86 return_obj = ptr;
87 }
88 if (return_obj) {
89 return return_obj;
90 }
91 if (class_name_lc == "volatilecontentrepository") {
92 return std::make_shared<core::repository::VolatileContentRepository>(repo_name);
93 } else if (class_name_lc == "filesystemrepository") {
94 return std::make_shared<core::repository::FileSystemRepository>(repo_name);
95 }
96 if (fail_safe) {
97 return std::make_shared<core::repository::VolatileContentRepository>("fail_safe");
98 } else {
99 throw std::runtime_error("Support for the provided configuration class could not be found");
100 }
101 } catch (const std::runtime_error &) {
102 if (fail_safe) {
103 return std::make_shared<core::repository::VolatileContentRepository>("fail_safe");
104 }
105 }
106
107 throw std::runtime_error("Support for the provided configuration class could not be found");
108}
109
110} /* namespace core */
111} /* namespace minifi */

Callers 3

getControllerServiceFunction · 0.85
printManifestFunction · 0.85
mainFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected