|
| ServiceManifestFileLoader (const std::string &source) |
|
virtual std::vector< json_t * > | loadContent () override |
| Loads the json content from the Service Manifest(s) More...
|
|
|
std::vector< json_t * > | m_content |
|
const std::string | m_source |
|
Definition at line 31 of file servicemanifestfileloader.h.
std::vector< json_t * > softwarecontainer::ServiceManifestFileLoader::loadContent |
( |
| ) |
|
|
overridevirtual |
Loads the json content from the Service Manifest(s)
- Returns
- a vector of json_t representing the Service Manifest(s)
- Exceptions
-
Implements softwarecontainer::ServiceManifestLoader.
Definition at line 30 of file servicemanifestfileloader.cpp.
References softwarecontainer::isDirectory(), softwarecontainer::isDirectoryEmpty(), and softwarecontainer::isFile().
32 std::string errorMessage;
34 if (m_source.empty()) {
36 log_debug() <<
"Path to service manifests is empty";
37 }
else if (m_source.compare(
"/") == 0) {
38 errorMessage =
"Searching for configuration files from root dir not allowed";
39 log_error() << errorMessage;
40 throw ServiceManifestPathError(errorMessage);
42 log_debug() <<
"Path to service manifests is a directory";
43 loadServiceManifestDir();
44 }
else if (
isFile(m_source)) {
45 log_debug() <<
"Path to service manifest is a file";
46 if (isJsonFile(m_source)) {
47 loadServiceManifestFile(m_source);
49 errorMessage =
"Path to service manifest is not a json file";
50 log_debug() << errorMessage;
51 throw ServiceManifestPathError(errorMessage);
54 errorMessage =
"The path to the service manifest(s) is not a directory or file: \"" 56 log_error() << errorMessage;
57 throw ServiceManifestPathError(errorMessage);
bool isDirectory(const std::string &path)
isDirectory Check if path is a directory
bool isFile(const std::string &path)
isFile Check if path is a file
The documentation for this class was generated from the following files: