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

Last change on this file since 9948 was 9931, checked in by kjdon, 19 years ago

getting collectionmeta from teh colinforesponse now, not using a get_info via the protocol. this means that collmeta will be read from the config file not from the database - it will not require rebuilding for changes to take effect.

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