Loading src/Configuration.h +23 −12 Original line number Diff line number Diff line Loading @@ -28,20 +28,22 @@ private: std::string auxDatabaseHost, unsigned int auxDatabasePort, std::string auxDatabaseUsername, std::string auxDatabasePassword, std::string auxDatabaseSchema, std::string auxDatabaseTimestampTable, std::string auxDatabaseFailedTable) : m_certificateFile (certificateFile), m_storagePath(storagePath), m_remoteHost(remoteHost), m_remotePort(remotePort), m_remoteUsername(remoteUsername), m_remotePassword(remotePassword), m_databaseHost(databaseHost), m_databasePort(databasePort), m_databaseUsername(databaseUsername), m_databasePassword(databasePassword), m_databaseSchema(databaseSchema), m_databaseTable(databaseTable), m_refreshTime(refreshTime), m_timeout(timeout), m_recoveryTime(recoveryTime), std::string auxDatabaseFailedTable, std::string selectKey, std::string selectValue) : m_certificateFile (certificateFile), m_storagePath(storagePath), m_remoteHost(remoteHost), m_remotePort(remotePort), m_remoteUsername(remoteUsername), m_remotePassword(remotePassword), m_databaseHost(databaseHost), m_databasePort(databasePort), m_databaseUsername(databaseUsername), m_databasePassword(databasePassword), m_databaseSchema(databaseSchema), m_databaseTable(databaseTable), m_refreshTime(refreshTime), m_timeout(timeout), m_recoveryTime(recoveryTime), m_auxDatabaseHost(auxDatabaseHost), m_auxDatabasePort(auxDatabasePort), m_auxDatabaseUsername(auxDatabaseUsername), m_auxDatabasePassword(auxDatabasePassword), m_auxDatabaseSchema(auxDatabaseSchema), m_auxDatabaseTimestampTable(auxDatabaseTimestampTable), m_auxDatabaseFailedTable(auxDatabaseFailedTable) { }; m_auxDatabaseFailedTable(auxDatabaseFailedTable), m_selectKey(selectKey), m_selectValue(selectValue) { }; virtual ~Configuration() {} Loading @@ -67,15 +69,16 @@ public: std::string auxDatabaseHost, unsigned int auxDatabasePort, std::string auxDatabaseUsername, std::string auxDatabasePassword, std::string auxDatabaseSchema, std::string auxDatabaseTimestampTable, std::string auxDatabaseFailedTable) std::string auxDatabaseFailedTable, std::string selectKey, std::string selectValue) { Configuration::SP c_sp(new Configuration(certificateFile, storagePath, remoteHost, remotePort, remoteUsername, remotePassword, databaseHost, databasePort, databaseUsername, databasePassword, databaseSchema, databaseTable, refreshTime, timeout, recoveryTime, auxDatabaseHost, auxDatabasePort, auxDatabaseUsername, auxDatabasePassword, auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable), Configuration::Deleter()); auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable, selectKey, selectValue), Configuration::Deleter()); return c_sp; } Loading Loading @@ -105,6 +108,8 @@ public: std::string getAuxDatabaseSchema() const { return m_auxDatabaseSchema; } std::string getAuxDatabaseTimestampTable() const { return m_auxDatabaseTimestampTable; } std::string getAuxDatabaseFailedTable() const { return m_auxDatabaseFailedTable; } std::string getSelectKey() const { return m_selectKey; } std::string getSelectValue() const { return m_selectValue; } private: //------------------------------------------------------------------------------ Loading Loading @@ -175,6 +180,12 @@ private: //Auxiliary database failed table const std::string m_auxDatabaseFailedTable; //Files selection key const std::string m_selectKey; //File selection value const std::string m_selectValue; }; } //End of namespace Loading src/DBManager.cpp +25 −7 Original line number Diff line number Diff line Loading @@ -202,11 +202,29 @@ DBManager::FileRowsetSP DBManager::retrieveNewFiles(boost::posix_time::ptime pti if(m_mainSession_sp->get_backend() == NULL) m_mainSession_sp->reconnect(); FileRowsetSP newFileRowset_sp(new FileRowset(m_mainSession_sp->prepare std::string selectKey = m_configuration_sp->getSelectKey(); std::string selectValue = m_configuration_sp->getSelectValue(); FileRowsetSP newFileRowset_sp; if(selectKey.empty()) { newFileRowset_sp.reset(new FileRowset(m_mainSession_sp->prepare << "select storage_path, file_path, file_version, file_name, update_time " << "from " << m_configuration_sp->getDatabaseSchema() << "." << m_configuration_sp->getDatabaseTable() << " where update_time>'" << boost::posix_time::to_iso_string(ptime) << "' order by update_time asc")); } else { newFileRowset_sp.reset(new FileRowset(m_mainSession_sp->prepare << "select storage_path, file_path, file_version, file_name, update_time " << "from " << m_configuration_sp->getDatabaseSchema() << "." << m_configuration_sp->getDatabaseTable() << " where update_time>'" << boost::posix_time::to_iso_string(ptime) << "' and " << selectKey << " like '%" << selectValue << "%' " << "order by update_time asc")); } return newFileRowset_sp; } Loading src/DataImporter.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -238,6 +238,8 @@ void DataImporter::get_device_property() dev_prop.push_back(Tango::DbDatum("AuxDatabaseSchema")); dev_prop.push_back(Tango::DbDatum("AuxDatabaseTimestampTable")); dev_prop.push_back(Tango::DbDatum("AuxDatabaseFailedTable")); dev_prop.push_back(Tango::DbDatum("SelectKey")); dev_prop.push_back(Tango::DbDatum("SelectValue")); // is there at least one property to be read ? if (dev_prop.size()>0) Loading Loading @@ -516,6 +518,28 @@ void DataImporter::get_device_property() // And try to extract AuxDatabaseFailedTable value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> auxDatabaseFailedTable; // Try to initialize SelectKey from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> selectKey; else { // Try to initialize SelectKey from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> selectKey; } // And try to extract SelectKey value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> selectKey; // Try to initialize SelectValue from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> selectValue; else { // Try to initialize SelectValue from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> selectValue; } // And try to extract SelectValue value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> selectValue; } /*----- PROTECTED REGION ID(DataImporter::get_device_property_after) ENABLED START -----*/ Loading Loading @@ -595,12 +619,16 @@ void DataImporter::get_device_property() if(auxDatabaseFailedTable.empty()) throw(invalid_argument("AuxDatabaseFailedTable property is empty or not defined")); if(!selectKey.empty() && selectValue.empty()) throw(invalid_argument("SelectValue property is empty or not defined, but SelectKey is defined")); m_configuration_sp = Configuration::create(certificateFile, storagePath, remoteHost, remotePort, remoteUsername, remotePassword, databaseHost, databasePort, databaseUsername, databasePassword, databaseSchema, databaseTable, refreshTime, timeout, recoveryTime, auxDatabaseHost, auxDatabasePort, auxDatabaseUsername, auxDatabasePassword, auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable); auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable, selectKey, selectValue); } catch(invalid_argument& ex) { Loading @@ -621,7 +649,7 @@ void DataImporter::get_device_property() //-------------------------------------------------------- void DataImporter::always_executed_hook() { DEBUG_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; INFO_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::always_executed_hook) ENABLED START -----*/ if(get_state() != Tango::FAULT) Loading src/DataImporter.h +166 −162 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ public: string auxDatabaseTimestampTable; // AuxDatabaseFailedTable: File transfer auxiliary database failed transfer table string auxDatabaseFailedTable; // SelectKey: Files delivery selection key string selectKey; // SelectValue: Files delivery selection value string selectValue; // Attribute data members public: Loading src/DataImporter.xmi +8 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,14 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <deviceProperties name="SelectKey" description="Files delivery selection key"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <deviceProperties name="SelectValue" description="Files delivery selection value"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> Loading Loading
src/Configuration.h +23 −12 Original line number Diff line number Diff line Loading @@ -28,20 +28,22 @@ private: std::string auxDatabaseHost, unsigned int auxDatabasePort, std::string auxDatabaseUsername, std::string auxDatabasePassword, std::string auxDatabaseSchema, std::string auxDatabaseTimestampTable, std::string auxDatabaseFailedTable) : m_certificateFile (certificateFile), m_storagePath(storagePath), m_remoteHost(remoteHost), m_remotePort(remotePort), m_remoteUsername(remoteUsername), m_remotePassword(remotePassword), m_databaseHost(databaseHost), m_databasePort(databasePort), m_databaseUsername(databaseUsername), m_databasePassword(databasePassword), m_databaseSchema(databaseSchema), m_databaseTable(databaseTable), m_refreshTime(refreshTime), m_timeout(timeout), m_recoveryTime(recoveryTime), std::string auxDatabaseFailedTable, std::string selectKey, std::string selectValue) : m_certificateFile (certificateFile), m_storagePath(storagePath), m_remoteHost(remoteHost), m_remotePort(remotePort), m_remoteUsername(remoteUsername), m_remotePassword(remotePassword), m_databaseHost(databaseHost), m_databasePort(databasePort), m_databaseUsername(databaseUsername), m_databasePassword(databasePassword), m_databaseSchema(databaseSchema), m_databaseTable(databaseTable), m_refreshTime(refreshTime), m_timeout(timeout), m_recoveryTime(recoveryTime), m_auxDatabaseHost(auxDatabaseHost), m_auxDatabasePort(auxDatabasePort), m_auxDatabaseUsername(auxDatabaseUsername), m_auxDatabasePassword(auxDatabasePassword), m_auxDatabaseSchema(auxDatabaseSchema), m_auxDatabaseTimestampTable(auxDatabaseTimestampTable), m_auxDatabaseFailedTable(auxDatabaseFailedTable) { }; m_auxDatabaseFailedTable(auxDatabaseFailedTable), m_selectKey(selectKey), m_selectValue(selectValue) { }; virtual ~Configuration() {} Loading @@ -67,15 +69,16 @@ public: std::string auxDatabaseHost, unsigned int auxDatabasePort, std::string auxDatabaseUsername, std::string auxDatabasePassword, std::string auxDatabaseSchema, std::string auxDatabaseTimestampTable, std::string auxDatabaseFailedTable) std::string auxDatabaseFailedTable, std::string selectKey, std::string selectValue) { Configuration::SP c_sp(new Configuration(certificateFile, storagePath, remoteHost, remotePort, remoteUsername, remotePassword, databaseHost, databasePort, databaseUsername, databasePassword, databaseSchema, databaseTable, refreshTime, timeout, recoveryTime, auxDatabaseHost, auxDatabasePort, auxDatabaseUsername, auxDatabasePassword, auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable), Configuration::Deleter()); auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable, selectKey, selectValue), Configuration::Deleter()); return c_sp; } Loading Loading @@ -105,6 +108,8 @@ public: std::string getAuxDatabaseSchema() const { return m_auxDatabaseSchema; } std::string getAuxDatabaseTimestampTable() const { return m_auxDatabaseTimestampTable; } std::string getAuxDatabaseFailedTable() const { return m_auxDatabaseFailedTable; } std::string getSelectKey() const { return m_selectKey; } std::string getSelectValue() const { return m_selectValue; } private: //------------------------------------------------------------------------------ Loading Loading @@ -175,6 +180,12 @@ private: //Auxiliary database failed table const std::string m_auxDatabaseFailedTable; //Files selection key const std::string m_selectKey; //File selection value const std::string m_selectValue; }; } //End of namespace Loading
src/DBManager.cpp +25 −7 Original line number Diff line number Diff line Loading @@ -202,11 +202,29 @@ DBManager::FileRowsetSP DBManager::retrieveNewFiles(boost::posix_time::ptime pti if(m_mainSession_sp->get_backend() == NULL) m_mainSession_sp->reconnect(); FileRowsetSP newFileRowset_sp(new FileRowset(m_mainSession_sp->prepare std::string selectKey = m_configuration_sp->getSelectKey(); std::string selectValue = m_configuration_sp->getSelectValue(); FileRowsetSP newFileRowset_sp; if(selectKey.empty()) { newFileRowset_sp.reset(new FileRowset(m_mainSession_sp->prepare << "select storage_path, file_path, file_version, file_name, update_time " << "from " << m_configuration_sp->getDatabaseSchema() << "." << m_configuration_sp->getDatabaseTable() << " where update_time>'" << boost::posix_time::to_iso_string(ptime) << "' order by update_time asc")); } else { newFileRowset_sp.reset(new FileRowset(m_mainSession_sp->prepare << "select storage_path, file_path, file_version, file_name, update_time " << "from " << m_configuration_sp->getDatabaseSchema() << "." << m_configuration_sp->getDatabaseTable() << " where update_time>'" << boost::posix_time::to_iso_string(ptime) << "' and " << selectKey << " like '%" << selectValue << "%' " << "order by update_time asc")); } return newFileRowset_sp; } Loading
src/DataImporter.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -238,6 +238,8 @@ void DataImporter::get_device_property() dev_prop.push_back(Tango::DbDatum("AuxDatabaseSchema")); dev_prop.push_back(Tango::DbDatum("AuxDatabaseTimestampTable")); dev_prop.push_back(Tango::DbDatum("AuxDatabaseFailedTable")); dev_prop.push_back(Tango::DbDatum("SelectKey")); dev_prop.push_back(Tango::DbDatum("SelectValue")); // is there at least one property to be read ? if (dev_prop.size()>0) Loading Loading @@ -516,6 +518,28 @@ void DataImporter::get_device_property() // And try to extract AuxDatabaseFailedTable value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> auxDatabaseFailedTable; // Try to initialize SelectKey from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> selectKey; else { // Try to initialize SelectKey from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> selectKey; } // And try to extract SelectKey value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> selectKey; // Try to initialize SelectValue from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> selectValue; else { // Try to initialize SelectValue from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> selectValue; } // And try to extract SelectValue value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> selectValue; } /*----- PROTECTED REGION ID(DataImporter::get_device_property_after) ENABLED START -----*/ Loading Loading @@ -595,12 +619,16 @@ void DataImporter::get_device_property() if(auxDatabaseFailedTable.empty()) throw(invalid_argument("AuxDatabaseFailedTable property is empty or not defined")); if(!selectKey.empty() && selectValue.empty()) throw(invalid_argument("SelectValue property is empty or not defined, but SelectKey is defined")); m_configuration_sp = Configuration::create(certificateFile, storagePath, remoteHost, remotePort, remoteUsername, remotePassword, databaseHost, databasePort, databaseUsername, databasePassword, databaseSchema, databaseTable, refreshTime, timeout, recoveryTime, auxDatabaseHost, auxDatabasePort, auxDatabaseUsername, auxDatabasePassword, auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable); auxDatabaseSchema, auxDatabaseTimestampTable, auxDatabaseFailedTable, selectKey, selectValue); } catch(invalid_argument& ex) { Loading @@ -621,7 +649,7 @@ void DataImporter::get_device_property() //-------------------------------------------------------- void DataImporter::always_executed_hook() { DEBUG_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; INFO_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::always_executed_hook) ENABLED START -----*/ if(get_state() != Tango::FAULT) Loading
src/DataImporter.h +166 −162 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ public: string auxDatabaseTimestampTable; // AuxDatabaseFailedTable: File transfer auxiliary database failed transfer table string auxDatabaseFailedTable; // SelectKey: Files delivery selection key string selectKey; // SelectValue: Files delivery selection value string selectValue; // Attribute data members public: Loading
src/DataImporter.xmi +8 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,14 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <deviceProperties name="SelectKey" description="Files delivery selection key"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <deviceProperties name="SelectValue" description="Files delivery selection value"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> Loading