source: branches/corba/gsdl/src/recpt/librarymain.cpp@ 1074

Last change on this file since 1074 was 1067, checked in by cs025, 24 years ago

Corba first commit

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