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

Last change on this file since 2389 was 2389, checked in by dmm9, 23 years ago

creating a browse object

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