38 void OPENTREP_ServiceContext::
39 updateXapianAndSQLDBConnectionWithDeploymentNumber() {
47 std::ostringstream oStr;
48 oStr << _sqlDBConnectionStringWPfxDBName;
49 oStr << _deploymentNumber;
50 _sqlDBConnectionString = SQLDBConnectionString_T (oStr.str());
68 const SQLDBConnectionString_T& lSQLDBConnStr =
72 _sqlDBConnectionString = lSQLDBConnStr;
78 std::ostringstream oStr;
79 oStr << _travelDBFilePathPrefix;
80 oStr << _deploymentNumber;
81 _travelDBFilePath = TravelDBFilePath_T (oStr.str());
85 OPENTREP_ServiceContext::OPENTREP_ServiceContext()
101 OPENTREP_ServiceContext::
102 OPENTREP_ServiceContext (
const TravelDBFilePath_T& iTravelDBFilePath,
103 const DBType& iSQLDBType,
104 const SQLDBConnectionString_T& iSQLDBConnStr,
105 const DeploymentNumber_T& iDeploymentNumber)
108 _deploymentNumber (iDeploymentNumber),
109 _travelDBFilePathPrefix (iTravelDBFilePath),
110 _travelDBFilePath (iTravelDBFilePath), _sqlDBType (iSQLDBType),
111 _sqlDBConnectionStringWPfxDBName (iSQLDBConnStr),
112 _sqlDBConnectionString (iSQLDBConnStr),
116 updateXapianAndSQLDBConnectionWithDeploymentNumber();
120 OPENTREP_ServiceContext::
121 OPENTREP_ServiceContext (
const PORFilePath_T& iPORFilePath,
122 const TravelDBFilePath_T& iTravelDBFilePath,
123 const DBType& iSQLDBType,
124 const SQLDBConnectionString_T& iSQLDBConnStr,
125 const DeploymentNumber_T& iDeploymentNumber,
126 const shouldIndexNonIATAPOR_T& iShouldIndexNonIATAPOR,
127 const shouldIndexPORInXapian_T& iShouldIdxPORInXapian,
128 const shouldAddPORInSQLDB_T& iShouldAddPORInSQLDB)
129 : _world (NULL), _porFilePath (iPORFilePath),
130 _deploymentNumber (iDeploymentNumber),
131 _travelDBFilePathPrefix (iTravelDBFilePath),
132 _travelDBFilePath (iTravelDBFilePath), _sqlDBType (iSQLDBType),
133 _sqlDBConnectionStringWPfxDBName (iSQLDBConnStr),
134 _sqlDBConnectionString (iSQLDBConnStr),
135 _shouldIndexNonIATAPOR (iShouldIndexNonIATAPOR),
136 _shouldIndexPORInXapian (iShouldIdxPORInXapian),
137 _shouldAddPORInSQLDB (iShouldAddPORInSQLDB) {
138 updateXapianAndSQLDBConnectionWithDeploymentNumber();
142 OPENTREP_ServiceContext::~OPENTREP_ServiceContext() {
147 assert (_world != NULL);
153 std::ostringstream oStr;
154 oStr <<
"OPENTREP_ServiceContext: "
155 <<
"file-path of the POR file: " << _porFilePath
156 <<
"; deployment number/version: " << _deploymentNumber
157 <<
"; Directory prefix of Xapian index/database: "
158 << _travelDBFilePathPrefix
159 <<
"; Actual directory of Xapian index/database: " << _travelDBFilePath
160 <<
"; SQL database (" << _sqlDBType.describe()
161 <<
") connection string with DB name prefix: "
162 << _sqlDBConnectionStringWPfxDBName
163 <<
"); Connection string with actual DB name: "
164 << _sqlDBConnectionString
165 <<
"; should include non-IATA POR: " << _shouldIndexNonIATAPOR
166 <<
"; should index POR in Xapian: " << _shouldIndexPORInXapian
167 <<
"; should insert POR into the SQL DB: " << _shouldAddPORInSQLDB
174 std::ostringstream oStr;
176 if (_world != NULL) {
177 oStr << _world->display();
World & getWorldHandler() const
const std::string shortDisplay() const
const std::string display() const
const std::string DEFAULT_OPENTREP_SQLITE_DB_FILEPATH
SQLDBConnectionString_T buildMySQLConnectionString(const StringMap_T &iStringMap, const DeploymentNumber_T &iDeploymentNumber)
const bool DEFAULT_OPENTREP_INCLUDE_NONIATA_POR
const std::string DEFAULT_OPENTREP_SQL_DB_TYPE
StringMap_T parseMySQLConnectionString(const SQLDBConnectionString_T &iSQLDBConnStr)
const bool DEFAULT_OPENTREP_INDEX_IN_XAPIAN
const unsigned short DEFAULT_OPENTREP_DEPLOYMENT_NUMBER
const std::string DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH
const bool DEFAULT_OPENTREP_ADD_IN_DB
const std::string DEFAULT_OPENTREP_POR_FILEPATH
std::map< const std::string, std::string > StringMap_T