Commit 4930e321 authored by Marco De Marco's avatar Marco De Marco
Browse files

Storage path property removed

parent 01111a8d
Loading
Loading
Loading
Loading
+8 −14
Original line number Diff line number Diff line
@@ -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;

+2 −47
Original line number Diff line number Diff line
@@ -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
+0 −6
Original line number Diff line number Diff line
@@ -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
};

+0 −4
Original line number Diff line number Diff line
@@ -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"/>
+0 −13
Original line number Diff line number Diff line
@@ -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";