1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * ptmxmain.cpp --
|
---|
4 | * Copyright (C) 2002 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 | #include "collectserver.h"
|
---|
31 | #include "filter.h"
|
---|
32 | #include "browsefilter.h"
|
---|
33 | #include "mgqueryfilter.h"
|
---|
34 | #include "mgppqueryfilter.h"
|
---|
35 | #include "infodbclass.h"
|
---|
36 | #include "mggdbmsource.h"
|
---|
37 | #include "mgsearch.h"
|
---|
38 | #include "mgppsearch.h"
|
---|
39 | #include "collectset.h"
|
---|
40 | #include <assert.h>
|
---|
41 |
|
---|
42 | #include "action.h"
|
---|
43 | #include "pageaction.h"
|
---|
44 | #include "ptmxqueryaction.h"
|
---|
45 | #include "ptmxdocaction.h"
|
---|
46 | #include "extlinkaction.h"
|
---|
47 | #include "phindaction.h"
|
---|
48 |
|
---|
49 | #include "browserclass.h"
|
---|
50 | #include "vlistbrowserclass.h"
|
---|
51 | #include "hlistbrowserclass.h"
|
---|
52 | #include "datelistbrowserclass.h"
|
---|
53 | #include "invbrowserclass.h"
|
---|
54 | #include "pagedbrowserclass.h"
|
---|
55 | #include "htmlbrowserclass.h"
|
---|
56 | #include "phindbrowserclass.h"
|
---|
57 |
|
---|
58 | #include "recptconfig.h"
|
---|
59 |
|
---|
60 | int main () {
|
---|
61 | receptionist recpt;
|
---|
62 | nullproto nproto;
|
---|
63 | text_t gsdlhome;
|
---|
64 |
|
---|
65 | collectset *cservers = new collectset(gsdlhome);
|
---|
66 |
|
---|
67 | // set up the null protocol
|
---|
68 | nproto.set_collectset(cservers);
|
---|
69 |
|
---|
70 | // configure the receptionist server list
|
---|
71 | cservers->setReceptionistServers(recpt, gsdlhome);
|
---|
72 |
|
---|
73 | // add the protocol to the receptionist
|
---|
74 | recpt.add_protocol (&nproto);
|
---|
75 |
|
---|
76 | // the list of actions. Note: these actions will become invalid
|
---|
77 | // at the end of this function.
|
---|
78 | pageaction apageaction;
|
---|
79 | apageaction.set_receptionist (&recpt);
|
---|
80 | recpt.add_action (&apageaction);
|
---|
81 |
|
---|
82 | ptmxqueryaction aqueryaction;
|
---|
83 | aqueryaction.set_receptionist (&recpt);
|
---|
84 | recpt.add_action (&aqueryaction);
|
---|
85 |
|
---|
86 | ptmxdocaction adocumentaction;
|
---|
87 | adocumentaction.set_receptionist (&recpt);
|
---|
88 | recpt.add_action (&adocumentaction);
|
---|
89 |
|
---|
90 | extlinkaction anextlinkaction;
|
---|
91 | recpt.add_action (&anextlinkaction);
|
---|
92 |
|
---|
93 | phindaction aphindaction;
|
---|
94 | recpt.add_action(&aphindaction);
|
---|
95 |
|
---|
96 | // list of browsers
|
---|
97 | vlistbrowserclass avlistbrowserclass;
|
---|
98 | recpt.add_browser (&avlistbrowserclass);
|
---|
99 | recpt.setdefaultbrowser ("VList");
|
---|
100 |
|
---|
101 | hlistbrowserclass ahlistbrowserclass;
|
---|
102 | recpt.add_browser (&ahlistbrowserclass);
|
---|
103 |
|
---|
104 | datelistbrowserclass adatelistbrowserclass;
|
---|
105 | recpt.add_browser (&adatelistbrowserclass);
|
---|
106 |
|
---|
107 | invbrowserclass ainvbrowserclass;
|
---|
108 | recpt.add_browser (&ainvbrowserclass);
|
---|
109 |
|
---|
110 | pagedbrowserclass apagedbrowserclass;
|
---|
111 | recpt.add_browser (&apagedbrowserclass);
|
---|
112 |
|
---|
113 | htmlbrowserclass ahtmlbrowserclass;
|
---|
114 | recpt.add_browser (&ahtmlbrowserclass);
|
---|
115 |
|
---|
116 | phindbrowserclass aphindbrowserclass;
|
---|
117 | recpt.add_browser (&aphindbrowserclass);
|
---|
118 |
|
---|
119 | cgiwrapper (recpt, "ptmx");
|
---|
120 | delete cservers;
|
---|
121 | return 0;
|
---|
122 | }
|
---|