Changeset 1649 for trunk/gsdl
- Timestamp:
- 2000-11-03T10:21:01+13:00 (24 years ago)
- Location:
- trunk/gsdl/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/collectoraction.cpp
r1507 r1649 35 35 #include "cfgread.h" 36 36 #include "gsdltools.h" 37 #include "nullproto.h" 37 38 38 39 #if !defined (__WIN32__) … … 359 360 char c = fbld_in.get(); 360 361 fbld_in.close(); 361 if (c == '0') current_page = "bilddone"; 362 if (c == '0') { 363 // success - we need to create and configure a collection server for the 364 // newly built collection (for fastcgi and local library where 365 // initialization isn't going to be redone when the user clicks the 366 // "view your new collection" button 367 create_colserver (args["bc1dirname"], logout); 368 current_page = "bilddone"; 369 } 362 370 else if (c == '4' || c == '5') message = "installfail"; 363 371 else current_page = "bildfail"; … … 772 780 } 773 781 774 disp.setmacro ("statusline", "collector", statusline);782 disp.setmacro ("statusline", "collector", dm_safe(statusline)); 775 783 776 784 } … … 1163 1171 options += " -collectdir \"" + tmpdir + "\" "; 1164 1172 text_t optionfile = filename_cat (tmpdir, "mkcol.opt"); 1165 char *optionfile t= optionfile.getcstr();1166 ofstream ofile_out (optionfile t);1167 delete optionfile t;1173 char *optionfilec = optionfile.getcstr(); 1174 ofstream ofile_out (optionfilec); 1175 delete optionfilec; 1168 1176 if (!ofile_out) { 1169 1177 message = "tmpfail"; … … 1336 1344 return false; 1337 1345 } 1346 1347 // create and initialize a new collection server and 1348 // add it to the null protocol. 1349 void collectoraction::create_colserver (const text_t &collection, ostream &logout) { 1350 1351 recptprotolistclass *protos = recpt->get_recptprotolist_ptr(); 1352 recptprotolistclass::iterator rprotolist_here = protos->begin(); 1353 recptprotolistclass::iterator rprotolist_end = protos->end(); 1354 while (rprotolist_here != rprotolist_end) { 1355 if ((*rprotolist_here).p != NULL) { 1356 if ((*rprotolist_here).p->get_protocol_name () == "nullproto") { 1357 // create collection server and add it to nullproto 1358 (*rprotolist_here).p->add_collection (collection, recpt, gsdlhome, gsdlhome); 1359 // make sure gsdlhome is configured 1360 text_tarray tmp; 1361 tmp.push_back (gsdlhome); 1362 (*rprotolist_here).p->configure ("gsdlhome", tmp); 1363 // re-initialize the null protocol 1364 if (!(*rprotolist_here).p->init (logout)) { 1365 logout << "collectoraction::create_colserver: nullproto init failed\n"; 1366 } 1367 return; 1368 } 1369 } 1370 rprotolist_here ++; 1371 } 1372 1373 logout << "collectoraction::create_colserver: no valid nullproto found\n"; 1374 } -
trunk/gsdl/src/recpt/collectoraction.h
r1485 r1649 75 75 text_t get_collectdir (cgiargsclass &args); 76 76 77 bool collectoraction::uses_weird_plugin (const text_t &collection); 77 bool uses_weird_plugin (const text_t &collection); 78 79 void create_colserver (const text_t &collection, ostream &logout); 78 80 79 81 public: -
trunk/gsdl/src/recpt/librarymain.cpp
r1643 r1649 26 26 #include "receptionist.h" 27 27 #include "cgiwrapper.h" 28 #include "fileutil.h" 28 29 #include "nullproto.h" 29 30 // z39.50 stuff - johnmcp 30 31 #include "z3950proto.h" 31 #include "collectserver.h"32 #include "filter.h"33 #include "browsefilter.h"34 #include "mgqueryfilter.h"35 #include "mgppqueryfilter.h"36 #include "infodbclass.h"37 #include "mggdbmsource.h"38 #include "mgsearch.h"39 #include "mgppsearch.h"40 #include "fileutil.h"41 #include <assert.h>42 32 43 33 #include "action.h" … … 86 76 87 77 // ignore the modelcol 88 89 78 if (*thiscol == "modelcol") { 90 79 thiscol ++; … … 92 81 } 93 82 94 // read config file to see if built with mg or mgpp 95 // (for now we'll just ignore mgpp if on windows) 96 text_t buildtype = "mg"; // mg is default 97 #ifndef __WIN32__ 98 text_tarray cfgline; 99 text_t key; 100 text_t filename = filename_cat(collectdir, *thiscol, "index/build.cfg"); 101 ifstream confin(filename.getcstr()); 102 103 if (confin) { 104 while (read_cfg_line(confin, cfgline) >= 0) { 105 if (cfgline.size() ==2 ) { 106 key = cfgline[0]; 107 cfgline.erase(cfgline.begin()); 108 if (key =="buildtype") { 109 buildtype = cfgline[0]; 110 break; 111 } 112 } 113 } 114 } 83 // create collection server and add to null protocol 84 nproto.add_collection (*thiscol, &recpt, gsdlhome, gsdlhome); 115 85 116 confin.close();117 #endif118 119 collectserver *cserver = new collectserver();120 gdbmclass *gdbmhandler = new gdbmclass();121 122 // add a null filter123 filterclass *filter = new filterclass ();124 cserver->add_filter (filter);125 126 // add a browse filter127 browsefilterclass *browsefilter = new browsefilterclass();128 browsefilter->set_gdbmptr (gdbmhandler);129 130 cserver->add_filter (browsefilter);131 132 if (buildtype == "mg") {133 mgsearchclass *mgsearch = new mgsearchclass();134 135 // add a query filter136 mgqueryfilterclass *queryfilter = new mgqueryfilterclass();137 queryfilter->set_gdbmptr (gdbmhandler);138 queryfilter->set_mgsearchptr (mgsearch);139 cserver->add_filter (queryfilter);140 141 // add a mg and gdbm source142 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();143 mggdbmsource->set_gdbmptr (gdbmhandler);144 mggdbmsource->set_mgsearchptr (mgsearch);145 cserver->add_source (mggdbmsource);146 }147 #ifndef __WIN32__148 149 else if (buildtype == "mgpp") {150 151 mgppsearchclass *mgsearch = new mgppsearchclass();152 153 // add a query filter154 mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();155 queryfilter->set_gdbmptr (gdbmhandler);156 queryfilter->set_mgsearchptr (mgsearch);157 cserver->add_filter (queryfilter);158 159 // add a mg and gdbm source160 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();161 mggdbmsource->set_gdbmptr (gdbmhandler);162 mggdbmsource->set_mgsearchptr (mgsearch);163 cserver->add_source (mggdbmsource);164 165 }166 #endif167 168 // inform collection server and everything it contains about its169 // collection name170 cserver->configure ("collection", *thiscol);171 172 // configure receptionist's collectinfo structure173 text_tarray colinfo;174 colinfo.push_back (*thiscol);175 colinfo.push_back (gsdlhome);176 colinfo.push_back (gsdlhome);177 recpt.configure ("collectinfo", colinfo);178 179 nproto.add_collectserver (cserver);180 86 thiscol ++; 181 87 } 182 88 183 89 // add the protocol to the receptionist 184 90 recpt.add_protocol (&nproto); 185 186 187 91 188 92 // z39.50 stuff - johnmcp … … 226 130 aroutconvert.setmapfile (armapfile); 227 131 recpt.add_converter ("a", &arinconvert, &aroutconvert); 228 132 229 133 // hindi 230 134 // armapfile = filename_cat (gsdlhome, "unicode", "MAPPINGS"); … … 304 208 return 0; 305 209 } 210 -
trunk/gsdl/src/recpt/nullproto.cpp
r1459 r1649 28 28 #include <assert.h> 29 29 30 #include "filter.h" 31 #include "browsefilter.h" 32 #include "mgqueryfilter.h" 33 #include "mgppqueryfilter.h" 34 #include "infodbclass.h" 35 #include "mggdbmsource.h" 36 #include "mgsearch.h" 37 #include "mgppsearch.h" 38 #include "fileutil.h" 39 40 30 41 nullproto::~nullproto() { 31 42 collectservermapclass::iterator here = cservers.begin(); … … 39 50 } 40 51 cservers.clear(); 52 } 53 54 // add_collection sets up the collectionserver and calls 55 // add_collectserver 56 void nullproto::add_collection (const text_t &collection, void *recpt, 57 const text_t &gsdlhome, const text_t &gdbmhome) { 58 59 // read config file to see if built with mg or mgpp 60 // -- we can rely on the collection (and therefore the build.cfg) 61 // being here since this is the null protocol - a nicer way to 62 // do this would be preferable though - Stefan. 63 text_t buildtype = "mg"; // mg is default 64 // (for now we'll just ignore mgpp if on windows) 65 #ifndef __WIN32__ 66 text_tarray cfgline; 67 text_t key; 68 text_t build_cfg = filename_cat(gsdlhome, "collect", collection, "index", "build.cfg"); 69 char *build_cfgc = build_cfg.getcstr(); 70 ifstream confin(build_cfgc); 71 72 if (confin) { 73 while (read_cfg_line(confin, cfgline) >= 0) { 74 if (cfgline.size() == 2) { 75 key = cfgline[0]; 76 cfgline.erase(cfgline.begin()); 77 if (key == "buildtype") { 78 buildtype = cfgline[0]; 79 break; 80 } 81 } 82 } 83 confin.close(); 84 } 85 delete build_cfgc; 86 #endif 87 88 collectserver *cserver = new collectserver(); 89 gdbmclass *gdbmhandler = new gdbmclass(); 90 91 // add a null filter 92 filterclass *filter = new filterclass (); 93 cserver->add_filter (filter); 94 95 // add a browse filter 96 browsefilterclass *browsefilter = new browsefilterclass(); 97 browsefilter->set_gdbmptr (gdbmhandler); 98 99 cserver->add_filter (browsefilter); 100 101 if (buildtype == "mg") { 102 mgsearchclass *mgsearch = new mgsearchclass(); 103 104 // add a query filter 105 mgqueryfilterclass *queryfilter = new mgqueryfilterclass(); 106 queryfilter->set_gdbmptr (gdbmhandler); 107 queryfilter->set_mgsearchptr (mgsearch); 108 cserver->add_filter (queryfilter); 109 110 // add a mg and gdbm source 111 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 112 mggdbmsource->set_gdbmptr (gdbmhandler); 113 mggdbmsource->set_mgsearchptr (mgsearch); 114 cserver->add_source (mggdbmsource); 115 } 116 117 #ifndef __WIN32__ 118 119 else if (buildtype == "mgpp") { 120 121 mgppsearchclass *mgsearch = new mgppsearchclass(); 122 123 // add a query filter 124 mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass(); 125 queryfilter->set_gdbmptr (gdbmhandler); 126 queryfilter->set_mgsearchptr (mgsearch); 127 cserver->add_filter (queryfilter); 128 129 // add a mg and gdbm source 130 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); 131 mggdbmsource->set_gdbmptr (gdbmhandler); 132 mggdbmsource->set_mgsearchptr (mgsearch); 133 cserver->add_source (mggdbmsource); 134 135 } 136 #endif 137 138 // inform collection server and everything it contains about its 139 // collection name 140 cserver->configure ("collection", collection); 141 142 // configure receptionist's collectinfo structure 143 text_tarray colinfo; 144 colinfo.push_back (collection); 145 colinfo.push_back (gsdlhome); 146 colinfo.push_back (gdbmhome); 147 receptionist *rcp = (receptionist *)recpt; 148 rcp->configure ("collectinfo", colinfo); 149 150 add_collectserver (cserver); 41 151 } 42 152 -
trunk/gsdl/src/recpt/nullproto.h
r1459 r1649 31 31 #include "collectserver.h" 32 32 #include "recptproto.h" 33 33 #include "receptionist.h" 34 34 35 35 class nullproto : public recptproto { … … 38 38 public: 39 39 virtual ~nullproto(); 40 41 // add_collection sets up the collectionserver and calls 42 // add_collectserver 43 void add_collection (const text_t &collection, void *recpt, 44 const text_t &gsdlhome, const text_t &gdbmhome); 40 45 41 46 // add_collectserver should be called for each collection server -
trunk/gsdl/src/recpt/recptproto.cpp
r1285 r1649 27 27 #include <assert.h> 28 28 29 30 // add collection server to protocol 31 void recptproto::add_collection (const text_t &/*collection*/, void * /*recpt*/, 32 const text_t &/*gsdlhome*/, const text_t &/*gdbmhome*/) { 33 } 29 34 30 35 // configure should be called for each line in the configuration file -
trunk/gsdl/src/recpt/recptproto.h
r1285 r1649 53 53 class recptproto { 54 54 public: 55 56 // add collection server to protocol 57 virtual void add_collection (const text_t &collection, void *recpt, 58 const text_t &gsdlhome, const text_t &gdbmhome); 59 55 60 // configure should be called for each line in the configuration file 56 61 virtual void configure (const text_t &key, const text_tarray &cfgline); -
trunk/gsdl/src/w32server/cgiwrapper.cpp
r1624 r1649 54 54 #include "receptionist.h" 55 55 #include "nullproto.h" 56 #include "collectserver.h"57 #include "infodbclass.h"58 #include "mggdbmsource.h"59 #include "mgsearch.h"60 56 61 57 // actions … … 79 75 #include "pagedbrowserclass.h" 80 76 #include "htmlbrowserclass.h" 81 82 // filters83 #include "filter.h"84 #include "browsefilter.h"85 #include "mgqueryfilter.h"86 #include "phrasequeryfilter.h"87 77 88 78 // the number of times the library has been accessed … … 396 386 397 387 while (thiscol != endcol) { 398 399 // this memory is created but never destroyed 400 // we're also not doing any error checking to make sure we didn't 401 // run out of memory 402 collectserver *cserver = new collectserver(); 403 gdbmclass *gdbmhandler = new gdbmclass(); 404 mgsearchclass *mgsearch = new mgsearchclass(); 405 406 // add a null filter 407 filterclass *filter = new filterclass(); 408 cserver->add_filter (filter); 409 410 // add a browse filter 411 browsefilterclass *browsefilter = new browsefilterclass(); 412 browsefilter->set_gdbmptr (gdbmhandler); 413 cserver->add_filter (browsefilter); 414 415 // add a query filter 416 mgqueryfilterclass *queryfilter = new mgqueryfilterclass(); 417 queryfilter->set_gdbmptr (gdbmhandler); 418 queryfilter->set_mgsearchptr (mgsearch); 419 cserver->add_filter (queryfilter); 420 421 // add an mg and gdbm source 422 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass(); 423 mggdbmsource->set_gdbmptr (gdbmhandler); 424 mggdbmsource->set_mgsearchptr (mgsearch); 425 cserver->add_source (mggdbmsource); 426 427 // inform collection server and everything it contains about 428 // its collection name 429 cserver->configure ("collection", *thiscol); 430 431 nproto.add_collectserver (cserver); 388 389 // ignore the modelcol 390 if (*thiscol == "modelcol") { 391 thiscol ++; 392 continue; 393 } 394 395 // create collection server and add to null protocol 396 nproto.add_collection (*thiscol, &recpt, gsdl_gsdlhome, gsdl_gsdlhome); 432 397 433 398 thiscol ++;
Note:
See TracChangeset
for help on using the changeset viewer.