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 25231 2012-03-16 08:38:01Z ak19 $
|
---|
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 | #ifdef ENABLE_MG
|
---|
36 | #include "mgsearch.h"
|
---|
37 | #endif
|
---|
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 "gsdlsitecfg.h"
|
---|
64 |
|
---|
65 | int main (int argc, char *argv[]) {
|
---|
66 | receptionist recpt;
|
---|
67 | corbaproto* cproto_array[argc];
|
---|
68 | text_t gsdlhome;
|
---|
69 | text_t collecthome;
|
---|
70 | text_t httpdomain;
|
---|
71 | text_t httpprefix;
|
---|
72 |
|
---|
73 | cproto_array[0] = NULL; // unused
|
---|
74 |
|
---|
75 | if (argc == 1)
|
---|
76 | { cout << "Content-type: text/html" << endl << endl;
|
---|
77 | cout << "Usage: " << argv[0] << " site1.objid [site2.objid ....]" << endl;
|
---|
78 | return 0;
|
---|
79 | }
|
---|
80 |
|
---|
81 | // Strictly speaking httpdomain and httpprefix are not needed.
|
---|
82 | // Need to modifiy site_cfg_read to eliminate this dependency. // ****
|
---|
83 | site_cfg_read(gsdlhome, collecthome, httpdomain, httpprefix);
|
---|
84 |
|
---|
85 | for (int i=1; i<argc; i ++)
|
---|
86 | {
|
---|
87 | // add the protocol to the receptionist
|
---|
88 | cproto_array[i] = new corbaproto(argv[i]);
|
---|
89 | recpt.add_protocol(cproto_array[i]);
|
---|
90 | }
|
---|
91 |
|
---|
92 | // cout << "GRB 2" << endl;
|
---|
93 |
|
---|
94 | // the list of actions. Note: these actions will become invalid
|
---|
95 | // at the end of this function.
|
---|
96 | tipaction atipaction;
|
---|
97 | recpt.add_action(&atipaction);
|
---|
98 |
|
---|
99 | statusaction astatusaction;
|
---|
100 | astatusaction.set_receptionist (&recpt);
|
---|
101 | recpt.add_action (&astatusaction);
|
---|
102 |
|
---|
103 | pageaction apageaction;
|
---|
104 | apageaction.set_receptionist (&recpt);
|
---|
105 | recpt.add_action (&apageaction);
|
---|
106 |
|
---|
107 | pingaction apingaction;
|
---|
108 | recpt.add_action (&apingaction);
|
---|
109 |
|
---|
110 | queryaction aqueryaction;
|
---|
111 | aqueryaction.set_receptionist (&recpt);
|
---|
112 | recpt.add_action (&aqueryaction);
|
---|
113 |
|
---|
114 | documentaction adocumentaction;
|
---|
115 | adocumentaction.set_receptionist (&recpt);
|
---|
116 | recpt.add_action (&adocumentaction);
|
---|
117 |
|
---|
118 | usersaction ausersaction;
|
---|
119 | recpt.add_action (&ausersaction);
|
---|
120 |
|
---|
121 | extlinkaction anextlinkaction;
|
---|
122 | recpt.add_action (&anextlinkaction);
|
---|
123 |
|
---|
124 | authenaction aauthenaction;
|
---|
125 | aauthenaction.set_receptionist(&recpt);
|
---|
126 | recpt.add_action (&aauthenaction);
|
---|
127 |
|
---|
128 | collectoraction acollectoraction;
|
---|
129 | acollectoraction.set_receptionist (&recpt);
|
---|
130 | recpt.add_action(&acollectoraction);
|
---|
131 |
|
---|
132 | // cout << "GRB 3" << endl;
|
---|
133 |
|
---|
134 | // list of browsers
|
---|
135 | vlistbrowserclass avlistbrowserclass;
|
---|
136 | recpt.add_browser (&avlistbrowserclass);
|
---|
137 | recpt.setdefaultbrowser ("VList");
|
---|
138 |
|
---|
139 | hlistbrowserclass ahlistbrowserclass;
|
---|
140 | recpt.add_browser (&ahlistbrowserclass);
|
---|
141 |
|
---|
142 | datelistbrowserclass adatelistbrowserclass;
|
---|
143 | recpt.add_browser (&adatelistbrowserclass);
|
---|
144 |
|
---|
145 | invbrowserclass ainvbrowserclass;
|
---|
146 | recpt.add_browser (&ainvbrowserclass);
|
---|
147 |
|
---|
148 | pagedbrowserclass apagedbrowserclass;
|
---|
149 | recpt.add_browser (&apagedbrowserclass);
|
---|
150 |
|
---|
151 | htmlbrowserclass ahtmlbrowserclass;
|
---|
152 | recpt.add_browser (&ahtmlbrowserclass);
|
---|
153 |
|
---|
154 | cgiwrapper (recpt, "");
|
---|
155 |
|
---|
156 | for (int i=1; i< argc; i++)
|
---|
157 | {
|
---|
158 | delete cproto_array[i];
|
---|
159 | }
|
---|
160 |
|
---|
161 | return 0;
|
---|
162 | }
|
---|
163 |
|
---|