Changeset 1270
- Timestamp:
- 2000-07-06T09:49:36+12:00 (24 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/cfgread.cpp
r1076 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.9 2000/07/05 21:49:22 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.8 2000/04/06 19:57:57 cs025 31 35 Correcting a correction - reinstated all lib files due to silly … … 56 60 57 61 #include "cfgread.h" 58 59 void collectioninfo_t::clear () {60 gsdl_gsdlhome.clear();61 gsdl_gdbmhome.clear();62 }63 62 64 63 int write_ini_line (ofstream &fileout, const text_t &key, const text_t value) { -
trunk/gsdl/lib/cfgread.h
r1076 r1270 41 41 #endif 42 42 43 struct collectioninfo_t {44 void clear ();45 collectioninfo_t () {clear();}46 47 text_t gsdl_gsdlhome;48 text_t gsdl_gdbmhome;49 };50 51 typedef map<text_t, collectioninfo_t, lttext_t> colinfo_tmap;52 53 43 // return 0 on success, -1 on failure 54 44 int write_ini_line (ofstream &fileout, const text_t &key, const text_t value); -
trunk/gsdl/src/recpt/buildaction.cpp
r1177 r1270 102 102 // make sure we know about a receptionist 103 103 if (recpt == NULL) { 104 logout << "The pageaction does not contain information\n"104 logout << "The build action does not contain information\n" 105 105 << "about any receptionists. The method set_receptionist\n" 106 106 << "was probably not called from the module which instantiated\n" 107 << "this pageaction.\n";107 << "this build action.\n"; 108 108 return; 109 109 } … … 146 146 while (collist_here != collist_end) { 147 147 148 ColInfoResponse_t cinfo; 149 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 150 if (err == noError) { 148 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 149 if (cinfo != NULL) { 151 150 text_t collectionname = *collist_here; 152 if (!cinfo .collectionmeta["collectionname"].empty())151 if (!cinfo->collectionmeta["collectionname"].empty()) 153 152 { 154 153 // get collection name from the collection cfg file 155 collectionname = cinfo .collectionmeta["collectionname"];154 collectionname = cinfo->collectionmeta["collectionname"]; 156 155 } 157 156 else … … 206 205 || (args["bc1dirname"]==*collist_here)) 207 206 { 208 disp.setmacro("bcargingsdlarea","build",cinfo .building["ingsdlarea"]);209 disp.setmacro("bcargcopydir","build",cinfo .building["copydir"]);207 disp.setmacro("bcargingsdlarea","build",cinfo->building["ingsdlarea"]); 208 disp.setmacro("bcargcopydir","build",cinfo->building["copydir"]); 210 209 211 if (cinfo .buildDate==0) // not built210 if (cinfo->buildDate==0) // not built 212 211 { 213 212 // assume that's because this is the first build ever for the collection -
trunk/gsdl/src/recpt/cgiwrapper.cpp
r1255 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.30 2000/07/05 21:49:31 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.29 2000/06/29 03:57:14 sjboddie 31 35 Now append to error log (errout.txt) instead of overwriting it each time … … 515 519 cout << text_t2ascii << outspaces; 516 520 517 ColInfoResponse_t cinfo; 518 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, cerr); 519 if (err == noError) { 520 if (cinfo.isPublic) cout << "public "; 521 ColInfoResponse_t *cinfo = recpt.get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, cerr); 522 if (cinfo != NULL) { 523 if (cinfo->isPublic) cout << "public "; 521 524 else cout << "private"; 522 525 523 if (cinfo .buildDate > 0) cout << " running ";526 if (cinfo->buildDate > 0) cout << " running "; 524 527 else cout << " not running"; 525 528 } -
trunk/gsdl/src/recpt/documentaction.cpp
r1148 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.39 2000/07/05 21:49:31 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.38 2000/05/04 05:18:46 sjboddie 31 35 attempting to get end-user collection building to work under windows … … 183 187 184 188 documentaction::documentaction () { 189 recpt = NULL; 190 185 191 186 192 // this action uses cgi variables "a", "d", "cl", … … 500 506 if (collectproto == NULL) return; 501 507 508 if (recpt == NULL) { 509 logout << "ERROR (documentaction::define_external_macros): This action does not contain\n" 510 << " information about any receptionists. The method set_receptionist was\n" 511 << " probably not called from the module which instantiated this action.\n"; 512 return; 513 } 514 502 515 outconvertclass text_t2ascii; 503 516 comerror_t err; … … 506 519 text_tset metadata; 507 520 508 509 // get info on current collection and load up formatinfo 510 // I'd prefer not to do this here as we're getting 511 // collection info every time (and probably also getting 512 // it in other places some of the time) - One day I'll 513 // fix it ... maybe - Stefan. 514 ColInfoResponse_t cinfo; 515 collectproto->get_collectinfo (collection, cinfo, err, logout); 516 load_formatinfo (cinfo.format, args.getintarg("gt")); 521 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout); 522 if (cinfo == NULL) { 523 logout << "ERROR (documentaction::define_external_macros): get_collectinfo_ptr returned NULL\n"; 524 return; 525 } 526 load_formatinfo (cinfo->format, args.getintarg("gt")); 517 527 518 528 if (formatinfo.DocumentUseHTML) { … … 526 536 disp.setmacro ("gsdltop", "Global", "documenttop"); 527 537 } 528 text_tmap::iterator it = cinfo .format.find ("homepage");529 if (it != cinfo .format.end()) {538 text_tmap::iterator it = cinfo->format.find ("homepage"); 539 if (it != cinfo->format.end()) { 530 540 text_t httppagehome; 531 541 if (get_link (args, protos, (*it).second, httppagehome, logout)) … … 1101 1111 textout << outconvert << disp << buffer; 1102 1112 } 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 -
trunk/gsdl/src/recpt/documentaction.h
r1079 r1270 79 79 virtual ~documentaction (); 80 80 81 void set_receptionist (receptionist *therecpt) {recpt=therecpt;} 82 81 83 text_t get_action_name () {return "d";} 82 84 -
trunk/gsdl/src/recpt/librarymain.cpp
r1233 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.28 2000/07/05 21:49:32 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.27 2000/06/23 03:21:39 sjboddie 31 35 Created converter classes for simple 8 bit encodings that use a … … 251 255 252 256 pageaction apageaction; 257 apageaction.set_receptionist (&recpt); 253 258 recpt.add_action (&apageaction); 254 259 … … 257 262 258 263 queryaction aqueryaction; 264 aqueryaction.set_receptionist (&recpt); 259 265 recpt.add_action (&aqueryaction); 260 266 261 267 documentaction adocumentaction; 268 adocumentaction.set_receptionist (&recpt); 262 269 recpt.add_action (&adocumentaction); 263 270 -
trunk/gsdl/src/recpt/pageaction.cpp
r1247 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.33 2000/07/05 21:49:33 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.32 2000/06/27 23:02:40 sjboddie 31 35 Tidied up the way collections are displayed on 'standard' homepage. … … 220 224 while (collist_here != collist_end) { 221 225 222 ColInfoResponse_t cinfo; 223 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 226 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 224 227 225 if ( err == noError) {226 if (cinfo .isPublic && (cinfo.buildDate > 0)) {228 if (cinfo != NULL) { 229 if (cinfo->isPublic && (cinfo->buildDate > 0)) { 227 230 228 231 FilterResponse_t response; … … 258 261 link = "<a href=\"_gwcgi_?a=p&p=about&l=ar&nw=u&c=" + *collist_here + "\">"; 259 262 260 if (!cinfo .receptionist.empty())261 link = "<a href=\"" + cinfo .receptionist + "\">";263 if (!cinfo->receptionist.empty()) 264 link = "<a href=\"" + cinfo->receptionist + "\">"; 262 265 263 266 homeextra += "<td>" + link + collectionname + "</a></td>\n"; … … 324 327 325 328 329 if (recpt == NULL) { 330 logout << "ERROR (pageaction::define_internal_macros): This action does not contain\n" 331 << " information about any receptionists. The method set_receptionist was\n" 332 << " probably not called from the module which instantiated this action.\n"; 333 return; 334 } 335 326 336 text_t &arg_p = args["p"]; 327 337 text_t &arg_c = args["c"]; 328 ColInfoResponse_t cinfo; 329 comerror_t err; 338 ColInfoResponse_t *cinfo = NULL; 330 339 331 340 recptproto* collectproto = protos->getrecptproto (arg_c, logout); 332 341 if (collectproto != NULL) { 333 c ollectproto->get_collectinfo (arg_c, cinfo, err, logout);334 335 disp.setmacro ("numdocs", "Global", cinfo .numDocs);342 cinfo = recpt->get_collectinfo_ptr (collectproto, arg_c, logout); 343 344 disp.setmacro ("numdocs", "Global", cinfo->numDocs); 336 345 unsigned long current_time = time(NULL); 337 unsigned long builddate = (current_time - cinfo .buildDate) / 86400;346 unsigned long builddate = (current_time - cinfo->buildDate) / 86400; 338 347 disp.setmacro ("builddate", "Global", builddate); 339 348 } … … 345 354 // _collectionoption_ 346 355 347 if (args["ccs"] == "1" && collectproto != NULL && (cinfo .ccsCols.size() > 1)) {356 if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) { 348 357 text_t collectionoption = "_textcollectionoption_"; 349 text_tarray::const_iterator col_here = cinfo .ccsCols.begin();350 text_tarray::const_iterator col_end = cinfo .ccsCols.end();358 text_tarray::const_iterator col_here = cinfo->ccsCols.begin(); 359 text_tarray::const_iterator col_end = cinfo->ccsCols.end(); 351 360 int count = 0; 352 361 while (col_here != col_end) { 353 362 text_t colname; 354 363 if (*col_here == arg_c) { 355 colname = cinfo .collectionmeta["collectionname"];364 colname = cinfo->collectionmeta["collectionname"]; 356 365 } else { 357 ColInfoResponse_t this_cinfo; 358 collectproto->get_collectinfo (*col_here, this_cinfo, err, logout); 359 if (err != noError) {col_here ++; continue;} 360 colname = this_cinfo.collectionmeta["collectionname"]; 366 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 367 if (this_cinfo == NULL) {col_here ++; continue;} 368 colname = this_cinfo->collectionmeta["collectionname"]; 361 369 } 362 370 … … 374 382 // _htmloptions_ 375 383 376 text_tmap::const_iterator it = cinfo .format.find ("DocumentUseHTML");377 if ((it != cinfo .format.end()) && ((*it).second == "true")) {384 text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML"); 385 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 378 386 disp.setmacro ("htmloptions", "preferences", "_htmloptionson_"); 379 387 … … 381 389 // _PreferenceDocsFromWeb_ 382 390 383 it = cinfo .format.find ("PreferenceDocsFromWeb");384 if ((it == cinfo .format.end()) || ((*it).second == "true"))391 it = cinfo->format.find ("PreferenceDocsFromWeb"); 392 if ((it == cinfo->format.end()) || ((*it).second == "true")) 385 393 disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1"); 386 394 } … … 407 415 408 416 text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n"; 409 it = cinfo .format.find ("PreferenceLanguages");410 if ((it != cinfo .format.end()) && (!(*it).second.empty())) {417 it = cinfo->format.find ("PreferenceLanguages"); 418 if ((it != cinfo->format.end()) && (!(*it).second.empty())) { 411 419 text_tset pref_langs; 412 420 splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs); … … 479 487 480 488 // if HTML collection there's no how to read document text 481 text_tmap::const_iterator it = cinfo .format.find ("HelpNoDocs");482 if ((it != cinfo .format.end()) && ((*it).second == "true")) {489 text_tmap::const_iterator it = cinfo->format.find ("HelpNoDocs"); 490 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 483 491 disp.setmacro ("topicreadingdocs", "help", ""); 484 492 disp.setmacro ("texthelpreadingdocs", "help", ""); 485 493 } 486 it = cinfo .format.find ("HelpBibDocs");487 if ((it != cinfo .format.end()) && ((*it).second == "true")) {494 it = cinfo->format.find ("HelpBibDocs"); 495 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 488 496 disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_"); 489 497 disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_"); 490 498 } 491 it = cinfo .format.find ("HelpBookDocs");492 if ((it != cinfo .format.end()) && ((*it).second == "true")) {499 it = cinfo->format.find ("HelpBookDocs"); 500 if ((it != cinfo->format.end()) && ((*it).second == "true")) { 493 501 disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_"); 494 502 disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_"); … … 499 507 500 508 // _textsubcollections_ 501 if (args["ccs"] == "1" && (cinfo .ccsCols.size() > 1)) {502 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo .ccsCols.size()) + ")";503 text_tarray::const_iterator here = cinfo .ccsCols.begin();504 text_tarray::const_iterator end = cinfo .ccsCols.end();509 if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) { 510 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")"; 511 text_tarray::const_iterator here = cinfo->ccsCols.begin(); 512 text_tarray::const_iterator end = cinfo->ccsCols.end(); 505 513 bool first = true; 506 514 int count = 0; … … 508 516 if (*here == arg_c) { 509 517 if (!first) textsubcollections += "<br>"; 510 textsubcollections += "\n" + cinfo .collectionmeta["collectionname"] + "\n";518 textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n"; 511 519 } else { 512 ColInfoResponse_t this_cinfo; 513 collectproto->get_collectinfo (*here, this_cinfo, err, logout); 514 if (err != noError) {here ++; continue;} 520 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout); 521 if (this_cinfo == NULL) {here ++; continue;} 515 522 if (!first) textsubcollections += "<br>"; 516 textsubcollections += "\n" + this_cinfo .collectionmeta["collectionname"] + "\n";523 textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n"; 517 524 } 518 525 count ++; -
trunk/gsdl/src/recpt/pageaction.h
r761 r1270 47 47 virtual ~pageaction (); 48 48 49 void set_receptionist (receptionist *therecpt) {recpt=therecpt;} 50 49 51 text_t get_action_name () {return "p";} 50 52 -
trunk/gsdl/src/recpt/queryaction.cpp
r962 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.37 2000/07/05 21:49:34 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.36 2000/02/21 21:57:48 sjboddie 31 35 actions are now configured with gsdlhome … … 177 181 queryaction::queryaction () { 178 182 183 recpt = NULL; 179 184 num_phrases = 0; 180 185 … … 695 700 ostream &textout, ostream &logout) { 696 701 697 ColInfoResponse_t cinfo;702 ColInfoResponse_t *cinfo = NULL; 698 703 comerror_t err; 699 704 InfoFilterOptionsResponse_t fresponse; … … 737 742 while (collist_here != collist_end) { 738 743 739 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);744 cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 740 745 // if (err == noError && cinfo.isPublic && (cinfo.buildDate > 0)) { 741 if ( err == noError && (cinfo.buildDate > 0)) {746 if (cinfo != NULL && (cinfo->buildDate > 0)) { 742 747 743 748 (*rprotolist_here).p->get_filteroptions (*collist_here, frequest, fresponse, err, logout); … … 789 794 << " name=cc value=\"" << *collist_here << "\">"; 790 795 791 if (!cinfo .collectionmeta["collectionname"].empty())792 textout << outconvert << disp << cinfo .collectionmeta["collectionname"];796 if (!cinfo->collectionmeta["collectionname"].empty()) 797 textout << outconvert << disp << cinfo->collectionmeta["collectionname"]; 793 798 else 794 799 textout << outconvert << *collist_here; … … 816 821 ostream &logout) { 817 822 823 if (recpt == NULL) { 824 logout << "ERROR (queryaction::do_action): This action does not contain information\n" 825 << " about any receptionists. The method set_receptionist was probably\n" 826 << " not called from the module which instantiated this action.\n"; 827 return true; 828 } 829 830 818 831 if (args["ccs"] == "1") { 819 832 if (!args["cc"].empty()) { … … 866 879 map<text_t, colinfo_t, lttext_t> colinfomap; 867 880 868 ColInfoResponse_t cinfo;881 ColInfoResponse_t *cinfo = NULL; 869 882 comerror_t err; 870 883 FilterRequest_t request; … … 906 919 continue; 907 920 } 908 collectproto->get_collectinfo (*col_here, cinfo, err, logout); 921 cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 922 if (cinfo == NULL) { 923 logout << "ERROR (query_action::search_multiple_collections): get_collectinfo_ptr returned NULL\n"; 924 col_here ++; 925 continue; 926 } 909 927 910 928 browserclass *bptr = browsers->getbrowser (browsertype); … … 913 931 text_t formatstring; 914 932 if (!get_formatstring (classification, browsertype, 915 cinfo .format, formatstring))933 cinfo->format, formatstring)) 916 934 formatstring = bptr->get_default_formatstring(); 917 935 … … 1069 1087 text_t classification = "Search"; 1070 1088 1071 ColInfoResponse_t cinfo;1072 1089 comerror_t err; 1073 collectproto->get_collectinfo (collection, cinfo, err, logout); 1090 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout); 1091 1092 if (cinfo == NULL) { 1093 logout << "ERROR (query_action::search_single_collection): get_collectinfo_ptr returned NULL\n"; 1094 return false; 1095 } 1074 1096 1075 1097 browserclass *bptr = browsers->getbrowser (browsertype); … … 1078 1100 text_t formatstring; 1079 1101 if (!get_formatstring (classification, browsertype, 1080 cinfo .format, formatstring))1102 cinfo->format, formatstring)) 1081 1103 formatstring = bptr->get_default_formatstring(); 1082 1104 -
trunk/gsdl/src/recpt/queryaction.h
r928 r1270 32 32 #include "gsdlconf.h" 33 33 #include "action.h" 34 #include "receptionist.h" 34 35 35 36 struct colinfo_t { … … 61 62 62 63 protected: 64 65 receptionist *recpt; 66 63 67 text_t formatstring; 64 68 int num_phrases; … … 97 101 queryaction (); 98 102 virtual ~queryaction () {} 103 104 void set_receptionist (receptionist *therecpt) {recpt=therecpt;} 99 105 100 106 void configure (const text_t &key, const text_tarray &cfgline); -
trunk/gsdl/src/recpt/receptionist.cpp
r1268 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.53 2000/07/05 21:49:34 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.52 2000/07/04 02:15:22 sjboddie 31 35 fixed bug causing segmentation fault when an invalid collection … … 286 290 } 287 291 288 292 void collectioninfo_t::clear () { 293 gsdl_gsdlhome.clear(); 294 gsdl_gdbmhome.clear(); 295 296 info_loaded = false; 297 info.clear(); 298 } 289 299 290 300 receptionist::receptionist () { … … 1034 1044 colinfo_tmap::iterator colend = configinfo.collectinfo.end(); 1035 1045 while (colhere != colend) { 1036 gsdlmacrodir = filename_cat ((*colhere).second.gsdl_gsdlhome, "macros"); 1037 maindirs.insert (gsdlmacrodir); 1046 if (!((*colhere).second.gsdl_gsdlhome).empty()) { 1047 gsdlmacrodir = filename_cat ((*colhere).second.gsdl_gsdlhome, "macros"); 1048 maindirs.insert (gsdlmacrodir); 1049 } 1038 1050 colhere ++; 1039 1051 } … … 1126 1138 1127 1139 } else { 1128 ColInfoResponse_t cinfo; 1129 comerror_t err; 1130 1131 collectproto->get_collectinfo (arg_c, cinfo, err, logout); 1132 1133 if (!cinfo.ccsCols.empty()) { 1134 args["ccs"] = 1; 1135 if (args["cc"].empty()) { 1136 text_tarray::const_iterator col_here = cinfo.ccsCols.begin(); 1137 text_tarray::const_iterator col_end = cinfo.ccsCols.end(); 1138 bool first = true; 1139 while (col_here != col_end) { 1140 // make sure it's a valid collection 1141 if (protocols.getrecptproto (*col_here, logout) != NULL) { 1142 if (!first) args["cc"].push_back (','); 1143 args["cc"] += *col_here; 1144 first = false; 1140 1141 ColInfoResponse_t *cinfo = get_collectinfo_ptr (collectproto, arg_c, logout); 1142 1143 if (cinfo != NULL) { 1144 if (!cinfo->ccsCols.empty()) { 1145 args["ccs"] = 1; 1146 if (args["cc"].empty()) { 1147 text_tarray::const_iterator col_here = cinfo->ccsCols.begin(); 1148 text_tarray::const_iterator col_end = cinfo->ccsCols.end(); 1149 bool first = true; 1150 while (col_here != col_end) { 1151 // make sure it's a valid collection 1152 if (protocols.getrecptproto (*col_here, logout) != NULL) { 1153 if (!first) args["cc"].push_back (','); 1154 args["cc"] += *col_here; 1155 first = false; 1156 } 1157 col_here ++; 1145 1158 } 1146 col_here ++;1147 1159 } 1148 1160 } 1161 } else { 1162 logout << "ERROR (receptionist::check_mainargs): get_collectinfo_ptr returned NULL\n"; 1149 1163 } 1150 1164 } … … 1331 1345 } 1332 1346 } 1347 1348 // gets collection info from cache if found or 1349 // calls collection server (and updates cache) 1350 // returns NULL if there's an error 1351 ColInfoResponse_t *receptionist::get_collectinfo_ptr (recptproto *collectproto, 1352 const text_t &collection, 1353 ostream &logout) { 1354 1355 // check the cache 1356 colinfo_tmap::iterator it = configinfo.collectinfo.find (collection); 1357 if ((it != configinfo.collectinfo.end()) && ((*it).second.info_loaded)) { 1358 // found it 1359 return &((*it).second.info); 1360 } 1361 1362 // not cached, get info from collection server 1363 if (collectproto == NULL) { 1364 logout << "ERROR: receptionist::get_collectinfo_ptr passed null collectproto\n"; 1365 return NULL; 1366 } 1367 1368 comerror_t err; 1369 if (it == configinfo.collectinfo.end()) { 1370 collectioninfo_t cinfo; 1371 collectproto->get_collectinfo (collection, cinfo.info, err, logout); 1372 if (err != noError) { 1373 outconvertclass text_t2ascii; 1374 logout << text_t2ascii << "ERROR (receptionist::getcollectinfo_ptr): \"" 1375 << get_comerror_string (err) << "\"while getting collectinfo\n"; 1376 return NULL; 1377 } 1378 cinfo.info_loaded = true; 1379 configinfo.collectinfo[collection] = cinfo; 1380 return &(configinfo.collectinfo[collection].info); 1381 } else { 1382 collectproto->get_collectinfo (collection, (*it).second.info, err, logout); 1383 if (err != noError) { 1384 outconvertclass text_t2ascii; 1385 logout << text_t2ascii << "ERROR (receptionist::getcollectinfo_ptr): \"" 1386 << get_comerror_string (err) << "\"while getting collectinfo\n"; 1387 return NULL; 1388 } 1389 (*it).second.info_loaded = true; 1390 return &((*it).second.info); 1391 } 1392 } -
trunk/gsdl/src/recpt/receptionist.h
r1193 r1270 34 34 #include "cgiargs.h" 35 35 #include "display.h" 36 #include "action.h"37 36 #include "browserclass.h" 38 37 #include "recptproto.h" 39 38 #include "converter.h" 40 39 #include "cfgread.h" 40 #include "action.h" 41 41 42 42 // the MACROPRECEDENCE macro is used as a default. override … … 49 49 #define MACROPRECEDENCE "c,l" 50 50 #endif 51 52 53 struct collectioninfo_t { 54 void clear (); 55 collectioninfo_t () {clear();} 56 57 text_t gsdl_gsdlhome; 58 text_t gsdl_gdbmhome; 59 60 bool info_loaded; 61 ColInfoResponse_t info; 62 }; 63 64 typedef map<text_t, collectioninfo_t, lttext_t> colinfo_tmap; 51 65 52 66 … … 72 86 }; 73 87 74 75 88 class receptionist { 76 89 protected: … … 196 209 // list. This can be used to save preferences between sessions. 197 210 text_t get_compressed_arg (cgiargsclass &args, ostream &logout); 211 212 // gets collection info from cache if found or 213 // calls collection server (and updates cache) 214 // returns NULL if there's an error 215 ColInfoResponse_t *get_collectinfo_ptr (recptproto *collectproto, 216 const text_t &collection, 217 ostream &logout); 218 198 219 199 220 protected: -
trunk/gsdl/src/recpt/statusaction.cpp
r1266 r1270 28 28 /* 29 29 $Log$ 30 Revision 1.31 2000/07/05 21:49:36 sjboddie 31 Receptionist now caches collection information to avoid making multiple 32 get_collectinfo calls to collection server 33 30 34 Revision 1.30 2000/07/03 22:26:27 nzdl 31 35 fixed a few errors in the macro files (and one in some text printed out … … 157 161 displayclass &disp, outconvertclass &outconvert, 158 162 ostream &textout, ostream &logout) { 163 164 if (recpt == NULL) return; 159 165 160 166 textout << outconvert << disp … … 188 194 << "</a></td>"; 189 195 190 ColInfoResponse_t cinfo; 191 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout); 192 if (err == noError) { 196 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); 197 if (cinfo != NULL) { 193 198 text_t collname = *collist_here; 194 text_tmap::iterator it = cinfo .collectionmeta.find("collectionname");195 if (it != cinfo .collectionmeta.end()) collname = (*it).second;199 text_tmap::iterator it = cinfo->collectionmeta.find("collectionname"); 200 if (it != cinfo->collectionmeta.end()) collname = (*it).second; 196 201 197 202 textout << "<td>"; 198 if (cinfo .buildDate > 0)203 if (cinfo->buildDate > 0) 199 204 textout << outconvert << disp 200 205 << "<a href=\"_httppagex_(about)&c=" << *collist_here … … 203 208 textout << outconvert << disp << collname; 204 209 205 if (cinfo .buildDate > 0) textout << "</a>";210 if (cinfo->buildDate > 0) textout << "</a>"; 206 211 207 212 textout << "</td>"; 208 213 209 if (cinfo .isPublic) textout << "<td>yes</td>";214 if (cinfo->isPublic) textout << "<td>yes</td>"; 210 215 else textout << "<td>no</td>"; 211 216 212 if (cinfo .buildDate > 0)217 if (cinfo->buildDate > 0) 213 218 textout << outconvert << "<td>yes</td>"; 214 219 else … … 651 656 } else { 652 657 // rproto can't be NULL to get here 653 ColInfoResponse_t collectinfo; 654 comerror_t err; 655 656 rproto->get_collectinfo (arg_c, collectinfo, err, logout); 657 if (err == noError) { 658 ColInfoResponse_t *collectinfo = recpt->get_collectinfo_ptr (rproto, arg_c, logout); 659 if (collectinfo != NULL) { 658 660 textout << outconvert << "<table>\n" 659 661 << "<tr><th>collection name</th><td>\"" 660 << collectinfo .shortInfo.name662 << collectinfo->shortInfo.name 661 663 << "\"</td></tr>\n" 662 664 663 665 << "<tr><th>host</th><td>\"" 664 << collectinfo .shortInfo.host666 << collectinfo->shortInfo.host 665 667 << "\"</td></tr>\n" 666 668 667 669 << "<tr><th>port</th><td>\"" 668 << collectinfo .shortInfo.port670 << collectinfo->shortInfo.port 669 671 << "\"</td></tr>\n" 670 672 671 673 << "<tr><th>is public?</th><td>"; 672 if (collectinfo .isPublic) textout << outconvert << "true";674 if (collectinfo->isPublic) textout << outconvert << "true"; 673 675 else textout << outconvert << "false"; 674 676 textout << outconvert … … 676 678 677 679 << "<tr><th>is beta?</th><td>"; 678 if (collectinfo .isBeta) textout << outconvert << "true";680 if (collectinfo->isBeta) textout << outconvert << "true"; 679 681 else textout << outconvert << "false"; 680 682 textout << outconvert … … 682 684 683 685 << "<tr><th>build date</th><td>\"" 684 << collectinfo .buildDate686 << collectinfo->buildDate 685 687 << "\"</td></tr>\n" 686 688 687 689 << "<tr><th>interface languages</th><td>"; 688 text_tarray::iterator languages_here = collectinfo .languages.begin();689 text_tarray::iterator languages_end = collectinfo .languages.end();690 text_tarray::iterator languages_here = collectinfo->languages.begin(); 691 text_tarray::iterator languages_end = collectinfo->languages.end(); 690 692 bool languages_first = true; 691 693 while (languages_here != languages_end) { … … 697 699 698 700 textout << "<tr><th valign=top>collection metadata</th><td><table>\n"; 699 text_tmap::iterator meta_here = collectinfo .collectionmeta.begin();700 text_tmap::iterator meta_end = collectinfo .collectionmeta.end();701 text_tmap::iterator meta_here = collectinfo->collectionmeta.begin(); 702 text_tmap::iterator meta_end = collectinfo->collectionmeta.end(); 701 703 while (meta_here != meta_end) { 702 704 textout << outconvert << "<tr><td>" << (*meta_here).first … … 707 709 708 710 textout << "<tr><th valign=top>format info</th><td><table>\n"; 709 text_tmap::iterator format_here = collectinfo .format.begin();710 text_tmap::iterator format_end = collectinfo .format.end();711 text_tmap::iterator format_here = collectinfo->format.begin(); 712 text_tmap::iterator format_end = collectinfo->format.end(); 711 713 while (format_here != format_end) { 712 714 textout << outconvert << "<tr><td>" << (*format_here).first … … 717 719 718 720 textout << "<tr><th valign=top>building info</th><td><table>\n"; 719 text_tmap::iterator building_here = collectinfo .building.begin();720 text_tmap::iterator building_end = collectinfo .building.end();721 text_tmap::iterator building_here = collectinfo->building.begin(); 722 text_tmap::iterator building_end = collectinfo->building.end(); 721 723 while (building_here != building_end) { 722 724 textout << outconvert << "<tr><td>" << (*building_here).first … … 730 732 731 733 << "<tr><th>number of documents</th><td>\"" 732 << collectinfo .numDocs734 << collectinfo->numDocs 733 735 << "\"</td></tr>\n" 734 736 735 737 << "<tr><th>number of sections</th><td>\"" 736 << collectinfo .numSections738 << collectinfo->numSections 737 739 << "\"</td></tr>\n" 738 740 739 741 << "<tr><th>number of words</th><td>\"" 740 << collectinfo .numWords742 << collectinfo->numWords 741 743 << "\"</td></tr>\n" 742 744 743 745 << "<tr><th>number of bytes</th><td>\"" 744 << collectinfo .numBytes746 << collectinfo->numBytes 745 747 << "\"</td></tr>\n" 746 748 747 749 << "<tr><th>preferred receptionist</th><td>\"" 748 << collectinfo .receptionist750 << collectinfo->receptionist 749 751 << "\"</td></tr>\n" 750 752 … … 752 754 753 755 } else { 754 textout << outconvert << "Error (" << get_comerror_string (err) 755 << ") while getting collect information\n"; 756 textout << "ERROR (statusaction::output_collectioninfo): while getting collect information\n"; 756 757 } 757 758 … … 760 761 InfoFilterOptionsRequest_t filteroptions_request; 761 762 InfoFilterOptionsResponse_t filteroptions; 763 comerror_t err; 762 764 rproto->get_filterinfo (arg_c, filterinfo, err, logout); 763 765 if (err == noError) { -
trunk/gsdl/src/w32server/settings.h
r902 r1270 12 12 #include "text_t.h" 13 13 #include "cfgread.h" 14 #include "receptionist.h" 14 15 15 16 // library settings
Note:
See TracChangeset
for help on using the changeset viewer.