Loading src/MetadataExporter.cpp +31 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,9 @@ #include <Configuration.h> #include <PlainServer.h> #include <SSLServer.h> #include <bits/c++config.h> #include <bits/c++config.h> //@todo: controllare #include <boost/filesystem.hpp> /*----- PROTECTED REGION END -----*/ // MetadataExporter.cpp Loading Loading @@ -399,11 +401,17 @@ void MetadataExporter::get_device_property() if(certificateFile.empty()) throw(invalid_argument("CertificateFile property is empty or not defined")); checkIfFileExists(certificateFile); if(privateKeyFile.empty()) throw(invalid_argument("PrivateKeyFile property is empty or not defined")); checkIfFileExists(privateKeyFile); if(dHTempFile.empty()) throw(invalid_argument("DHTempFile property is empty or not defined")); checkIfFileExists(dHTempFile); } if(databaseHost.empty()) Loading Loading @@ -633,5 +641,27 @@ void MetadataExporter::importAuthorisedUsers(std::vector<std::string>& authorise } } //============================================================================== // MetadataExporter::checkIfFileExists() //============================================================================== void MetadataExporter::checkIfFileExists(std::string fileName) throw(std::invalid_argument) { boost::filesystem::path path(fileName); if(!boost::filesystem::exists(path)) { std::stringstream errorStream; errorStream << "File " << fileName << " not exists" << std::endl; throw std::invalid_argument(errorStream.str()); } #ifdef VERBOSE_DEBUG INFO_STREAM << "FILE: " << fileName << " -> OK" << endl; INFO_STREAM << "-------------------------------------------------" << endl; #endif } /*----- PROTECTED REGION END -----*/ // MetadataExporter::namespace_ending } // namespace src/MetadataExporter.h +3 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,9 @@ protected: std::map<const std::string, const std::string>&) throw(std::invalid_argument); virtual void checkIfFileExists(std::string) throw(std::invalid_argument); /*----- PROTECTED REGION END -----*/ // MetadataExporter::Additional Method prototypes }; Loading Loading
src/MetadataExporter.cpp +31 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,9 @@ #include <Configuration.h> #include <PlainServer.h> #include <SSLServer.h> #include <bits/c++config.h> #include <bits/c++config.h> //@todo: controllare #include <boost/filesystem.hpp> /*----- PROTECTED REGION END -----*/ // MetadataExporter.cpp Loading Loading @@ -399,11 +401,17 @@ void MetadataExporter::get_device_property() if(certificateFile.empty()) throw(invalid_argument("CertificateFile property is empty or not defined")); checkIfFileExists(certificateFile); if(privateKeyFile.empty()) throw(invalid_argument("PrivateKeyFile property is empty or not defined")); checkIfFileExists(privateKeyFile); if(dHTempFile.empty()) throw(invalid_argument("DHTempFile property is empty or not defined")); checkIfFileExists(dHTempFile); } if(databaseHost.empty()) Loading Loading @@ -633,5 +641,27 @@ void MetadataExporter::importAuthorisedUsers(std::vector<std::string>& authorise } } //============================================================================== // MetadataExporter::checkIfFileExists() //============================================================================== void MetadataExporter::checkIfFileExists(std::string fileName) throw(std::invalid_argument) { boost::filesystem::path path(fileName); if(!boost::filesystem::exists(path)) { std::stringstream errorStream; errorStream << "File " << fileName << " not exists" << std::endl; throw std::invalid_argument(errorStream.str()); } #ifdef VERBOSE_DEBUG INFO_STREAM << "FILE: " << fileName << " -> OK" << endl; INFO_STREAM << "-------------------------------------------------" << endl; #endif } /*----- PROTECTED REGION END -----*/ // MetadataExporter::namespace_ending } // namespace
src/MetadataExporter.h +3 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,9 @@ protected: std::map<const std::string, const std::string>&) throw(std::invalid_argument); virtual void checkIfFileExists(std::string) throw(std::invalid_argument); /*----- PROTECTED REGION END -----*/ // MetadataExporter::Additional Method prototypes }; Loading