source: trunk/gsdl/src/recpt/librarymain.cpp@ 934

Last change on this file since 934 was 928, checked in by kjm18, 24 years ago

search history stuff added.

  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 KB
RevLine 
[166]1/**********************************************************************
2 *
3 * librarymain.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
[533]6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
[166]9 *
[533]10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
[166]24 * $Id: librarymain.cpp 928 2000-02-15 22:53:52Z kjm18 $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
[928]30 Revision 1.21 2000/02/15 22:53:51 kjm18
31 search history stuff added.
32
[826]33 Revision 1.20 1999/12/13 02:46:56 davidb
34 Teach buildaction about recptionist
35
[762]36 Revision 1.19 1999/11/01 21:58:49 sjboddie
37 no longer set receptionist for some actions that used to
38
[746]39 Revision 1.18 1999/10/25 22:29:31 sjboddie
40 receptionist now checks collect diectory for collections
41 rather than collections.txt file
42
[722]43 Revision 1.17 1999/10/19 03:23:43 davidb
44 Collection building support through web pages
45 and internal and external link handling for collection documents
46
[713]47 Revision 1.16 1999/10/18 20:07:33 sjboddie
48 added htmlbrowserclass
49
[672]50 Revision 1.15 1999/10/14 23:03:10 sjboddie
51 another browser
52
[649]53 Revision 1.14 1999/10/10 08:14:09 sjboddie
54 - metadata now returns mp rather than array
55 - redesigned browsing support (although it's not finished so
56 won't currently work ;-)
57
[596]58 Revision 1.13 1999/09/16 21:39:35 sjboddie
59 added gb converters
60
[586]61 Revision 1.12 1999/09/14 22:42:06 sjboddie
62 included utf8 converter
63
[584]64 Revision 1.11 1999/09/14 22:03:27 sjboddie
65 now reads in collections from a file to avoid recompiling
66
[547]67 Revision 1.10 1999/09/08 00:51:11 sjboddie
68 removed old interface stuff
69
[533]70 Revision 1.9 1999/09/07 04:56:56 sjboddie
71 added GPL notice
72
[390]73 Revision 1.8 1999/07/15 06:08:55 rjmcnab
74 Moved the adding of the actions to librarymain so that they can
75 be overriden easier.
76
[268]77 Revision 1.7 1999/06/15 01:56:12 sjboddie
78 Got multiple collections working
79
[257]80 Revision 1.6 1999/05/10 03:40:39 sjboddie
81 lots of changes - slowly getting document action sorted out
82
[238]83 Revision 1.5 1999/04/19 23:56:10 rjmcnab
84 Finished the gdbm metadata stuff
85
[235]86 Revision 1.4 1999/04/12 03:45:05 rjmcnab
87 Finished the query filter.
88
[226]89 Revision 1.3 1999/04/06 22:20:35 rjmcnab
90 Got browsefilter working.
91
[189]92 Revision 1.2 1999/03/05 03:53:54 sjboddie
93
94 fixed some bugs
95
[166]96 Revision 1.1 1999/02/21 22:35:22 rjmcnab
97
98 Initial revision.
99
100 */
101
102
103#include "receptionist.h"
104#include "cgiwrapper.h"
105#include "nullproto.h"
106#include "collectserver.h"
[226]107#include "filter.h"
108#include "browsefilter.h"
109#include "queryfilter.h"
110#include "infodbclass.h"
111#include "mgsearch.h"
[238]112#include "mggdbmsource.h"
[746]113#include "fileutil.h"
[166]114#include <assert.h>
115
[390]116#include "action.h"
117#include "statusaction.h"
118#include "pageaction.h"
119#include "pingaction.h"
120#include "queryaction.h"
121#include "documentaction.h"
122#include "authenaction.h"
123#include "usersaction.h"
124#include "authenaction.h"
[722]125#include "extlinkaction.h"
126#include "buildaction.h"
[928]127#include "delhistoryaction.h"
128//#include "bibqueryaction.h"
129//#include "bibindexaction.h"
130//#include "bibdatabaseaction.h"
[390]131
[649]132#include "browserclass.h"
133#include "vlistbrowserclass.h"
134#include "hlistbrowserclass.h"
135#include "datelistbrowserclass.h"
136#include "invbrowserclass.h"
[672]137#include "pagedbrowserclass.h"
[713]138#include "htmlbrowserclass.h"
[649]139
[584]140#include "gsdlhome.h"
[390]141
[166]142int main () {
143 receptionist recpt;
144 nullproto nproto;
[584]145
[268]146 text_tarray collections;
[746]147 if (!read_dir (GSDL_GSDLHOME "/collect", collections)) exit (1);
[226]148
[268]149 text_tarray::const_iterator thiscol = collections.begin();
150 text_tarray::const_iterator endcol = collections.end();
[226]151
[268]152 while (thiscol != endcol) {
[226]153
[746]154 // ignore the modelcol
155 if (*thiscol == "modelcol") {
156 thiscol ++;
157 continue;
158 }
159
[268]160 // this memory is created but never destroyed
161 // we're also not doing any error checking to make sure we didn't
162 // run out of memory
163 collectserver *cserver = new collectserver();
164 gdbmclass *gdbmhandler = new gdbmclass();
165 mgsearchclass *mgsearch = new mgsearchclass();
166
[257]167 // add a null filter
[268]168 filterclass *filter = new filterclass ();
169 cserver->add_filter (filter);
[257]170
171 // add a browse filter
[268]172 browsefilterclass *browsefilter = new browsefilterclass();
173 browsefilter->set_gdbmptr (gdbmhandler);
174 cserver->add_filter (browsefilter);
[257]175
176 // add a query filter
[268]177 queryfilterclass *queryfilter = new queryfilterclass();
178 queryfilter->set_gdbmptr (gdbmhandler);
179 queryfilter->set_mgsearchptr (mgsearch);
180 cserver->add_filter (queryfilter);
[533]181
[257]182 // add a mg and gdbm source
[268]183 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
184 mggdbmsource->set_gdbmptr (gdbmhandler);
185 mggdbmsource->set_mgsearchptr (mgsearch);
186 cserver->add_source (mggdbmsource);
[257]187
188 // inform collection server and everything it contains about its
189 // collection name
[268]190 cserver->configure ("collection", *thiscol);
[257]191
[268]192 nproto.add_collectserver (cserver);
193 thiscol ++;
194 }
195
[166]196 // add the protocol to the receptionist
197 recpt.add_protocol (&nproto);
198
[586]199 // add other converters
200 utf8inconvertclass utf8inconvert;
201 utf8outconvertclass utf8outconvert;
202 recpt.add_converter ("u", &utf8inconvert, &utf8outconvert);
203
[596]204 mapinconvertclass gbinconvert;
205 gbinconvert.setmapfile (GSDL_GSDLHOME, "gbku", 0x25a1);
206 mapoutconvertclass gboutconvert;
207 gboutconvert.setmapfile (GSDL_GSDLHOME, "ugbk", 0xa1f5);
208 recpt.add_converter ("g", &gbinconvert, &gboutconvert);
209
[390]210 // the list of actions. Note: these actions will become invalid
211 // at the end of this function.
212 statusaction astatusaction;
213 astatusaction.set_receptionist (&recpt);
214 recpt.add_action (&astatusaction);
215
216 pageaction apageaction;
217 recpt.add_action (&apageaction);
218
219 pingaction apingaction;
220 recpt.add_action (&apingaction);
221
222 queryaction aqueryaction;
223 recpt.add_action (&aqueryaction);
224
225 documentaction adocumentaction;
226 recpt.add_action (&adocumentaction);
227
228 usersaction ausersaction;
229 recpt.add_action (&ausersaction);
230
[722]231 extlinkaction anextlinkaction;
232 recpt.add_action (&anextlinkaction);
233
234 buildaction abuildaction;
[826]235 abuildaction.set_receptionist (&recpt);
[722]236 recpt.add_action (&abuildaction);
237
[390]238 authenaction aauthenaction;
239 aauthenaction.set_receptionist(&recpt);
240 recpt.add_action (&aauthenaction);
241
[928]242 delhistoryaction adelhistoryaction;
243 recpt.add_action(&adelhistoryaction);
244
245 // bibqueryaction abibqueryaction;
246 //recpt.add_action(&abibqueryaction);
247
248 // bibindexaction abibindexaction;
249 //recpt.add_action (&abibindexaction);
250
251 // bibdatabaseaction abibdatabaseaction;
252 //recpt.add_action(&abibdatabaseaction):
[649]253 // list of browsers
254 vlistbrowserclass avlistbrowserclass;
255 recpt.add_browser (&avlistbrowserclass);
256 recpt.setdefaultbrowser ("VList");
257
258 hlistbrowserclass ahlistbrowserclass;
259 recpt.add_browser (&ahlistbrowserclass);
260
261 datelistbrowserclass adatelistbrowserclass;
262 recpt.add_browser (&adatelistbrowserclass);
263
264 invbrowserclass ainvbrowserclass;
265 recpt.add_browser (&ainvbrowserclass);
266
[672]267 pagedbrowserclass apagedbrowserclass;
268 recpt.add_browser (&apagedbrowserclass);
269
[713]270 htmlbrowserclass ahtmlbrowserclass;
271 recpt.add_browser (&ahtmlbrowserclass);
272
[268]273 cgiwrapper (recpt, "");
[166]274 return 0;
275}
276
[928]277
278
279
280
Note: See TracBrowser for help on using the repository browser.