Changeset 31388
- Timestamp:
- 2017-02-08T19:08:39+13:00 (7 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src/colservr
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in
r27063 r31388 145 145 collectserver.cpp \ 146 146 collectset.cpp \ 147 colservertools.cpp \ 147 148 colservrconfig.cpp \ 148 149 comtypes.cpp \ … … 169 170 collectserver.o \ 170 171 collectset.o \ 172 colservertools.o \ 171 173 colservrconfig.o \ 172 174 comtypes.o \ -
main/trunk/greenstone2/runtime-src/src/colservr/browsefilter.cpp
r31387 r31388 25 25 26 26 #include "browsefilter.h" 27 #include "colservertools.h" 27 28 #include "fileutil.h" 28 29 #include <assert.h> … … 87 88 } 88 89 89 db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension()); 90 db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection, 91 indexstem,db_ptr->getfileextension()); 90 92 if (!file_exists(db_filename)) { 91 93 logout << text_t2ascii … … 94 96 } 95 97 96 oaidb_filename = resolve_oaidb_filename(oaidb_ptr->getfileextension()); 98 oaidb_filename = resolve_oaidb_filename(gsdlhome, dbhome, collecthome, collection, 99 oaidb_ptr->getfileextension()); 97 100 98 101 return true; -
main/trunk/greenstone2/runtime-src/src/colservr/filter.cpp
r31387 r31388 61 61 } 62 62 63 text_t filterclass::getcollectionpath()64 {65 text_t resolved_filename;66 67 if (gsdlhome==dbhome) {68 // dbhome has defaulted to gsdlhome which we take to means the69 // database has been specifically moved out of gsdlhome area.70 // => it should be whereever collecthome is set to71 resolved_filename = filename_cat(collecthome, collection);72 }73 else {74 // dbhome is explicitly set to something other than gsdlhome75 // => use dbhome76 resolved_filename = filename_cat(dbhome, "collect", collection);77 }78 79 return resolved_filename;80 }81 82 text_t filterclass::resolve_db_filename(const text_t& idx,83 const text_t& file_ext)84 {85 /*86 text_t resolved_filename;87 88 if (gsdlhome==dbhome) {89 // dbhome has defaulted to gsdlhome which we take to means the90 // database has been specifically moved out of gsdlhome area.91 // => it should be whereever collecthome is set to92 resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);93 }94 else {95 // dbhome is explicitly set to something other than gsdlhome96 // => use dbhome97 resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);98 }99 */100 101 text_t resolved_filename = filename_cat(getcollectionpath(), "index", "text", idx);102 resolved_filename += file_ext;103 104 return resolved_filename;105 }106 107 text_t filterclass::resolve_oaidb_filename(const text_t& file_ext)108 {109 text_t resolved_filename = filename_cat(getcollectionpath(), "etc", "oai-inf");110 111 resolved_filename += file_ext;112 113 return resolved_filename;114 }115 116 63 117 64 // init should be called after all the configuration is done but -
main/trunk/greenstone2/runtime-src/src/colservr/filter.h
r31387 r31388 66 66 FilterResponse_t &response, 67 67 comerror_t &err, ostream &logout); 68 69 protected:70 text_t resolve_db_filename(const text_t& idx,const text_t& file_ext);71 text_t resolve_oaidb_filename(const text_t& file_ext);72 text_t getcollectionpath();73 68 74 69 }; -
main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.cpp
r27084 r31388 25 25 26 26 #include "queryfilter.h" 27 #include "colservertools.h" 27 28 #include "fileutil.h" 28 29 … … 253 254 indexstem = collection; 254 255 } 255 db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension()); 256 db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection, 257 indexstem,db_ptr->getfileextension()); 256 258 if (!file_exists(db_filename)) { 257 259 logout << text_t2ascii -
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; -
main/trunk/greenstone2/runtime-src/src/colservr/source.h
r31387 r31388 109 109 virtual bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout); 110 110 111 protected:112 text_t resolve_db_filename(const text_t& idx,113 const text_t& file_ext);114 text_t resolve_oaidb_filename(const text_t& file_ext);115 text_t getcollectionpath();116 117 111 }; 118 112 -
main/trunk/greenstone2/runtime-src/src/colservr/sqlfilter.cpp
r22049 r31388 26 26 27 27 #include "fileutil.h" 28 #include "colservertools.h" 28 29 #include "sqlfilter.h" 29 30 … … 67 68 68 69 // get the filename for the database and make sure it exists 69 sql_db_filename = resolve_db_filename(indexstem,sql_db_ptr->getfileextension()); 70 sql_db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection, 71 indexstem,sql_db_ptr->getfileextension()); 70 72 if (!file_exists(sql_db_filename)) 71 73 {
Note:
See TracChangeset
for help on using the changeset viewer.