From 4930e3212b5e452df31c97aa60337d13bbcd4e36 Mon Sep 17 00:00:00 2001 From: Marco De Marco <demarco@oats.inaf.it> Date: Thu, 12 Dec 2013 11:14:25 +0100 Subject: [PATCH] Storage path property removed --- src/Configuration.h | 22 +++++++----------- src/DataExporter.cpp | 49 ++------------------------------------- src/DataExporter.h | 6 ----- src/DataExporter.xmi | 4 ---- src/DataExporterClass.cpp | 13 ----------- 5 files changed, 10 insertions(+), 84 deletions(-) diff --git a/src/Configuration.h b/src/Configuration.h index e3cccf6..f29d3ac 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -30,15 +30,15 @@ protected: //------------------------------------------------------------------------------ Configuration(std::string certificateFile, std::string privateKeyFile, std::string dHTempFile, ExportedTablesMap exportedTablesMap, - AuthorisedUsersMap authorisedUsersMap, std::string storagePath, - std::string localHost, unsigned int localPort, unsigned int workerNumber, + AuthorisedUsersMap authorisedUsersMap, std::string localHost, + unsigned int localPort, unsigned int workerNumber, std::string databaseHost, unsigned int databasePort, std::string databaseUsername, std::string databasePassword, unsigned int databaseConnectionNumber) : m_certificateFile(certificateFile), m_privateKeyFile(privateKeyFile), m_dHTempFile(dHTempFile), m_exportedTablesMap(exportedTablesMap), - m_authorisedUsersMap(authorisedUsersMap), m_storagePath(storagePath), - m_localHost(localHost), m_localPort(localPort), m_workerNumber(workerNumber), + m_authorisedUsersMap(authorisedUsersMap), m_localHost(localHost), + m_localPort(localPort), m_workerNumber(workerNumber), m_databaseHost(databaseHost), m_databasePort(databasePort), m_databaseUsername(databaseUsername), m_databasePassword(databasePassword), m_databaseConnectionNumber(databaseConnectionNumber) {} @@ -60,17 +60,15 @@ public: static Configuration::SP create(std::string certificateFile, std::string privateKeyFile, std::string dHTempFile, ExportedTablesMap exportedTablesMap, AuthorisedUsersMap authorisedUsersMap, - std::string storagePath, std::string localHost, - unsigned int localPort, unsigned int workerNumber, + std::string localHost, unsigned int localPort, unsigned int workerNumber, std::string databaseHost, unsigned int databasePort, std::string databaseUsername, std::string databasePassword, unsigned int databaseConnectionNumber) { Configuration::SP c_sp(new Configuration(certificateFile, privateKeyFile, - dHTempFile, exportedTablesMap, authorisedUsersMap, storagePath, - localHost, localPort, workerNumber, databaseHost, databasePort, - databaseUsername, databasePassword, databaseConnectionNumber), - Configuration::Deleter()); + dHTempFile, exportedTablesMap, authorisedUsersMap, localHost, localPort, + workerNumber, databaseHost, databasePort, databaseUsername, + databasePassword, databaseConnectionNumber), Configuration::Deleter()); return c_sp; } @@ -83,7 +81,6 @@ public: std::string getDHTempFile() const { return m_dHTempFile; } ExportedTablesMap& getExportedTablesMap() const { return m_exportedTablesMap; } AuthorisedUsersMap& getAuthorisedUsersMap() const { return m_authorisedUsersMap; } - std::string getStoragePath() const { return m_storagePath; } std::string getLocalHost() const { return m_localHost; } unsigned int getLocalPort() const { return m_localPort; } unsigned int getWorkerNumber() const { return m_workerNumber; } @@ -143,9 +140,6 @@ protected: //Authorised users map [user password] AuthorisedUsersMap m_authorisedUsersMap; - //Absolute path to storage - const std::string m_storagePath; - //Local host address for incoming connection const std::string m_localHost; diff --git a/src/DataExporter.cpp b/src/DataExporter.cpp index 33e2d6f..a819848 100644 --- a/src/DataExporter.cpp +++ b/src/DataExporter.cpp @@ -203,7 +203,6 @@ void DataExporter::get_device_property() dev_prop.push_back(Tango::DbDatum("DHTempFile")); dev_prop.push_back(Tango::DbDatum("ExportedTables")); dev_prop.push_back(Tango::DbDatum("AuthorisedUsers")); - dev_prop.push_back(Tango::DbDatum("StoragePath")); dev_prop.push_back(Tango::DbDatum("LocalHost")); dev_prop.push_back(Tango::DbDatum("LocalPort")); dev_prop.push_back(Tango::DbDatum("WorkerNumber")); @@ -282,17 +281,6 @@ void DataExporter::get_device_property() // And try to extract AuthorisedUsers value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> authorisedUsers; - // Try to initialize StoragePath from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> storagePath; - else { - // Try to initialize StoragePath from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> storagePath; - } - // And try to extract StoragePath value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> storagePath; - // Try to initialize LocalHost from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> localHost; @@ -426,11 +414,6 @@ void DataExporter::get_device_property() importAuthorisedUsers(authorisedUsers, authorisedUsersMap); - if(storagePath.empty()) - throw(invalid_argument("StoragePath property is empty or not defined")); - - checkIfDirectoryExists(storagePath); - if(localHost.empty()) throw(invalid_argument("LocalHost property is empty or not defined")); @@ -457,9 +440,8 @@ void DataExporter::get_device_property() m_configuration_sp = Configuration::create(certificateFile, privateKeyFile, dHTempFile, exportedTablesMap, authorisedUsersMap, - storagePath, localHost, localPort, workerNumber, - databaseHost, databasePort, databaseUsername, databasePassword, - databaseConnectionNumber); + localHost, localPort, workerNumber, databaseHost, databasePort, + databaseUsername, databasePassword, databaseConnectionNumber); } catch(invalid_argument& ex) { @@ -715,32 +697,5 @@ void DataExporter::checkIfFileExists(std::string fileName) INFO_STREAM << "DataExporter::checkIfFileExists() " << fileName << endl; } -//============================================================================== -// DataExporter::checkIfFileExists() -//============================================================================== -void DataExporter::checkIfDirectoryExists(std::string directoryName) - throw(std::invalid_argument) -{ - DEBUG_STREAM << "DataExporter::checkIfFileExists() - " << device_name << endl; - - boost::filesystem::path path(directoryName); - - if(!boost::filesystem::exists(path)) - { - std::stringstream errorStream; - errorStream << "Directory " << directoryName << " not exists" << std::endl; - throw std::invalid_argument(errorStream.str()); - } - - if(!boost::filesystem::is_directory(path)) - { - std::stringstream errorStream; - errorStream << directoryName << " is not a directory" << std::endl; - throw std::invalid_argument(errorStream.str()); - } - - INFO_STREAM << "DataExporter::checkIfDirectoryExists() " << directoryName << endl; -} - /*----- PROTECTED REGION END -----*/ // DataExporter::namespace_ending } // namespace diff --git a/src/DataExporter.h b/src/DataExporter.h index 9f1a61e..5db2bac 100644 --- a/src/DataExporter.h +++ b/src/DataExporter.h @@ -99,8 +99,6 @@ public: // AuthorisedUsers: Authorised user list: one user per row // [username password] vector<string> authorisedUsers; - // StoragePath: Absolute path to storage - string storagePath; // LocalHost: Local host address for incoming connection string localHost; // LocalPort: Local port for wait incoming connection @@ -226,10 +224,6 @@ public: virtual void checkIfFileExists(std::string) throw(std::invalid_argument); - virtual void checkIfDirectoryExists(std::string) - throw(std::invalid_argument); - - /*----- PROTECTED REGION END -----*/ // DataExporter::Additional Method prototypes }; diff --git a/src/DataExporter.xmi b/src/DataExporter.xmi index d2254df..e310dc2 100644 --- a/src/DataExporter.xmi +++ b/src/DataExporter.xmi @@ -45,10 +45,6 @@ <type xsi:type="pogoDsl:StringVectorType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="StoragePath" description="Absolute path to storage"> - <type xsi:type="pogoDsl:StringType"/> - <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </deviceProperties> <deviceProperties name="LocalHost" description="Local host address for incoming connection"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> diff --git a/src/DataExporterClass.cpp b/src/DataExporterClass.cpp index dbe5274..373c6ab 100644 --- a/src/DataExporterClass.cpp +++ b/src/DataExporterClass.cpp @@ -484,19 +484,6 @@ void DataExporterClass::set_default_property() dev_def_prop.push_back(data); add_wiz_dev_prop(prop_name, prop_desc, prop_def); } - else - add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "StoragePath"; - prop_desc = "Absolute path to storage"; - prop_def = ""; - vect_data.clear(); - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } else add_wiz_dev_prop(prop_name, prop_desc); prop_name = "LocalHost"; -- GitLab