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

Last change on this file since 2344 was 2344, checked in by sjboddie, 23 years ago

Made the web library print some more reasonable debug info if gsdlhome
isn't set to a valid value

  • Property svn:keywords set to Author Date Id Revision
File size: 4.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 "receptionist.h"
27#include "cgiwrapper.h"
28#include "fileutil.h"
29#include "nullproto.h"
30// z39.50 stuff - johnmcp
31#if defined(USE_Z3950)
32#include "z3950proto.h"
33#endif
34#include "collectserver.h"
35#include "filter.h"
36#include "browsefilter.h"
37#include "mgqueryfilter.h"
38#include "mgppqueryfilter.h"
39#include "infodbclass.h"
40#include "mggdbmsource.h"
41#include "mgsearch.h"
42#include "mgppsearch.h"
43#include "collectset.h"
44#include <assert.h>
45
46#include "action.h"
47#include "statusaction.h"
48#include "pageaction.h"
49#include "pingaction.h"
50#include "queryaction.h"
51#include "documentaction.h"
52#include "authenaction.h"
53#include "usersaction.h"
54#include "extlinkaction.h"
55#include "tipaction.h"
56#include "collectoraction.h"
57
58#include "browserclass.h"
59#include "vlistbrowserclass.h"
60#include "hlistbrowserclass.h"
61#include "datelistbrowserclass.h"
62#include "invbrowserclass.h"
63#include "pagedbrowserclass.h"
64#include "htmlbrowserclass.h"
65#include "phindbrowserclass.h"
66
67int main () {
68 receptionist recpt;
69 nullproto nproto;
70 collectset *cservers;
71#if defined(USE_Z3950)
72 z3950proto zproto;
73#endif
74 text_t gsdlhome;
75
76 cservers = new collectset(gsdlhome);
77
78 // set up the null protocol
79 nproto.set_collectset(cservers);
80
81 // configure the receptionist server list
82 cservers->setReceptionistServers(recpt, gsdlhome);
83
84 // add the protocol to the receptionist
85 recpt.add_protocol (&nproto);
86
87 // z39.50 stuff - johnmcp
88#if defined(USE_Z3950)
89 // add the z39.50 server information. Read in the file
90 // etc/recpt/z3950.cfg for list of servers and their databases.
91 text_t z3950cfg = filename_cat (gsdlhome, "etc");
92 z3950cfg = filename_cat (z3950cfg, "recpt");
93 z3950cfg = filename_cat (z3950cfg, "z3950.cfg");
94#ifdef USE_FASTCGI
95 // currently can't use z39.50 if fastcgi used
96#warning "Disabling z39.50 support as fastcgi is in use"
97 if (0) {
98#else
99 if (file_exists(z3950cfg)) {
100#endif
101 text_t z3950err = filename_cat (gsdlhome, "etc", "z3950log.txt");
102 zproto.read_config_file(z3950cfg,z3950err);
103 // only add this protocol if we have any servers configured.
104 if (zproto.getServerCount()>0)
105 recpt.add_protocol (&zproto);
106 }
107#endif
108
109 // the list of actions. Note: these actions will become invalid
110 // at the end of this function.
111 tipaction atipaction;
112 recpt.add_action (&atipaction);
113
114 statusaction astatusaction;
115 astatusaction.set_receptionist (&recpt);
116 recpt.add_action (&astatusaction);
117
118 pageaction apageaction;
119 apageaction.set_receptionist (&recpt);
120 recpt.add_action (&apageaction);
121
122 pingaction apingaction;
123 recpt.add_action (&apingaction);
124
125 queryaction aqueryaction;
126 aqueryaction.set_receptionist (&recpt);
127 recpt.add_action (&aqueryaction);
128
129 documentaction adocumentaction;
130 adocumentaction.set_receptionist (&recpt);
131 recpt.add_action (&adocumentaction);
132
133 usersaction ausersaction;
134 recpt.add_action (&ausersaction);
135
136 extlinkaction anextlinkaction;
137 recpt.add_action (&anextlinkaction);
138
139 authenaction aauthenaction;
140 aauthenaction.set_receptionist(&recpt);
141 recpt.add_action (&aauthenaction);
142
143 collectoraction acollectoraction;
144 acollectoraction.set_receptionist (&recpt);
145 recpt.add_action(&acollectoraction);
146
147 // list of browsers
148 vlistbrowserclass avlistbrowserclass;
149 recpt.add_browser (&avlistbrowserclass);
150 recpt.setdefaultbrowser ("VList");
151
152 hlistbrowserclass ahlistbrowserclass;
153 recpt.add_browser (&ahlistbrowserclass);
154
155 datelistbrowserclass adatelistbrowserclass;
156 recpt.add_browser (&adatelistbrowserclass);
157
158 invbrowserclass ainvbrowserclass;
159 recpt.add_browser (&ainvbrowserclass);
160
161 pagedbrowserclass apagedbrowserclass;
162 recpt.add_browser (&apagedbrowserclass);
163
164 htmlbrowserclass ahtmlbrowserclass;
165 recpt.add_browser (&ahtmlbrowserclass);
166
167 phindbrowserclass aphindbrowserclass;
168 recpt.add_browser (&aphindbrowserclass);
169
170 cgiwrapper (recpt, "");
171 delete cservers;
172 return 0;
173}
174
Note: See TracBrowser for help on using the repository browser.