1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * cstrlibrarymain.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 | *
|
---|
25 | *********************************************************************/
|
---|
26 |
|
---|
27 | #include "receptionist.h"
|
---|
28 | #include "cgiwrapper.h"
|
---|
29 | #include "nullproto.h"
|
---|
30 | #include "collectserver.h"
|
---|
31 | #include "filter.h"
|
---|
32 | #include "browsefilter.h"
|
---|
33 | #include "queryfilter.h"
|
---|
34 | #include "infodbclass.h"
|
---|
35 | #include "mgsearch.h"
|
---|
36 | #include "mggdbmsource.h"
|
---|
37 | #include "fileutil.h"
|
---|
38 | #include "collectset.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 "cstrdocaction.h"
|
---|
47 | #include "authenaction.h"
|
---|
48 | #include "usersaction.h"
|
---|
49 | #include "authenaction.h"
|
---|
50 |
|
---|
51 | #include "browserclass.h"
|
---|
52 | #include "vlistbrowserclass.h"
|
---|
53 | #include "hlistbrowserclass.h"
|
---|
54 | #include "datelistbrowserclass.h"
|
---|
55 | #include "invbrowserclass.h"
|
---|
56 | #include "cstrpagedbrowserclass.h"
|
---|
57 | #include "htmlbrowserclass.h"
|
---|
58 |
|
---|
59 | #include "recptconfig.h"
|
---|
60 |
|
---|
61 | int main () {
|
---|
62 | receptionist recpt;
|
---|
63 | nullproto nproto;
|
---|
64 |
|
---|
65 | text_t gsdlhome, httpdomain, httpprefix;
|
---|
66 | // get gsdlhome (if we fail the error will be picked up later -- in
|
---|
67 | // cgiwrapper)
|
---|
68 | site_cfg_read (gsdlhome, httpdomain, httpprefix);
|
---|
69 | collectset *cservers = new collectset();
|
---|
70 | cservers->add_collection ("cstr", &recpt, gsdlhome, gsdlhome);
|
---|
71 |
|
---|
72 | nproto.set_collectset(cservers);
|
---|
73 |
|
---|
74 | // configure the receptionist server list
|
---|
75 | cservers->setReceptionistServers(recpt, gsdlhome);
|
---|
76 |
|
---|
77 | // add the protocol to the receptionist
|
---|
78 | recpt.add_protocol (&nproto);
|
---|
79 |
|
---|
80 | // the list of actions. Note: these actions will become invalid
|
---|
81 | // at the end of this function.
|
---|
82 | statusaction astatusaction;
|
---|
83 | astatusaction.set_receptionist (&recpt);
|
---|
84 | recpt.add_action (&astatusaction);
|
---|
85 |
|
---|
86 | pageaction apageaction;
|
---|
87 | apageaction.set_receptionist (&recpt);
|
---|
88 | recpt.add_action (&apageaction);
|
---|
89 |
|
---|
90 | pingaction apingaction;
|
---|
91 | recpt.add_action (&apingaction);
|
---|
92 |
|
---|
93 | queryaction aqueryaction;
|
---|
94 | aqueryaction.set_receptionist (&recpt);
|
---|
95 | recpt.add_action (&aqueryaction);
|
---|
96 |
|
---|
97 | cstrdocaction adocumentaction;
|
---|
98 | adocumentaction.set_receptionist (&recpt);
|
---|
99 | recpt.add_action (&adocumentaction);
|
---|
100 |
|
---|
101 | usersaction ausersaction;
|
---|
102 | recpt.add_action (&ausersaction);
|
---|
103 |
|
---|
104 | authenaction aauthenaction;
|
---|
105 | aauthenaction.set_receptionist(&recpt);
|
---|
106 | recpt.add_action (&aauthenaction);
|
---|
107 |
|
---|
108 | // list of browsers
|
---|
109 | vlistbrowserclass avlistbrowserclass;
|
---|
110 | recpt.add_browser (&avlistbrowserclass);
|
---|
111 | recpt.setdefaultbrowser ("VList");
|
---|
112 |
|
---|
113 | hlistbrowserclass ahlistbrowserclass;
|
---|
114 | recpt.add_browser (&ahlistbrowserclass);
|
---|
115 |
|
---|
116 | datelistbrowserclass adatelistbrowserclass;
|
---|
117 | recpt.add_browser (&adatelistbrowserclass);
|
---|
118 |
|
---|
119 | invbrowserclass ainvbrowserclass;
|
---|
120 | recpt.add_browser (&ainvbrowserclass);
|
---|
121 |
|
---|
122 | cstrpagedbrowserclass apagedbrowserclass;
|
---|
123 | recpt.add_browser (&apagedbrowserclass);
|
---|
124 |
|
---|
125 | htmlbrowserclass ahtmlbrowserclass;
|
---|
126 | recpt.add_browser (&ahtmlbrowserclass);
|
---|
127 |
|
---|
128 | cgiwrapper (recpt, "cstr");
|
---|
129 | return 0;
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|