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