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

Last change on this file since 11153 was 10018, checked in by mdewsnip, 19 years ago

Replaced the old langaction with the new and much improved gtiaction. Removed all the unnecessary stuff related to this from the Makefile also.

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