overview
cbaWFRepositoryConnector is an abstract base class outlining the interface for Repository connectivity classes.
currently supported derived classes are
- cbaWFRepositoryConnectorPG, shipped in the library libcbaWFRepositoryConnectorPG.so for PostreSQL based repository
- cbaWFRepositoryConnectorMDB, shipped in the library libcbaWFRepositoryConnectorMDB.so for MariaDB based repository
- cbaWFRepositoryConnectorSL, shipped in the library libcbaWFRepositoryConnectorSL.so for Sqlite3 based repository
Derived classes contain a getClass function returning a pointer to the base class cbaWFRepositoryConnector
the calling classes , programs are to implement a method to dynamically load the derived classes from corresponding libraries
class description
base class conforms to the following:
class cbaWFRepositoryConnector
{
public:
cbaWFRepositoryConnector();
virtual ~cbaWFRepositoryConnector();
virtual void setConnectionString(string& connectionString);
virtual void populateNodesInfo(vector<vector<string>>& nodesInfo)=0;
virtual void populateNodes(vector<int>& nodes)=0;
virtual void populateAdjacencyLists(vector<pair<int,int>>& adjacencyLists)=0;
virtual void populateExecutionSchedule(vector<vector<string>>& executionSchedule)=0;
virtual void updateNodesExecutionStatus(map<string,int> & nodeExecutionStatus)=0;
virtual void updateNodeExecutionStatus(string& nodeId,int status)=0;
protected:
string m_connectionString;
};
#include<cbaWFRepositoryConnector.h>
#include <libpq-fe.h>
extern "C" {
cbaWFRepositoryConnector* getClass();
}
class cbaWFRepositoryConnectorPG: public cbaWFRepositoryConnector
{
public:
cbaWFRepositoryConnectorPG();
~cbaWFRepositoryConnectorPG();
void populateNodesInfo(vector<vector<string>>& nodesInfo);
void populateNodes(vector<int>& nodes);
void populateAdjacencyLists(vector<pair<int,int>>& adjacencyLists);
void populateExecutionSchedule(vector<vector<string>>& executionSchedule);
void updateNodesExecutionStatus(map<string,int> & nodeExecutionStatus);
void updateNodeExecutionStatus(string& nodeId,int status);
};
dynamically loading derived classes
cbaWFRepositoryConnector* getRepositoryConnector(string libname)
{
void *connectorso = dlopen(libname.c_str(), RTLD_LAZY);
if(connectorso==0)
{
cout<<dlerror()<<endl;
}
cbaWFRepositoryConnector*(*ptr)()=(cbaWFRepositoryConnector* (*)())dlsym(connectorso,"getClass");
cbaWFRepositoryConnector* connector = (*ptr)();
return connector;
}
repobuilder
repobuilder application is using the information in the cbaWorkflow.ini file to load the appropriate repository connector and create a new repository.
all the tables except for node_types are empty.
node_types table contains information about shipped types of nodes and shared objects needed to load the nodes.
repoexporter
repoexporter application is using the information in the cbaWorkflow.ini file to load the appropriate repository connector and export the tables into csv files.
The following files are created:
- nodes.csv from the contents of nodes table
- adjacency_lists.csv from the contents of adjacency_lists table
- executionSchedule.csv from the contents of the nodes_execution_schedule table
the field separator is determined by the value of the fieldseparator variable in cbaWorkflow.ini
repoimporter
repoimporter application is using the information in the cbaWorkflow.ini file to load the appropriate repository connector and import the tables into the repository from csv files.
A new repository is created in the process of import.
The following tables are populated:
- nodes table from the contents of nodes.csv
- adjacency_lists table from the contents of adjacency_lists.csv
- nodes_execution_schedule table from the contents of the executionSchedule.csv
the field separator is determined by the value of the fieldseparator variable in cbaWorkflow.ini