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