Commit e840ebd8 authored by Marco De Marco's avatar Marco De Marco
Browse files

DatabaseConnectionNumber property added

parent 6e49555e
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ void MetadataExporter::get_device_property()
	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("DatabaseConnectionNumber"));
	dev_prop.push_back(Tango::DbDatum("ExportedTables"));
	dev_prop.push_back(Tango::DbDatum("AuthorisedUsers"));

@@ -345,6 +346,17 @@ void MetadataExporter::get_device_property()
		//	And try to extract DatabasePassword value from database
		if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  databasePassword;

		//	Try to initialize DatabaseConnectionNumber from class property
		cl_prop = ds_class->get_class_property(dev_prop[++i].name);
		if (cl_prop.is_empty()==false)	cl_prop  >>  databaseConnectionNumber;
		else {
			//	Try to initialize DatabaseConnectionNumber from default device value
			def_prop = ds_class->get_default_device_property(dev_prop[i].name);
			if (def_prop.is_empty()==false)	def_prop  >>  databaseConnectionNumber;
		}
		//	And try to extract DatabaseConnectionNumber value from database
		if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  databaseConnectionNumber;

		//	Try to initialize ExportedTables from class property
		cl_prop = ds_class->get_class_property(dev_prop[++i].name);
		if (cl_prop.is_empty()==false)	cl_prop  >>  exportedTables;
@@ -398,7 +410,7 @@ void MetadataExporter::get_device_property()
            throw(invalid_argument("DatabaseHost property is empty or not defined"));

        if(databasePort<1 || databasePort>MAX_DB_PORT)
            throw(invalid_argument("DatabasePort property is empty or not defined"));
            throw(invalid_argument("DatabasePort property out of range or not defined"));

        if(databaseUsername.empty())
            throw(invalid_argument("DatabaseUsername property is empty or not defined"));
@@ -406,6 +418,9 @@ void MetadataExporter::get_device_property()
        if(databasePassword.empty())
            throw(invalid_argument("DatabasePassword property is empty or not defined"));

        if(databaseConnectionNumber<1 || databaseConnectionNumber>MAX_DB_CONNECTION_NUMBER)
            throw(invalid_argument("DatabaseConnectionNumber property out of range or not defined"));

        if(exportedTables.empty())
            throw(invalid_argument("ExportedTables property is empty or not defined"));

+5 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ protected:
    //Max number of worker thread allowed
    static const unsigned int MAX_WORKER_NUMBER = 100;

    //Max number of database connection allowed
    static const unsigned int MAX_DB_CONNECTION_NUMBER = 100;

    //Max database port number allowed value
    static const unsigned int MAX_DB_PORT = 65535;

@@ -109,6 +112,8 @@ public:
	string	databaseUsername;
	//	DatabasePassword:	Metadata database login password
	string	databasePassword;
	//	DatabaseConnectionNumber:	Number of database connection created
	Tango::DevUShort	databaseConnectionNumber;
	//	ExportedTables:	Tables exporter from database: one table per row
	//  [schema table]
	vector<string>	exportedTables;
+5 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@
      <type xsi:type="pogoDsl:StringType"/>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
    </deviceProperties>
    <deviceProperties name="DatabaseConnectionNumber" description="Number of database connection created">
      <type xsi:type="pogoDsl:UShortType"/>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <DefaultPropValue>2</DefaultPropValue>
    </deviceProperties>
    <deviceProperties name="ExportedTables" description="Tables exporter from database: one table per row&#xA;[schema table]">
      <type xsi:type="pogoDsl:StringVectorType"/>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+52 −38
Original line number Diff line number Diff line
@@ -564,6 +564,20 @@ void MetadataExporterClass::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 = "DatabaseConnectionNumber";
	prop_desc = "Number of database connection created";
	prop_def  = "2";
	vect_data.clear();
	vect_data.push_back("2");
	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 = "ExportedTables";