Changeset 1342 for branches/z3950-branch/gsdl/src/recpt/librarymain.cpp
- Timestamp:
- 2000-08-03T14:49:41+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/z3950-branch/gsdl/src/recpt/librarymain.cpp
r1168 r1342 22 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 23 * 24 * $Id$25 *26 24 *********************************************************************/ 27 28 /*29 $Log$30 Revision 1.25.2.1 2000/05/11 01:56:29 johnmcp31 32 added proper config file parsing for z39.50 servers, and minor changes33 to pageaction (minor bug when display collections from >1 proto) and34 cgiwrapper (announces which collections are z39.50 servers).35 36 Revision 1.25 2000/04/14 02:52:05 sjboddie37 tidied up error messaging and set up some debugging info to be output38 when running library from command line39 40 Revision 1.24 2000/02/29 20:59:02 sjboddie41 added error message when unable to read from collect directory - should42 probably write this out to a web page too43 44 Revision 1.23 2000/02/21 21:59:37 sjboddie45 gsdlhome now comes from gsdlsite.cfg46 47 Revision 1.22 2000/02/17 02:35:48 sjboddie48 tidied up a bit49 50 Revision 1.21 2000/02/15 22:53:51 kjm1851 search history stuff added.52 53 Revision 1.20 1999/12/13 02:46:56 davidb54 Teach buildaction about recptionist55 56 Revision 1.19 1999/11/01 21:58:49 sjboddie57 no longer set receptionist for some actions that used to58 59 Revision 1.18 1999/10/25 22:29:31 sjboddie60 receptionist now checks collect diectory for collections61 rather than collections.txt file62 63 Revision 1.17 1999/10/19 03:23:43 davidb64 Collection building support through web pages65 and internal and external link handling for collection documents66 67 Revision 1.16 1999/10/18 20:07:33 sjboddie68 added htmlbrowserclass69 70 Revision 1.15 1999/10/14 23:03:10 sjboddie71 another browser72 73 Revision 1.14 1999/10/10 08:14:09 sjboddie74 - metadata now returns mp rather than array75 - redesigned browsing support (although it's not finished so76 won't currently work ;-)77 78 Revision 1.13 1999/09/16 21:39:35 sjboddie79 added gb converters80 81 Revision 1.12 1999/09/14 22:42:06 sjboddie82 included utf8 converter83 84 Revision 1.11 1999/09/14 22:03:27 sjboddie85 now reads in collections from a file to avoid recompiling86 87 Revision 1.10 1999/09/08 00:51:11 sjboddie88 removed old interface stuff89 90 Revision 1.9 1999/09/07 04:56:56 sjboddie91 added GPL notice92 93 Revision 1.8 1999/07/15 06:08:55 rjmcnab94 Moved the adding of the actions to librarymain so that they can95 be overriden easier.96 97 Revision 1.7 1999/06/15 01:56:12 sjboddie98 Got multiple collections working99 100 Revision 1.6 1999/05/10 03:40:39 sjboddie101 lots of changes - slowly getting document action sorted out102 103 Revision 1.5 1999/04/19 23:56:10 rjmcnab104 Finished the gdbm metadata stuff105 106 Revision 1.4 1999/04/12 03:45:05 rjmcnab107 Finished the query filter.108 109 Revision 1.3 1999/04/06 22:20:35 rjmcnab110 Got browsefilter working.111 112 Revision 1.2 1999/03/05 03:53:54 sjboddie113 114 fixed some bugs115 116 Revision 1.1 1999/02/21 22:35:22 rjmcnab117 118 Initial revision.119 120 */121 122 25 123 26 #include "receptionist.h" … … 129 32 #include "filter.h" 130 33 #include "browsefilter.h" 131 #include "queryfilter.h" 34 #include "mgqueryfilter.h" 35 #include "mgppqueryfilter.h" 132 36 #include "infodbclass.h" 37 #include "mggdbmsource.h" 133 38 #include "mgsearch.h" 134 #include "mg gdbmsource.h"39 #include "mgppsearch.h" 135 40 #include "fileutil.h" 136 41 #include <assert.h> … … 162 67 nullproto nproto; 163 68 z3950proto zproto; 69 164 70 text_tarray collections; 165 166 71 167 72 // get gsdlhome … … 170 75 text_t collectdir = filename_cat (gsdlhome, "collect"); 171 76 read_dir (collectdir, collections); 172 77 173 78 text_tarray::const_iterator thiscol = collections.begin(); 174 79 text_tarray::const_iterator endcol = collections.end(); … … 177 82 178 83 // ignore the modelcol 179 if (*thiscol == "modelcol") {thiscol ++; continue;} 180 84 85 if (*thiscol == "modelcol") { 86 thiscol ++; 87 continue; 88 } 89 90 // read config file to see if built with mg or mgpp 91 text_t buildtype = "mg"; // mg is default 92 text_tarray cfgline; 93 text_t key; 94 text_t filename = filename_cat(collectdir, *thiscol, "index/build.cfg"); 95 ifstream confin(filename.getcstr()); 96 97 if (confin) { 98 while (read_cfg_line(confin, cfgline) >= 0) { 99 if (cfgline.size() ==2 ) { 100 key = cfgline[0]; 101 cfgline.erase(cfgline.begin()); 102 if (key =="buildtype") { 103 buildtype = cfgline[0]; 104 break; 105 } 106 } 107 } 108 } 109 110 confin.close(); 111 181 112 // this memory is created but never destroyed 182 113 // we're also not doing any error checking to make sure we didn't … … 184 115 collectserver *cserver = new collectserver(); 185 116 gdbmclass *gdbmhandler = new gdbmclass(); 186 mgsearchclass *mgsearch = new mgsearchclass(); 187 117 188 118 // add a null filter 189 119 filterclass *filter = new filterclass (); … … 193 123 browsefilterclass *browsefilter = new browsefilterclass(); 194 124 browsefilter->set_gdbmptr (gdbmhandler); 195 cserver->add_filter (browsefilter); 196 197 // add a query filter 198 queryfilterclass *queryfilter = new queryfilterclass(); 199 queryfilter->set_gdbmptr (gdbmhandler); 200 queryfilter->set_mgsearchptr (mgsearch); 201 cserver->add_filter (queryfilter); 202 203 // add a mg and gdbm source 204 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 205 mggdbmsource->set_gdbmptr (gdbmhandler); 206 mggdbmsource->set_mgsearchptr (mgsearch); 207 cserver->add_source (mggdbmsource); 125 cserver->add_filter (browsefilter); 126 127 if (buildtype == "mg") { 128 mgsearchclass *mgsearch = new mgsearchclass(); 129 130 // add a query filter 131 mgqueryfilterclass *queryfilter = new mgqueryfilterclass(); 132 queryfilter->set_gdbmptr (gdbmhandler); 133 queryfilter->set_mgsearchptr (mgsearch); 134 cserver->add_filter (queryfilter); 135 136 // add a mg and gdbm source 137 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 138 mggdbmsource->set_gdbmptr (gdbmhandler); 139 mggdbmsource->set_mgsearchptr (mgsearch); 140 cserver->add_source (mggdbmsource); 141 } 142 else if (buildtype == "mgpp") { 143 144 mgppsearchclass *mgsearch = new mgppsearchclass(); 145 146 // add a query filter 147 mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass(); 148 queryfilter->set_gdbmptr (gdbmhandler); 149 queryfilter->set_mgsearchptr (mgsearch); 150 cserver->add_filter (queryfilter); 151 152 // add a mg and gdbm source 153 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 154 mggdbmsource->set_gdbmptr (gdbmhandler); 155 mggdbmsource->set_mgsearchptr (mgsearch); 156 cserver->add_source (mggdbmsource); 157 158 } 208 159 209 160 // inform collection server and everything it contains about its … … 247 198 recpt.add_converter ("u", &utf8inconvert, &utf8outconvert); 248 199 249 if (!gsdlhome.empty()) { 250 mapinconvertclass gbinconvert; 251 gbinconvert.setmapfile (gsdlhome, "gbku", 0x25a1); 252 mapoutconvertclass gboutconvert; 253 gboutconvert.setmapfile (gsdlhome, "ugbk", 0xa1f5); 254 recpt.add_converter ("g", &gbinconvert, &gboutconvert); 255 } 200 mapinconvertclass gbinconvert; 201 gbinconvert.setmapfile (gsdlhome, "gbku", 0x25a1); 202 mapoutconvertclass gboutconvert; 203 gboutconvert.setmapfile (gsdlhome, "ugbk", 0xa1f5); 204 recpt.add_converter ("g", &gbinconvert, &gboutconvert); 205 206 text_t armapfile = filename_cat (gsdlhome, "unicode", "MAPPINGS"); 207 armapfile = filename_cat (armapfile, "WINDOWS", "1256.TXT"); 208 simplemapinconvertclass arinconvert; 209 arinconvert.setmapfile (armapfile); 210 simplemapoutconvertclass aroutconvert; 211 aroutconvert.setmapfile (armapfile); 212 recpt.add_converter ("a", &arinconvert, &aroutconvert); 213 256 214 257 215 // the list of actions. Note: these actions will become invalid … … 262 220 263 221 pageaction apageaction; 222 apageaction.set_receptionist (&recpt); 264 223 recpt.add_action (&apageaction); 265 224 … … 268 227 269 228 queryaction aqueryaction; 229 aqueryaction.set_receptionist (&recpt); 270 230 recpt.add_action (&aqueryaction); 271 231 272 232 documentaction adocumentaction; 233 adocumentaction.set_receptionist (&recpt); 273 234 recpt.add_action (&adocumentaction); 274 235 … … 313 274 return 0; 314 275 } 315 316 317 318 319
Note:
See TracChangeset
for help on using the changeset viewer.