Changeset 15584
- Timestamp:
- 2008-05-20T10:22:16+12:00 (16 years ago)
- Location:
- gsdl/trunk/src/colservr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/colservr/collectset.cpp
r15558 r15584 29 29 #include "colservrconfig.h" 30 30 #include "gsdlsitecfg.h" 31 #include "gdbmclass.h" 31 32 #include "filter.h" 32 33 #include "browsefilter.h" … … 239 240 // add a mg and gdbm source 240 241 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 241 mggdbmsource->set_ gdbmptr (gdbmhandler);242 mggdbmsource->set_db_ptr (gdbmhandler); 242 243 mggdbmsource->set_textsearchptr (mgsearch); 243 244 cserver->add_source (mggdbmsource); … … 254 255 // add a mg and gdbm source 255 256 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 256 mggdbmsource->set_ gdbmptr (gdbmhandler);257 mggdbmsource->set_db_ptr (gdbmhandler); 257 258 mggdbmsource->set_textsearchptr (mgppsearch); 258 259 cserver->add_source (mggdbmsource); … … 270 271 // add a lucene and gdbm source 271 272 lucenegdbmsourceclass *lucenegdbmsource = new lucenegdbmsourceclass (); 272 lucenegdbmsource->set_ gdbmptr (gdbmhandler);273 lucenegdbmsource->set_db_ptr (gdbmhandler); 273 274 lucenegdbmsource->set_textsearchptr (lucenesearch); 274 275 cserver->add_source (lucenegdbmsource); -
gsdl/trunk/src/colservr/gdbmsource.cpp
r13780 r15584 31 31 32 32 gdbmsourceclass::gdbmsourceclass () { 33 gdbmptr = NULL;33 db_ptr = NULL; 34 34 textsearchptr = NULL; 35 35 classname = "gdbmsource"; … … 37 37 38 38 gdbmsourceclass::~gdbmsourceclass () { 39 if ( gdbmptr != NULL) delete gdbmptr;39 if (db_ptr != NULL) delete db_ptr; 40 40 if (textsearchptr != NULL) delete textsearchptr; 41 41 } … … 117 117 indexstem = collection; 118 118 } 119 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem);120 if (littleEndian()) gdbm_filename += ".ldb";121 else gdbm_filename += ".bdb";122 123 if (!file_exists( gdbm_filename)) {119 db_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem); 120 if (littleEndian()) db_filename += ".ldb"; 121 else db_filename += ".bdb"; 122 123 if (!file_exists(db_filename)) { 124 124 logout << text_t2ascii 125 << "warning: gdbm database \"" //**** 126 << gdbm_filename << "\" does not exist\n\n"; 127 // return false; //**** 125 << "warning: database \"" << db_filename << "\" does not exist\n\n"; 126 // return false; 128 127 } 129 128 … … 137 136 138 137 err = noError; 139 if ( gdbmptr == NULL) {138 if (db_ptr == NULL) { 140 139 // most likely a configuration problem 141 140 logout << text_t2ascii 142 << "configuration error: " << classname << " contains a null gdbmclass\n\n";141 << "configuration error: " << classname << " contains a null dbclass\n\n"; 143 142 err = configurationError; 144 143 return true; … … 146 145 147 146 // open the database 148 gdbmptr->setlogout(&logout); 149 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 150 // most likely a system problem (we have already checked that the 151 // gdbm database exists) 147 db_ptr->setlogout(&logout); 148 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 149 // most likely a system problem (we have already checked that the database exists) 152 150 logout << text_t2ascii 153 << "system problem: open on gdbm database \"" 154 << gdbm_filename << "\" failed\n\n"; 151 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 155 152 err = systemProblem; 156 153 return true; … … 158 155 159 156 infodbclass info; 160 OIDout = gdbmptr->translate_OID (OIDin, info);161 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open157 OIDout = db_ptr->translate_OID (OIDin, info); 158 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 162 159 return true; 163 160 } … … 172 169 173 170 err = noError; 174 if ( gdbmptr == NULL) {171 if (db_ptr == NULL) { 175 172 // most likely a configuration problem 176 173 logout << text_t2ascii 177 << "configuration error: " << classname <<" contains a null gdbmclass\n\n";174 << "configuration error: " << classname <<" contains a null dbclass\n\n"; 178 175 err = configurationError; 179 176 return true; … … 181 178 182 179 // open the database 183 gdbmptr->setlogout(&logout); 184 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 185 // most likely a system problem (we have already checked that the 186 // gdbm database exists) 180 db_ptr->setlogout(&logout); 181 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 182 // most likely a system problem (we have already checked that the database exists) 187 183 logout << text_t2ascii 188 << "system problem: open on gdbm database \"" 189 << gdbm_filename << "\" failed\n\n"; 184 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 190 185 err = systemProblem; 191 186 return true; … … 204 199 while (this_OID != end_OID) { 205 200 infodbclass info; 206 if (! gdbmptr->getinfo(*this_OID, info)) return false;201 if (!db_ptr->getinfo(*this_OID, info)) return false; 207 202 208 203 // adjust the metadata … … 260 255 parentOID = thisparent; 261 256 parentcontents.erase(parentcontents.begin(), parentcontents.end()); 262 if ( gdbmptr->getinfo(parentOID, parentinfo)) {257 if (db_ptr->getinfo(parentOID, parentinfo)) { 263 258 text_t &parentinfocontains = parentinfo["contains"]; 264 259 if (!parentinfocontains.empty()) … … 316 311 } 317 312 318 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open313 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 319 314 return true; 320 315 } … … 327 322 328 323 err = noError; 329 if ( gdbmptr == NULL) {324 if (db_ptr == NULL) { 330 325 // most likely a configuration problem 331 326 logout << text_t2ascii 332 << "configuration error: " << classname << " contains a null gdbmclass\n\n";327 << "configuration error: " << classname << " contains a null dbclass\n\n"; 333 328 err = configurationError; 334 329 return true; … … 336 331 337 332 // open the database 338 gdbmptr->setlogout(&logout); 339 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 340 // most likely a system problem (we have already checked that the 341 // gdbm database exists) 333 db_ptr->setlogout(&logout); 334 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 335 // most likely a system problem (we have already checked that the database exists) 342 336 logout << text_t2ascii 343 << "system problem: open on gdbm database \"" 344 << gdbm_filename << "\" failed\n\n"; 337 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 345 338 err = systemProblem; 346 339 return true; … … 351 344 translate_OID (OID, tOID, err, logout); 352 345 infodbclass info; 353 if (! gdbmptr->getinfo(tOID, info)) {354 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open346 if (!db_ptr->getinfo(tOID, info)) { 347 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 355 348 return false; 356 349 } … … 367 360 } 368 361 369 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open362 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 370 363 return true; 371 364 } -
gsdl/trunk/src/colservr/gdbmsource.h
r15430 r15584 31 31 #include "text_t.h" 32 32 #include "comtypes.h" 33 #include " gdbmclass.h"33 #include "dbclass.h" 34 34 #include "maptools.h" 35 35 #include "search.h" … … 59 59 text_tarray parentcontents; 60 60 61 text_t gdbm_filename;62 gdbmclass *gdbmptr;61 text_t db_filename; 62 dbclass *db_ptr; 63 63 64 64 searchclass *textsearchptr; … … 68 68 virtual ~gdbmsourceclass (); 69 69 70 // the gdbmptr remains the responsability of the calling code71 void set_ gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}70 // the DB ptr remains the responsibility of the calling code 71 void set_db_ptr (dbclass *db_ptr_arg) { db_ptr = db_ptr_arg; } 72 72 73 // the textsearchptr remains the respons ability of the calling code73 // the textsearchptr remains the responsibility of the calling code 74 74 void set_textsearchptr (searchclass *thetextsearchptr) {textsearchptr=thetextsearchptr;} 75 75 -
gsdl/trunk/src/colservr/lucenegdbmsource.cpp
r15162 r15584 44 44 outconvertclass text_t2ascii; 45 45 err = noError; 46 if ( gdbmptr == NULL) {46 if (db_ptr == NULL) { 47 47 // most likely a configuration problem 48 48 logout << text_t2ascii 49 << "configuration error: lucenegdbmsource contains a null gdbmclass\n\n";49 << "configuration error: lucenegdbmsource contains a null dbclass\n\n"; 50 50 err = configurationError; 51 51 return true; … … 53 53 54 54 // open the database 55 gdbmptr->setlogout(&logout); 56 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 57 // most likely a system problem (we have already checked that the 58 // gdbm database exists) 55 db_ptr->setlogout(&logout); 56 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 57 // most likely a system problem (we have already checked that the database exists) 59 58 logout << text_t2ascii 60 << "system problem: open on gdbm database \"" 61 << gdbm_filename << "\" failed\n\n"; 59 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 62 60 err = systemProblem; 63 61 return true; … … 68 66 translate_OID (OID, tOID, err, logout); 69 67 infodbclass info; 70 if (! gdbmptr->getinfo(tOID, info)) {71 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open68 if (!db_ptr->getinfo(tOID, info)) { 69 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 72 70 return false; 73 71 } … … 82 80 get_top(tOID, parent_OID); 83 81 84 // locate the parent info ingdbm db 85 if (!gdbmptr->getinfo(parent_OID, info)) { 86 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open 82 if (!db_ptr->getinfo(parent_OID, info)) { 83 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 87 84 return false; 88 85 } … … 92 89 93 90 doc.clear(); 94 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open91 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 95 92 expat_document(full_path_to_doc, ((lucenesearchclass*)textsearchptr)->gdbm_level, text_t(docnum), doc); 96 93 return true;
Note:
See TracChangeset
for help on using the changeset viewer.