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

Last change on this file since 3007 was 2572, checked in by jrm21, 23 years ago

z3950 client config file moved from etc/recpt to etc/packages, so we
now look there instead.

  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
RevLine 
[166]1/**********************************************************************
2 *
3 * librarymain.cpp --
[1937]4 * Copyright (C) 1999 The New Zaland Digital Library Project
[166]5 *
[533]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.
[166]9 *
[533]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 *
[166]24 *********************************************************************/
25
26#include "receptionist.h"
27#include "cgiwrapper.h"
[1649]28#include "fileutil.h"
[166]29#include "nullproto.h"
[1347]30// z39.50 stuff - johnmcp
[1937]31#if defined(USE_Z3950)
[1347]32#include "z3950proto.h"
[1937]33#endif
[1860]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>
[166]45
[390]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"
[722]54#include "extlinkaction.h"
[1391]55#include "tipaction.h"
[1419]56#include "collectoraction.h"
[2389]57#include "browseaction.h"
[2487]58#include "phindaction.h"
[390]59
[649]60#include "browserclass.h"
61#include "vlistbrowserclass.h"
62#include "hlistbrowserclass.h"
63#include "datelistbrowserclass.h"
64#include "invbrowserclass.h"
[672]65#include "pagedbrowserclass.h"
[713]66#include "htmlbrowserclass.h"
[1643]67#include "phindbrowserclass.h"
[649]68
[166]69int main () {
70 receptionist recpt;
[1860]71 nullproto nproto;
72 collectset *cservers;
[1937]73#if defined(USE_Z3950)
[1860]74 z3950proto zproto;
[1429]75#endif
[1860]76 text_t gsdlhome;
[1327]77
[1860]78 cservers = new collectset(gsdlhome);
[226]79
[1860]80 // set up the null protocol
81 nproto.set_collectset(cservers);
82
83 // configure the receptionist server list
84 cservers->setReceptionistServers(recpt, gsdlhome);
85
[166]86 // add the protocol to the receptionist
87 recpt.add_protocol (&nproto);
[1347]88
89 // z39.50 stuff - johnmcp
[1937]90#if defined(USE_Z3950)
[1347]91 // add the z39.50 server information. Read in the file
92 // etc/recpt/z3950.cfg for list of servers and their databases.
93 text_t z3950cfg = filename_cat (gsdlhome, "etc");
[2572]94 // z3950cfg = filename_cat (z3950cfg, "recpt");
95 z3950cfg = filename_cat (z3950cfg, "packages");
[1347]96 z3950cfg = filename_cat (z3950cfg, "z3950.cfg");
[1366]97#ifdef USE_FASTCGI
[1937]98 // currently can't use z39.50 if fastcgi used
99#warning "Disabling z39.50 support as fastcgi is in use"
[1366]100 if (0) {
101#else
[1347]102 if (file_exists(z3950cfg)) {
[1366]103#endif
[1471]104 text_t z3950err = filename_cat (gsdlhome, "etc", "z3950log.txt");
[1355]105 zproto.read_config_file(z3950cfg,z3950err);
[1347]106 // only add this protocol if we have any servers configured.
107 if (zproto.getServerCount()>0)
108 recpt.add_protocol (&zproto);
109 }
[1429]110#endif
[1347]111
[390]112 // the list of actions. Note: these actions will become invalid
113 // at the end of this function.
[1391]114 tipaction atipaction;
115 recpt.add_action (&atipaction);
116
[390]117 statusaction astatusaction;
118 astatusaction.set_receptionist (&recpt);
119 recpt.add_action (&astatusaction);
120
121 pageaction apageaction;
[1270]122 apageaction.set_receptionist (&recpt);
[390]123 recpt.add_action (&apageaction);
124
125 pingaction apingaction;
126 recpt.add_action (&apingaction);
127
128 queryaction aqueryaction;
[1270]129 aqueryaction.set_receptionist (&recpt);
[390]130 recpt.add_action (&aqueryaction);
131
132 documentaction adocumentaction;
[1270]133 adocumentaction.set_receptionist (&recpt);
[390]134 recpt.add_action (&adocumentaction);
135
136 usersaction ausersaction;
137 recpt.add_action (&ausersaction);
138
[722]139 extlinkaction anextlinkaction;
140 recpt.add_action (&anextlinkaction);
141
[390]142 authenaction aauthenaction;
143 aauthenaction.set_receptionist(&recpt);
144 recpt.add_action (&aauthenaction);
145
[1419]146 collectoraction acollectoraction;
147 acollectoraction.set_receptionist (&recpt);
148 recpt.add_action(&acollectoraction);
149
[2389]150 browseaction abrowseaction;
151 abrowseaction.set_receptionist (&recpt);
152 recpt.add_action(&abrowseaction);
153
[2487]154 phindaction aphindaction;
155 recpt.add_action(&aphindaction);
156
[649]157 // list of browsers
158 vlistbrowserclass avlistbrowserclass;
159 recpt.add_browser (&avlistbrowserclass);
160 recpt.setdefaultbrowser ("VList");
161
162 hlistbrowserclass ahlistbrowserclass;
163 recpt.add_browser (&ahlistbrowserclass);
164
165 datelistbrowserclass adatelistbrowserclass;
166 recpt.add_browser (&adatelistbrowserclass);
167
168 invbrowserclass ainvbrowserclass;
169 recpt.add_browser (&ainvbrowserclass);
170
[672]171 pagedbrowserclass apagedbrowserclass;
172 recpt.add_browser (&apagedbrowserclass);
173
[713]174 htmlbrowserclass ahtmlbrowserclass;
175 recpt.add_browser (&ahtmlbrowserclass);
176
[1643]177 phindbrowserclass aphindbrowserclass;
178 recpt.add_browser (&aphindbrowserclass);
179
[268]180 cgiwrapper (recpt, "");
[1860]181 delete cservers;
[166]182 return 0;
183}
[1649]184
[2389]185
186
187
188
189
190
Note: See TracBrowser for help on using the repository browser.