42 void OPENTREP_ServiceContext::
43 updateXapianAndSQLDBConnectionWithDeploymentNumber() {
51 std::ostringstream oStr;
52 oStr << _sqlDBConnectionStringWPfxDBName;
53 oStr << _deploymentNumber;
54 _sqlDBConnectionString = SQLDBConnectionString_T (oStr.str());
72 const SQLDBConnectionString_T& lSQLDBConnStr =
76 _sqlDBConnectionString = lSQLDBConnStr;
91 const SQLDBConnectionString_T& lSQLDBConnStr =
95 _sqlDBConnectionString = lSQLDBConnStr;
101 std::ostringstream oStr;
102 oStr << _travelDBFilePathPrefix;
103 oStr << _deploymentNumber;
104 _travelDBFilePath = TravelDBFilePath_T (oStr.str());
108 OPENTREP_ServiceContext::OPENTREP_ServiceContext()
124 OPENTREP_ServiceContext::
125 OPENTREP_ServiceContext (
const TravelDBFilePath_T& iTravelDBFilePath,
126 const DBType& iSQLDBType,
127 const SQLDBConnectionString_T& iSQLDBConnStr,
128 const DeploymentNumber_T& iDeploymentNumber)
131 _deploymentNumber (iDeploymentNumber),
132 _travelDBFilePathPrefix (iTravelDBFilePath),
133 _travelDBFilePath (iTravelDBFilePath), _sqlDBType (iSQLDBType),
134 _sqlDBConnectionStringWPfxDBName (iSQLDBConnStr),
135 _sqlDBConnectionString (iSQLDBConnStr),
139 updateXapianAndSQLDBConnectionWithDeploymentNumber();
143 OPENTREP_ServiceContext::
144 OPENTREP_ServiceContext (
const PORFilePath_T& iPORFilePath,
145 const TravelDBFilePath_T& iTravelDBFilePath,
146 const DBType& iSQLDBType,
147 const SQLDBConnectionString_T& iSQLDBConnStr,
148 const DeploymentNumber_T& iDeploymentNumber,
149 const shouldIndexNonIATAPOR_T& iShouldIndexNonIATAPOR,
150 const shouldIndexPORInXapian_T& iShouldIdxPORInXapian,
151 const shouldAddPORInSQLDB_T& iShouldAddPORInSQLDB)
152 : _world (NULL), _porFilePath (iPORFilePath),
153 _deploymentNumber (iDeploymentNumber),
154 _travelDBFilePathPrefix (iTravelDBFilePath),
155 _travelDBFilePath (iTravelDBFilePath), _sqlDBType (iSQLDBType),
156 _sqlDBConnectionStringWPfxDBName (iSQLDBConnStr),
157 _sqlDBConnectionString (iSQLDBConnStr),
158 _shouldIndexNonIATAPOR (iShouldIndexNonIATAPOR),
159 _shouldIndexPORInXapian (iShouldIdxPORInXapian),
160 _shouldAddPORInSQLDB (iShouldAddPORInSQLDB) {
161 updateXapianAndSQLDBConnectionWithDeploymentNumber();
165 OPENTREP_ServiceContext::~OPENTREP_ServiceContext() {
170 assert (_world != NULL);
176 std::ostringstream oStr;
177 oStr <<
"OPENTREP_ServiceContext: "
178 <<
"file-path of the POR file: " << _porFilePath
179 <<
"; deployment number/version: " << _deploymentNumber
180 <<
"; Directory prefix of Xapian index/database: "
181 << _travelDBFilePathPrefix
182 <<
"; Actual directory of Xapian index/database: " << _travelDBFilePath
183 <<
"; SQL database (" << _sqlDBType.describe()
184 <<
") connection string with DB name prefix: "
185 << _sqlDBConnectionStringWPfxDBName
186 <<
"); Connection string with actual DB name: "
187 << _sqlDBConnectionString
188 <<
"; should include non-IATA POR: " << _shouldIndexNonIATAPOR
189 <<
"; should index POR in Xapian: " << _shouldIndexPORInXapian
190 <<
"; should insert POR into the SQL DB: " << _shouldAddPORInSQLDB
197 std::ostringstream oStr;
199 if (_world != NULL) {
200 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)
SQLDBConnectionString_T buildPGConnectionString(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
StringMap_T parsePGConnectionString(const SQLDBConnectionString_T &iSQLDBConnStr)
const bool DEFAULT_OPENTREP_ADD_IN_DB
const std::string DEFAULT_OPENTREP_POR_FILEPATH
std::map< const std::string, std::string > StringMap_T