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

Function createRepository

libminifi/src/core/RepositoryFactory.cpp:36–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace core {
35
36std::shared_ptr<core::Repository> createRepository(const std::string configuration_class_name, bool fail_safe, const std::string repo_name) {
37 std::shared_ptr<core::Repository> return_obj = nullptr;
38 std::string class_name_lc = configuration_class_name;
39 std::transform(class_name_lc.begin(), class_name_lc.end(), class_name_lc.begin(), ::tolower);
40 try {
41 std::shared_ptr<core::Repository> return_obj = nullptr;
42
43 auto ptr = core::ClassLoader::getDefaultClassLoader().instantiate<core::Repository>(class_name_lc, class_name_lc);
44 if (nullptr != ptr) {
45 ptr->setName(repo_name);
46 return_obj = ptr;
47 }
48
49 if (return_obj) {
50 return return_obj;
51 }
52 // if the desired repos don't exist, we can try doing string matches and reoly on volatile repositories
53 if (class_name_lc == "flowfilerepository" || class_name_lc == "volatileflowfilerepository") {
54 return_obj = instantiate<repository::VolatileFlowFileRepository>(repo_name);
55 } else if (class_name_lc == "provenancerepository" || class_name_lc == "volatileprovenancefilerepository") {
56 return_obj = instantiate<repository::VolatileProvenanceRepository>(repo_name);
57 } else if (class_name_lc == "nooprepository") {
58 return_obj = instantiate<core::Repository>(repo_name);
59 }
60 if (return_obj) {
61 return return_obj;
62 }
63 if (fail_safe) {
64 return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1, 1);
65 } else {
66 throw std::runtime_error("Support for the provided configuration class could not be found");
67 }
68 } catch (const std::runtime_error &) {
69 if (fail_safe) {
70 return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1, 1);
71 }
72 }
73
74 throw std::runtime_error("Support for the provided configuration class could not be found");
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;

Callers 7

getControllerServiceFunction · 0.85
printManifestFunction · 0.85
mainFunction · 0.85
NoRocksDB.cppFile · 0.85
RepoTests.cppFile · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected