- Timestamp:
- 2017-02-08T19:08:39+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/colservr/source.cpp
r31387 r31388 25 25 26 26 #include "source.h" 27 #include "colservertools.h" 27 28 #include "fileutil.h" 28 29 #include "OIDtools.h" … … 88 89 } 89 90 90 text_t sourceclass::getcollectionpath()91 {92 text_t resolved_filename;93 94 if (gsdlhome==dbhome) {95 // dbhome has defaulted to gsdlhome which we take to means the96 // database has been specifically moved out of gsdlhome area.97 // => it should be whereever collecthome is set to98 resolved_filename = filename_cat(collecthome, collection);99 }100 else {101 // dbhome is explicitly set to something other than gsdlhome102 // => use dbhome103 resolved_filename = filename_cat(dbhome, "collect", collection);104 }105 106 return resolved_filename;107 }108 109 text_t sourceclass::resolve_db_filename(const text_t& idx,110 const text_t& file_ext)111 {112 // This is an exact copy of the method (of the same name) in filterclass113 // Makes sense to merge them, in which either gsdlhome, collecthome,114 // dbhome, and collection need to also be passed in as parameters,115 // or else there is some notion of a shared base class that both116 // filter and source inherit from117 118 // NB: there is an even greater opportunity to share more code in this119 // function if sql_db_ptr/db_ptr and db_filename and sql_db_filename120 // are also drawn from one object121 122 /*123 text_t resolved_filename;124 125 if (gsdlhome==dbhome) {126 // dbhome has defaulted to gsdlhome which we take to means the127 // database has been specifically moved out of gsdlhome area.128 // => it should be whereever collecthome is set to129 130 resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);131 }132 else {133 // dbhome is explicitly set to something other than gsdlhome134 // => use dbhome135 resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);136 }137 */138 139 text_t resolved_filename = filename_cat(getcollectionpath(), "index", "text", idx);140 resolved_filename += file_ext;141 142 return resolved_filename;143 }144 145 text_t sourceclass::resolve_oaidb_filename(const text_t& file_ext)146 {147 text_t resolved_filename = filename_cat(getcollectionpath(), "etc", "oai-inf");148 149 resolved_filename += file_ext;150 151 return resolved_filename;152 }153 91 154 92 // init should be called after all the configuration is done but … … 204 142 indexstem = collection; 205 143 } 206 db_filename = resolve_db_filename(indexstem, db_ptr->getfileextension()); 144 db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection, 145 indexstem, db_ptr->getfileextension()); 207 146 if (!file_exists(db_filename)) { 208 147 logout << text_t2ascii … … 211 150 } 212 151 213 oaidb_filename = resolve_oaidb_filename(oaidb_ptr->getfileextension()); 152 oaidb_filename = resolve_oaidb_filename(gsdlhome, dbhome, collecthome, collection, 153 oaidb_ptr->getfileextension()); 214 154 215 155 return true;
Note:
See TracChangeset
for help on using the changeset viewer.