Loading Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ CXX_DEBUG_FLAGS=-g -DVERBOSE_DEBUG CXX_RELEASE_FLAGS=-O3 CXX_DEFAULT_FLAGS=-c -Wall -Wextra -std=c++11 -std=gnu++11 LDFLAGS=-Wall -lomniORB4 -lomniDynamic4 -lCOS4 -lomnithread -ltango -llog4tango \ -lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lprotobuf -lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lprotobuf -lssl INC_PARM=$(foreach d, $(INC_DIR), -I$d) LIB_PARM=$(foreach d, $(LIB_DIR), -L$d) PROTOC :=/usr/local/protobuf-2.5.0/bin/protoc Loading Loading @@ -59,7 +59,7 @@ release: $(EXECUTABLE) debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS) $(CXX_DEFAULT_FLAGS) debug: $(EXECUTABLE) $(EXECUTABLE): makedir protoc $(OBJ_FILES) $(EXECUTABLE): makedir $(OBJ_FILES) $(CC) $(LDFLAGS) $(LIB_PARM) -o $@ $(OBJ_FILES) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp Loading proto/Request.proto 0 → 100644 +36 −0 Original line number Diff line number Diff line package MetadataImporter_ns; message Request { //Request type descriptor enum Type { AUTHORIZATION = 0; METADATA = 1; } required Type type = 1; //Authorization request message Authorization { required string username = 1; required string password = 2; } optional Authorization authorization = 2; //Metadata update request message Metadata { required string schema = 1; required string table = 2; required sfixed64 timestamp = 3; } optional Metadata metadata = 5; } proto/Response.proto 0 → 100644 +95 −0 Original line number Diff line number Diff line package MetadataImporter_ns; message Response { //Response type descriptor enum Type { AUTHORIZATION = 0; METADATA = 1; } required Type type = 1; //Authorization response message Authorization { enum Status { ACCEPTED = 0; REJECTED = 1; } required Status status = 1; } optional Authorization authorization = 2; //Metadata tuple container message Metadata { //Metadata response status enum Status { ACCEPTED = 0; REJECTED = 1; } required Status status = 1; //Mysql: FLOAT, DOUBLE, DECIMAL //SOCI: dt_double //C++: double message DtDouble { required string key = 1; required double value = 2; } repeated DtDouble double_list = 2; //Mysql: TINYINT, SMALLINT, INT, BIGINT //SOCI: dt_integer //C++: int message DtInteger { required string key = 1; required int64 value = 2; } repeated DtInteger integer_list = 3; //Mysql: STRING/BINARY, VARCHAR/VARBINARY //SOCI: dt_string //C++: string message DtString { required string key = 1; required string value = 2; } repeated DtString strings_list = 4; //Mysql: TIMESTAMP DATE, TIME, DATETIME //SOCI: dt_date //C++: tm message DtDate { required string key = 1; required sfixed64 value = 2; } repeated DtDate date_list = 5; } optional Metadata metadata = 3; } src/MetadataImporter.cpp +163 −20 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ void MetadataImporter::init_device() { try { Configuration::SP configuration_sp = Configuration::create(address, port, certificateFile); Configuration::SP configuration_sp = Configuration::create(remoteHost, remotePort, certificateFile); if(enableSSL) m_client_sp = SSLClient::create(this, configuration_sp); Loading Loading @@ -196,9 +196,19 @@ void MetadataImporter::get_device_property() // Read device properties from database. Tango::DbData dev_prop; dev_prop.push_back(Tango::DbDatum("CertificateFile")); dev_prop.push_back(Tango::DbDatum("Address")); dev_prop.push_back(Tango::DbDatum("Port")); dev_prop.push_back(Tango::DbDatum("RemoteHost")); dev_prop.push_back(Tango::DbDatum("RemotePort")); dev_prop.push_back(Tango::DbDatum("RemoteUsername")); dev_prop.push_back(Tango::DbDatum("RemotePassword")); dev_prop.push_back(Tango::DbDatum("EnableSSL")); dev_prop.push_back(Tango::DbDatum("DatabaseHost")); dev_prop.push_back(Tango::DbDatum("DatabasePort")); dev_prop.push_back(Tango::DbDatum("DatabaseUsername")); dev_prop.push_back(Tango::DbDatum("DatabasePassword")); dev_prop.push_back(Tango::DbDatum("DatabaseSchema")); dev_prop.push_back(Tango::DbDatum("DatabaseTable")); dev_prop.push_back(Tango::DbDatum("RefreshTime")); dev_prop.push_back(Tango::DbDatum("Timeout")); // is there at least one property to be read ? if (dev_prop.size()>0) Loading @@ -224,27 +234,49 @@ void MetadataImporter::get_device_property() // And try to extract CertificateFile value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> certificateFile; // Try to initialize Address from class property // Try to initialize RemoteHost from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> address; if (cl_prop.is_empty()==false) cl_prop >> remoteHost; else { // Try to initialize Address from default device value // Try to initialize RemoteHost from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> address; if (def_prop.is_empty()==false) def_prop >> remoteHost; } // And try to extract Address value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> address; // And try to extract RemoteHost value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remoteHost; // Try to initialize Port from class property // Try to initialize RemotePort from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> port; if (cl_prop.is_empty()==false) cl_prop >> remotePort; else { // Try to initialize Port from default device value // Try to initialize RemotePort from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> port; if (def_prop.is_empty()==false) def_prop >> remotePort; } // And try to extract Port value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> port; // And try to extract RemotePort value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remotePort; // Try to initialize RemoteUsername from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> remoteUsername; else { // Try to initialize RemoteUsername from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> remoteUsername; } // And try to extract RemoteUsername value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remoteUsername; // Try to initialize RemotePassword from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> remotePassword; else { // Try to initialize RemotePassword from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> remotePassword; } // And try to extract RemotePassword value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remotePassword; // Try to initialize EnableSSL from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); Loading @@ -257,20 +289,132 @@ void MetadataImporter::get_device_property() // And try to extract EnableSSL value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> enableSSL; // Try to initialize DatabaseHost from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseHost; else { // Try to initialize DatabaseHost from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseHost; } // And try to extract DatabaseHost value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseHost; // Try to initialize DatabasePort from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databasePort; else { // Try to initialize DatabasePort from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databasePort; } // And try to extract DatabasePort value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databasePort; // Try to initialize DatabaseUsername from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseUsername; else { // Try to initialize DatabaseUsername from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseUsername; } // And try to extract DatabaseUsername value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseUsername; // Try to initialize DatabasePassword from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databasePassword; else { // Try to initialize DatabasePassword from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databasePassword; } // And try to extract DatabasePassword value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databasePassword; // Try to initialize DatabaseSchema from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseSchema; else { // Try to initialize DatabaseSchema from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseSchema; } // And try to extract DatabaseSchema value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseSchema; // Try to initialize DatabaseTable from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseTable; else { // Try to initialize DatabaseTable from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseTable; } // And try to extract DatabaseTable value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseTable; // Try to initialize RefreshTime from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> refreshTime; else { // Try to initialize RefreshTime from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> refreshTime; } // And try to extract RefreshTime value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> refreshTime; // Try to initialize Timeout from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> timeout; else { // Try to initialize Timeout from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> timeout; } // And try to extract Timeout value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> timeout; } /*----- PROTECTED REGION ID(MetadataImporter::get_device_property_after) ENABLED START -----*/ try { if(address.empty()) throw(invalid_argument("Address property is empty or not defined")); if(remoteHost.empty()) throw(invalid_argument("RemoteHost property is empty or not defined")); if(remotePort<1 || remotePort>MAX_REMOTE_PORT) throw(invalid_argument("RemotePort property out of range or not defined")); if(remoteUsername.empty()) throw(invalid_argument("RemoteUsername property is empty or not defined")); if(port<1 || port>MAX_DMDB_PORT) throw(invalid_argument("Port property out of range or not defined")); if(remotePassword.empty()) throw(invalid_argument("RemotePassword property is empty or not defined")); if(enableSSL && certificateFile.empty()) throw(invalid_argument("CertificateFile property is empty or not defined")); if(databaseHost.empty()) throw(invalid_argument("DatabaseHost property is empty or not defined")); if(databasePort<1 || databasePort>MAX_DATABASE_PORT) throw(invalid_argument("DatabasePort property out of range or not defined")); if(databaseUsername.empty()) throw(invalid_argument("DatabaseUsername property is empty or not defined")); if(databasePassword.empty()) throw(invalid_argument("DatabasePassword property is empty or not defined")); if(databaseSchema.empty()) throw(invalid_argument("DatabaseSchema property is empty or not defined")); if(databaseTable.empty()) throw(invalid_argument("DatabaseTable property is empty or not defined")); } catch(invalid_argument& ex) { Loading Loading @@ -370,7 +514,6 @@ void MetadataImporter::on() set_status("MetadataImporter::On() unknown error"); } /*----- PROTECTED REGION END -----*/ // MetadataImporter::on } //-------------------------------------------------------- Loading src/MetadataImporter.h +29 −6 Original line number Diff line number Diff line Loading @@ -68,8 +68,11 @@ class MetadataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Max port number allowed value static const unsigned int MAX_DMDB_PORT = 65535; //Max port number allowed value for remote connection static const unsigned int MAX_REMOTE_PORT = 65535; //Max port number allowed value for local database static const unsigned int MAX_DATABASE_PORT = 65535; /*----- PROTECTED REGION END -----*/ // MetadataImporter::Data Members Loading @@ -77,12 +80,32 @@ class MetadataImporter : public TANGO_BASE_CLASS public: // CertificateFile: Absolute path to certificate chain file string certificateFile; // Address: Remote connection address string address; // Port: Remote connection port Tango::DevULong port; // RemoteHost: Metadata exporter remote host string remoteHost; // RemotePort: Metadata exporter remote port Tango::DevULong remotePort; // RemoteUsername: Metadata exporter login username string remoteUsername; // RemotePassword: Metadata exporter remote password string remotePassword; // EnableSSL: Enable or disable SSL connections Tango::DevBoolean enableSSL; // DatabaseHost: Metadata local database host string databaseHost; // DatabasePort: Metadata local database port Tango::DevULong databasePort; // DatabaseUsername: Metadata local database username string databaseUsername; // DatabasePassword: Metadata local database password string databasePassword; // DatabaseSchema: Metadata local database schema string databaseSchema; // DatabaseTable: Metadata local database table string databaseTable; // RefreshTime: Remote database request period (ms) Tango::DevULong refreshTime; // Timeout: Connection timeout (ms) Tango::DevULong timeout; // Constructors and destructors Loading Loading
Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ CXX_DEBUG_FLAGS=-g -DVERBOSE_DEBUG CXX_RELEASE_FLAGS=-O3 CXX_DEFAULT_FLAGS=-c -Wall -Wextra -std=c++11 -std=gnu++11 LDFLAGS=-Wall -lomniORB4 -lomniDynamic4 -lCOS4 -lomnithread -ltango -llog4tango \ -lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lprotobuf -lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lprotobuf -lssl INC_PARM=$(foreach d, $(INC_DIR), -I$d) LIB_PARM=$(foreach d, $(LIB_DIR), -L$d) PROTOC :=/usr/local/protobuf-2.5.0/bin/protoc Loading Loading @@ -59,7 +59,7 @@ release: $(EXECUTABLE) debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS) $(CXX_DEFAULT_FLAGS) debug: $(EXECUTABLE) $(EXECUTABLE): makedir protoc $(OBJ_FILES) $(EXECUTABLE): makedir $(OBJ_FILES) $(CC) $(LDFLAGS) $(LIB_PARM) -o $@ $(OBJ_FILES) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp Loading
proto/Request.proto 0 → 100644 +36 −0 Original line number Diff line number Diff line package MetadataImporter_ns; message Request { //Request type descriptor enum Type { AUTHORIZATION = 0; METADATA = 1; } required Type type = 1; //Authorization request message Authorization { required string username = 1; required string password = 2; } optional Authorization authorization = 2; //Metadata update request message Metadata { required string schema = 1; required string table = 2; required sfixed64 timestamp = 3; } optional Metadata metadata = 5; }
proto/Response.proto 0 → 100644 +95 −0 Original line number Diff line number Diff line package MetadataImporter_ns; message Response { //Response type descriptor enum Type { AUTHORIZATION = 0; METADATA = 1; } required Type type = 1; //Authorization response message Authorization { enum Status { ACCEPTED = 0; REJECTED = 1; } required Status status = 1; } optional Authorization authorization = 2; //Metadata tuple container message Metadata { //Metadata response status enum Status { ACCEPTED = 0; REJECTED = 1; } required Status status = 1; //Mysql: FLOAT, DOUBLE, DECIMAL //SOCI: dt_double //C++: double message DtDouble { required string key = 1; required double value = 2; } repeated DtDouble double_list = 2; //Mysql: TINYINT, SMALLINT, INT, BIGINT //SOCI: dt_integer //C++: int message DtInteger { required string key = 1; required int64 value = 2; } repeated DtInteger integer_list = 3; //Mysql: STRING/BINARY, VARCHAR/VARBINARY //SOCI: dt_string //C++: string message DtString { required string key = 1; required string value = 2; } repeated DtString strings_list = 4; //Mysql: TIMESTAMP DATE, TIME, DATETIME //SOCI: dt_date //C++: tm message DtDate { required string key = 1; required sfixed64 value = 2; } repeated DtDate date_list = 5; } optional Metadata metadata = 3; }
src/MetadataImporter.cpp +163 −20 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ void MetadataImporter::init_device() { try { Configuration::SP configuration_sp = Configuration::create(address, port, certificateFile); Configuration::SP configuration_sp = Configuration::create(remoteHost, remotePort, certificateFile); if(enableSSL) m_client_sp = SSLClient::create(this, configuration_sp); Loading Loading @@ -196,9 +196,19 @@ void MetadataImporter::get_device_property() // Read device properties from database. Tango::DbData dev_prop; dev_prop.push_back(Tango::DbDatum("CertificateFile")); dev_prop.push_back(Tango::DbDatum("Address")); dev_prop.push_back(Tango::DbDatum("Port")); dev_prop.push_back(Tango::DbDatum("RemoteHost")); dev_prop.push_back(Tango::DbDatum("RemotePort")); dev_prop.push_back(Tango::DbDatum("RemoteUsername")); dev_prop.push_back(Tango::DbDatum("RemotePassword")); dev_prop.push_back(Tango::DbDatum("EnableSSL")); dev_prop.push_back(Tango::DbDatum("DatabaseHost")); dev_prop.push_back(Tango::DbDatum("DatabasePort")); dev_prop.push_back(Tango::DbDatum("DatabaseUsername")); dev_prop.push_back(Tango::DbDatum("DatabasePassword")); dev_prop.push_back(Tango::DbDatum("DatabaseSchema")); dev_prop.push_back(Tango::DbDatum("DatabaseTable")); dev_prop.push_back(Tango::DbDatum("RefreshTime")); dev_prop.push_back(Tango::DbDatum("Timeout")); // is there at least one property to be read ? if (dev_prop.size()>0) Loading @@ -224,27 +234,49 @@ void MetadataImporter::get_device_property() // And try to extract CertificateFile value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> certificateFile; // Try to initialize Address from class property // Try to initialize RemoteHost from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> address; if (cl_prop.is_empty()==false) cl_prop >> remoteHost; else { // Try to initialize Address from default device value // Try to initialize RemoteHost from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> address; if (def_prop.is_empty()==false) def_prop >> remoteHost; } // And try to extract Address value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> address; // And try to extract RemoteHost value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remoteHost; // Try to initialize Port from class property // Try to initialize RemotePort from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> port; if (cl_prop.is_empty()==false) cl_prop >> remotePort; else { // Try to initialize Port from default device value // Try to initialize RemotePort from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> port; if (def_prop.is_empty()==false) def_prop >> remotePort; } // And try to extract Port value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> port; // And try to extract RemotePort value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remotePort; // Try to initialize RemoteUsername from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> remoteUsername; else { // Try to initialize RemoteUsername from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> remoteUsername; } // And try to extract RemoteUsername value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remoteUsername; // Try to initialize RemotePassword from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> remotePassword; else { // Try to initialize RemotePassword from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> remotePassword; } // And try to extract RemotePassword value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> remotePassword; // Try to initialize EnableSSL from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); Loading @@ -257,20 +289,132 @@ void MetadataImporter::get_device_property() // And try to extract EnableSSL value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> enableSSL; // Try to initialize DatabaseHost from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseHost; else { // Try to initialize DatabaseHost from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseHost; } // And try to extract DatabaseHost value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseHost; // Try to initialize DatabasePort from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databasePort; else { // Try to initialize DatabasePort from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databasePort; } // And try to extract DatabasePort value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databasePort; // Try to initialize DatabaseUsername from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseUsername; else { // Try to initialize DatabaseUsername from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseUsername; } // And try to extract DatabaseUsername value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseUsername; // Try to initialize DatabasePassword from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databasePassword; else { // Try to initialize DatabasePassword from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databasePassword; } // And try to extract DatabasePassword value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databasePassword; // Try to initialize DatabaseSchema from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseSchema; else { // Try to initialize DatabaseSchema from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseSchema; } // And try to extract DatabaseSchema value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseSchema; // Try to initialize DatabaseTable from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> databaseTable; else { // Try to initialize DatabaseTable from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> databaseTable; } // And try to extract DatabaseTable value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseTable; // Try to initialize RefreshTime from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> refreshTime; else { // Try to initialize RefreshTime from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> refreshTime; } // And try to extract RefreshTime value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> refreshTime; // Try to initialize Timeout from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> timeout; else { // Try to initialize Timeout from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> timeout; } // And try to extract Timeout value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> timeout; } /*----- PROTECTED REGION ID(MetadataImporter::get_device_property_after) ENABLED START -----*/ try { if(address.empty()) throw(invalid_argument("Address property is empty or not defined")); if(remoteHost.empty()) throw(invalid_argument("RemoteHost property is empty or not defined")); if(remotePort<1 || remotePort>MAX_REMOTE_PORT) throw(invalid_argument("RemotePort property out of range or not defined")); if(remoteUsername.empty()) throw(invalid_argument("RemoteUsername property is empty or not defined")); if(port<1 || port>MAX_DMDB_PORT) throw(invalid_argument("Port property out of range or not defined")); if(remotePassword.empty()) throw(invalid_argument("RemotePassword property is empty or not defined")); if(enableSSL && certificateFile.empty()) throw(invalid_argument("CertificateFile property is empty or not defined")); if(databaseHost.empty()) throw(invalid_argument("DatabaseHost property is empty or not defined")); if(databasePort<1 || databasePort>MAX_DATABASE_PORT) throw(invalid_argument("DatabasePort property out of range or not defined")); if(databaseUsername.empty()) throw(invalid_argument("DatabaseUsername property is empty or not defined")); if(databasePassword.empty()) throw(invalid_argument("DatabasePassword property is empty or not defined")); if(databaseSchema.empty()) throw(invalid_argument("DatabaseSchema property is empty or not defined")); if(databaseTable.empty()) throw(invalid_argument("DatabaseTable property is empty or not defined")); } catch(invalid_argument& ex) { Loading Loading @@ -370,7 +514,6 @@ void MetadataImporter::on() set_status("MetadataImporter::On() unknown error"); } /*----- PROTECTED REGION END -----*/ // MetadataImporter::on } //-------------------------------------------------------- Loading
src/MetadataImporter.h +29 −6 Original line number Diff line number Diff line Loading @@ -68,8 +68,11 @@ class MetadataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Max port number allowed value static const unsigned int MAX_DMDB_PORT = 65535; //Max port number allowed value for remote connection static const unsigned int MAX_REMOTE_PORT = 65535; //Max port number allowed value for local database static const unsigned int MAX_DATABASE_PORT = 65535; /*----- PROTECTED REGION END -----*/ // MetadataImporter::Data Members Loading @@ -77,12 +80,32 @@ class MetadataImporter : public TANGO_BASE_CLASS public: // CertificateFile: Absolute path to certificate chain file string certificateFile; // Address: Remote connection address string address; // Port: Remote connection port Tango::DevULong port; // RemoteHost: Metadata exporter remote host string remoteHost; // RemotePort: Metadata exporter remote port Tango::DevULong remotePort; // RemoteUsername: Metadata exporter login username string remoteUsername; // RemotePassword: Metadata exporter remote password string remotePassword; // EnableSSL: Enable or disable SSL connections Tango::DevBoolean enableSSL; // DatabaseHost: Metadata local database host string databaseHost; // DatabasePort: Metadata local database port Tango::DevULong databasePort; // DatabaseUsername: Metadata local database username string databaseUsername; // DatabasePassword: Metadata local database password string databasePassword; // DatabaseSchema: Metadata local database schema string databaseSchema; // DatabaseTable: Metadata local database table string databaseTable; // RefreshTime: Remote database request period (ms) Tango::DevULong refreshTime; // Timeout: Connection timeout (ms) Tango::DevULong timeout; // Constructors and destructors Loading