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

Last change on this file since 7432 was 7432, checked in by mdewsnip, 20 years ago

(Human Info) Added language parameter to all calls of get_info, get_children, has_children, and get_contents. Also, removed some of the modifications so it compiles again.

  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1/**********************************************************************
2 *
3 * librarymain.cpp --
4 * Copyright (C) 1999 The New Zaland 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 *********************************************************************/
25
26#include "gsdl_modules_cfg.h"
27#include "receptionist.h"
28#include "cgiwrapper.h"
29#include "recptconfig.h"
30#include "fileutil.h"
31#include "nullproto.h"
32// z39.50 stuff - johnmcp
33#if defined(USE_Z3950)
34#include "z3950proto.h"
35#endif
36#include "collectserver.h"
37#include "filter.h"
38#include "browsefilter.h"
39#include "mgqueryfilter.h"
40#include "mgppqueryfilter.h"
41#include "infodbclass.h"
42#include "mggdbmsource.h"
43#include "mgsearch.h"
44#include "mgppsearch.h"
45#include "collectset.h"
46#include <assert.h>
47
48#include "action.h"
49#include "statusaction.h"
50#include "pageaction.h"
51#include "pingaction.h"
52#include "queryaction.h"
53#include "documentaction.h"
54#include "authenaction.h"
55#include "usersaction.h"
56#include "extlinkaction.h"
57
58#ifdef GSDL_USE_EXPORT_ACTION
59#include "exportaction.h"
60#endif
61
62#ifdef GSDL_USE_CL_DISPLAY_ACTION
63#include "cldisplayaction.h"
64#endif
65
66#ifdef GSDL_USE_COURSES_ACTION
67#include "coursesaction.h"
68#endif
69
70#ifdef GSDL_USE_COMPOSITION_ACTION
71#include "compositionaction.h"
72#endif
73
74#ifdef GSDL_USE_INDEX_BROWSE_ACTION
75#include "indexbrowseaction.h"
76#endif
77
78#ifdef GSDL_USE_DIR_BROWSE_ACTION
79#include "dirbrowseaction.h"
80#endif
81
82#ifdef GSDL_USE_GENERATOR_ACTION
83#include "generatoraction.h"
84#endif
85
86#include "tipaction.h"
87#include "collectoraction.h"
88#include "browseaction.h"
89#include "phindaction.h"
90#if defined(GSDL_USE_LANG_ACTION)
91#include "langaction.h"
92#endif
93
94#include "browserclass.h"
95#include "vlistbrowserclass.h"
96#include "hlistbrowserclass.h"
97#include "datelistbrowserclass.h"
98#include "invbrowserclass.h"
99#include "pagedbrowserclass.h"
100#include "htmlbrowserclass.h"
101#include "phindbrowserclass.h"
102
103#ifdef GSDL_USE_CLASSIFIER_BROWSER
104//classifier browsers
105
106#include "treeclassifierbrowserclass.h"
107#ifdef GSDL_USE_TREE_EX_CLASSIFIER_BROWSER
108#include "treeexclassifierbrowserclass.h"
109#endif
110
111#endif //GSDL_USE_CLASSIFIER_BROWSER
112
113int main () {
114 receptionist recpt;
115 nullproto nproto;
116 collectset *cservers;
117#if defined(USE_Z3950)
118 z3950proto zproto;
119#endif
120 text_t gsdlhome;
121
122 cservers = new collectset(gsdlhome);
123
124 // set up the null protocol
125 nproto.set_collectset(cservers);
126
127 // configure the receptionist server list
128 cservers->setReceptionistServers(recpt, gsdlhome);
129
130 // add the protocol to the receptionist
131 recpt.add_protocol (&nproto);
132
133 // z39.50 stuff - johnmcp
134#if defined(USE_Z3950)
135 // add the z39.50 server information. Read in the file
136 // etc/recpt/z3950.cfg for list of servers and their databases.
137 text_t z3950cfg = filename_cat (gsdlhome, "etc");
138 // z3950cfg = filename_cat (z3950cfg, "recpt");
139 z3950cfg = filename_cat (z3950cfg, "packages");
140 z3950cfg = filename_cat (z3950cfg, "z3950.cfg");
141#ifdef USE_FASTCGI
142 // currently can't use z39.50 if fastcgi used
143#warning "Disabling z39.50 support as fastcgi is in use"
144 if (0) {
145#else
146 if (file_exists(z3950cfg)) {
147#endif
148 text_t z3950err = filename_cat (gsdlhome, "etc", "z3950log.txt");
149 zproto.read_config_file(z3950cfg,z3950err);
150 // only add this protocol if we have any servers configured.
151 if (zproto.getServerCount()>0)
152 recpt.add_protocol (&zproto);
153 }
154#endif
155
156#ifdef GSDL_USE_TIP_ACTION
157 // the list of actions. Note: these actions will become invalid
158 // at the end of this function. We will clean them.
159 recpt.add_action (new tipaction());
160#endif
161
162#ifdef GSDL_USE_STATUS_ACTION
163 statusaction *astatusaction = new statusaction();
164 astatusaction->set_receptionist (&recpt);
165 recpt.add_action (astatusaction);
166#endif
167
168 pageaction *apageaction = new pageaction();
169 apageaction->set_receptionist (&recpt);
170 recpt.add_action (apageaction);
171
172#ifdef GSDL_USE_PING_ACTION
173 recpt.add_action (new pingaction());
174#endif
175
176 queryaction *aqueryaction = new queryaction();
177 aqueryaction->set_receptionist (&recpt);
178 recpt.add_action (aqueryaction);
179
180 documentaction *adocumentaction = new documentaction();
181 adocumentaction->set_receptionist (&recpt);
182 recpt.add_action (adocumentaction);
183
184#ifdef GSDL_USE_USERS_ACTION
185 recpt.add_action (new usersaction());
186#endif
187
188#ifdef GSDL_USE_EXTLINK_ACTION
189 recpt.add_action (new extlinkaction());
190#endif
191
192#ifdef GSDL_USE_AUTHEN_ACTION
193 authenaction *aauthenaction = new authenaction();
194 aauthenaction->set_receptionist(&recpt);
195 recpt.add_action (aauthenaction);
196#endif
197
198#ifdef GSDL_USE_COLLECTOR_ACTION
199 collectoraction *acollectoraction = new collectoraction();
200 acollectoraction->set_receptionist (&recpt);
201 recpt.add_action(acollectoraction);
202#endif
203
204#ifdef GSDL_USE_BROWSE_ACTION
205 browseaction *abrowseaction = new browseaction();
206 abrowseaction->set_receptionist (&recpt);
207 recpt.add_action(abrowseaction);
208#endif
209
210#ifdef GSDL_USE_PHIND_ACTION
211 recpt.add_action(new phindaction());
212#endif
213
214#ifdef GSDL_USE_LANG_ACTION
215 langaction *alangaction = new langaction();
216 alangaction->set_receptionist(&recpt);
217 recpt.add_action(alangaction);
218#endif
219
220 // list of browsers
221 vlistbrowserclass avlistbrowserclass;
222 avlistbrowserclass.set_receptionist(&recpt);
223 recpt.add_browser (&avlistbrowserclass);
224 recpt.setdefaultbrowser ("VList");
225
226 hlistbrowserclass ahlistbrowserclass;
227 ahlistbrowserclass.set_receptionist(&recpt);
228 recpt.add_browser (&ahlistbrowserclass);
229
230#ifdef GSDL_USE_DATELIST_BROWSER
231 datelistbrowserclass adatelistbrowserclass;
232 recpt.add_browser (&adatelistbrowserclass);
233#endif
234
235 invbrowserclass ainvbrowserclass;
236 recpt.add_browser (&ainvbrowserclass);
237
238#ifdef GSDL_USE_PAGED_BROWSER
239 pagedbrowserclass apagedbrowserclass;
240 recpt.add_browser (&apagedbrowserclass);
241#endif
242
243#ifdef GSDL_USE_HTML_BROWSER
244 htmlbrowserclass ahtmlbrowserclass;
245 recpt.add_browser (&ahtmlbrowserclass);
246#endif
247
248#ifdef GSDL_USE_PHIND_BROWSER
249 phindbrowserclass aphindbrowserclass;
250 recpt.add_browser (&aphindbrowserclass);
251#endif
252
253#ifdef GSDL_USE_CLASSIFIER_BROWSER
254 //list of classifier browsers
255 CTreeClassifierBrowserClass *pTreeClassifierBrowser = new CTreeClassifierBrowserClass();
256 if (pTreeClassifierBrowser != NULL) {
257 recpt.GetClassifierBrowsers().AddBrowser(pTreeClassifierBrowser);
258 recpt.GetClassifierBrowsers().SetDefaultBrowser(pTreeClassifierBrowser->GetBrowserName());
259 }
260#ifdef GSDL_USE_TREE_EX_CLASSIFIER_BROWSER
261 CTreeExClassifierBrowserClass *pTreeExClassifierBrowser = new CTreeExClassifierBrowserClass();
262 if (pTreeExClassifierBrowser != NULL) {
263 recpt.GetClassifierBrowsers().AddBrowser(pTreeExClassifierBrowser);
264 }
265#endif //GSDL_USE_TREE_EX_CLASSIFIER_BROWSER
266#endif //GSDL_USE_CLASSIFIER_BROWSER
267
268 cgiwrapper (recpt, "");
269 delete cservers;
270
271 // clean up the actions
272 actionmapclass::iterator thisAction = recpt.get_actionmap_ptr()->begin();
273 actionmapclass::iterator endAction = recpt.get_actionmap_ptr()->begin();
274 while (thisAction != endAction) {
275 delete thisAction->second.a; thisAction->second.a = NULL;
276 ++thisAction;
277 }
278 thisAction = recpt.get_actionmap_ptr()->begin();
279 recpt.get_actionmap_ptr()->erase(thisAction, endAction);
280 return 0;
281}
282
283
284
285
286
287
288
Note: See TracBrowser for help on using the repository browser.