[1860] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * corbaclient.cpp --
|
---|
| 4 | * Copyright (C) 1999 The New Zealand 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 | * $Id: corbaclient.mpp 2113 2001-03-05 00:54:26Z say1 $
|
---|
| 25 | *
|
---|
| 26 | *********************************************************************/
|
---|
| 27 |
|
---|
| 28 | #include "receptionist.h"
|
---|
| 29 | #include "cgiwrapper.h"
|
---|
| 30 | #include "corbaproto.h"
|
---|
| 31 | #include "collectserver.h"
|
---|
| 32 | #include "filter.h"
|
---|
| 33 | #include "browsefilter.h"
|
---|
| 34 | #include "queryfilter.h"
|
---|
| 35 | #include "infodbclass.h"
|
---|
| 36 | #include "mgsearch.h"
|
---|
| 37 | #include "mggdbmsource.h"
|
---|
| 38 | #include "fileutil.h"
|
---|
| 39 | #include <assert.h>
|
---|
| 40 |
|
---|
| 41 | #include "action.h"
|
---|
| 42 | #include "statusaction.h"
|
---|
| 43 | #include "pageaction.h"
|
---|
| 44 | #include "pingaction.h"
|
---|
| 45 | #include "queryaction.h"
|
---|
| 46 | #include "documentaction.h"
|
---|
| 47 | #include "authenaction.h"
|
---|
| 48 | #include "usersaction.h"
|
---|
| 49 | #include "authenaction.h"
|
---|
| 50 | #include "extlinkaction.h"
|
---|
| 51 | #include "tipaction.h"
|
---|
| 52 | #include "collectoraction.h"
|
---|
| 53 |
|
---|
| 54 | #include "browserclass.h"
|
---|
| 55 | #include "vlistbrowserclass.h"
|
---|
| 56 | #include "hlistbrowserclass.h"
|
---|
| 57 | #include "datelistbrowserclass.h"
|
---|
| 58 | #include "invbrowserclass.h"
|
---|
| 59 | #include "pagedbrowserclass.h"
|
---|
| 60 | #include "htmlbrowserclass.h"
|
---|
| 61 |
|
---|
| 62 | // #include "gsdlhome.h"
|
---|
| 63 | #include "recptconfig.h"
|
---|
| 64 |
|
---|
| 65 | int main (int argc, char *argv[]) {
|
---|
| 66 | receptionist recpt;
|
---|
| 67 | corbaproto* cproto_array[argc];
|
---|
| 68 | text_t gsdlhome;
|
---|
| 69 | text_t httpdomain;
|
---|
| 70 | text_t httpprefix;
|
---|
| 71 |
|
---|
| 72 | cproto_array[0] = NULL; // unused
|
---|
| 73 |
|
---|
| 74 | if (argc == 1)
|
---|
| 75 | { cout << "Content-type: text/html" << endl << endl;
|
---|
| 76 | cout << "Usage: " << argv[0] << "site1.objid [site2.objid ....]" << endl;
|
---|
| 77 | return 0;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | // Strictly speaking httpdomain and httpprefix are not needed.
|
---|
| 81 | // Need to modifiy site_cfg_read to eliminate this dependency. // ****
|
---|
| 82 | site_cfg_read(gsdlhome, httpdomain, httpprefix);
|
---|
| 83 |
|
---|
| 84 | for (int i=1; i<argc; i ++)
|
---|
| 85 | {
|
---|
| 86 | // add the protocol to the receptionist
|
---|
| 87 | cproto_array[i] = new corbaproto(argv[i]);
|
---|
| 88 | recpt.add_protocol(cproto_array[i]);
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | // cout << "GRB 2" << endl;
|
---|
| 92 |
|
---|
| 93 | // the list of actions. Note: these actions will become invalid
|
---|
| 94 | // at the end of this function.
|
---|
| 95 | tipaction atipaction;
|
---|
| 96 | recpt.add_action(&atipaction);
|
---|
| 97 |
|
---|
| 98 | statusaction astatusaction;
|
---|
| 99 | astatusaction.set_receptionist (&recpt);
|
---|
| 100 | recpt.add_action (&astatusaction);
|
---|
| 101 |
|
---|
| 102 | pageaction apageaction;
|
---|
| 103 | apageaction.set_receptionist (&recpt);
|
---|
| 104 | recpt.add_action (&apageaction);
|
---|
| 105 |
|
---|
| 106 | pingaction apingaction;
|
---|
| 107 | recpt.add_action (&apingaction);
|
---|
| 108 |
|
---|
| 109 | queryaction aqueryaction;
|
---|
| 110 | aqueryaction.set_receptionist (&recpt);
|
---|
| 111 | recpt.add_action (&aqueryaction);
|
---|
| 112 |
|
---|
| 113 | documentaction adocumentaction;
|
---|
| 114 | adocumentaction.set_receptionist (&recpt);
|
---|
| 115 | recpt.add_action (&adocumentaction);
|
---|
| 116 |
|
---|
| 117 | usersaction ausersaction;
|
---|
| 118 | recpt.add_action (&ausersaction);
|
---|
| 119 |
|
---|
| 120 | extlinkaction anextlinkaction;
|
---|
| 121 | recpt.add_action (&anextlinkaction);
|
---|
| 122 |
|
---|
| 123 | authenaction aauthenaction;
|
---|
| 124 | aauthenaction.set_receptionist(&recpt);
|
---|
| 125 | recpt.add_action (&aauthenaction);
|
---|
| 126 |
|
---|
| 127 | collectoraction acollectoraction;
|
---|
| 128 | acollectoraction.set_receptionist (&recpt);
|
---|
| 129 | recpt.add_action(&acollectoraction);
|
---|
| 130 |
|
---|
| 131 | // cout << "GRB 3" << endl;
|
---|
| 132 |
|
---|
| 133 | // list of browsers
|
---|
| 134 | vlistbrowserclass avlistbrowserclass;
|
---|
| 135 | recpt.add_browser (&avlistbrowserclass);
|
---|
| 136 | recpt.setdefaultbrowser ("VList");
|
---|
| 137 |
|
---|
| 138 | hlistbrowserclass ahlistbrowserclass;
|
---|
| 139 | recpt.add_browser (&ahlistbrowserclass);
|
---|
| 140 |
|
---|
| 141 | datelistbrowserclass adatelistbrowserclass;
|
---|
| 142 | recpt.add_browser (&adatelistbrowserclass);
|
---|
| 143 |
|
---|
| 144 | invbrowserclass ainvbrowserclass;
|
---|
| 145 | recpt.add_browser (&ainvbrowserclass);
|
---|
| 146 |
|
---|
| 147 | pagedbrowserclass apagedbrowserclass;
|
---|
| 148 | recpt.add_browser (&apagedbrowserclass);
|
---|
| 149 |
|
---|
| 150 | htmlbrowserclass ahtmlbrowserclass;
|
---|
| 151 | recpt.add_browser (&ahtmlbrowserclass);
|
---|
| 152 |
|
---|
| 153 | cgiwrapper (recpt, "");
|
---|
| 154 |
|
---|
| 155 | for (int i=1; i< argc; i++)
|
---|
| 156 | {
|
---|
| 157 | delete cproto_array[i];
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | return 0;
|
---|
| 161 | }
|
---|
| 162 |
|
---|