source: trunk/gsdl/src/recpt/librarymain.cpp@ 533

Last change on this file since 533 was 533, checked in by sjboddie, 25 years ago

added GPL notice

  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/**********************************************************************
2 *
3 * librarymain.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: librarymain.cpp 533 1999-09-07 04:57:01Z sjboddie $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.9 1999/09/07 04:56:56 sjboddie
31 added GPL notice
32
33 Revision 1.8 1999/07/15 06:08:55 rjmcnab
34 Moved the adding of the actions to librarymain so that they can
35 be overriden easier.
36
37 Revision 1.7 1999/06/15 01:56:12 sjboddie
38 Got multiple collections working
39
40 Revision 1.6 1999/05/10 03:40:39 sjboddie
41 lots of changes - slowly getting document action sorted out
42
43 Revision 1.5 1999/04/19 23:56:10 rjmcnab
44 Finished the gdbm metadata stuff
45
46 Revision 1.4 1999/04/12 03:45:05 rjmcnab
47 Finished the query filter.
48
49 Revision 1.3 1999/04/06 22:20:35 rjmcnab
50 Got browsefilter working.
51
52 Revision 1.2 1999/03/05 03:53:54 sjboddie
53
54 fixed some bugs
55
56 Revision 1.1 1999/02/21 22:35:22 rjmcnab
57
58 Initial revision.
59
60 */
61
62
63#include "receptionist.h"
64#include "cgiwrapper.h"
65#include "nullproto.h"
66#include "collectserver.h"
67#include "filter.h"
68#include "browsefilter.h"
69#include "queryfilter.h"
70#include "infodbclass.h"
71#include "mgsearch.h"
72#include "mggdbmsource.h"
73#include <assert.h>
74
75#include "action.h"
76#include "statusaction.h"
77#include "pageaction.h"
78#include "pingaction.h"
79#include "queryaction.h"
80#include "documentaction.h"
81#include "authenaction.h"
82#include "usersaction.h"
83#include "authenaction.h"
84
85
86int main () {
87 receptionist recpt;
88 nullproto nproto;
89
90 // add a collection server for each collection
91 text_tarray collections;
92 collections.push_back ("gberg");
93 collections.push_back ("hdl");
94 collections.push_back ("cstr");
95 collections.push_back ("tcc");
96 collections.push_back ("niupepa");
97 collections.push_back ("tidbits");
98 collections.push_back ("hcibib");
99 collections.push_back ("csbib");
100
101 text_tarray::const_iterator thiscol = collections.begin();
102 text_tarray::const_iterator endcol = collections.end();
103
104 while (thiscol != endcol) {
105
106 // this memory is created but never destroyed
107 // we're also not doing any error checking to make sure we didn't
108 // run out of memory
109 collectserver *cserver = new collectserver();
110 gdbmclass *gdbmhandler = new gdbmclass();
111 mgsearchclass *mgsearch = new mgsearchclass();
112
113 // add a null filter
114 filterclass *filter = new filterclass ();
115 cserver->add_filter (filter);
116
117 // add a browse filter
118 browsefilterclass *browsefilter = new browsefilterclass();
119 browsefilter->set_gdbmptr (gdbmhandler);
120 cserver->add_filter (browsefilter);
121
122 // add a query filter
123 queryfilterclass *queryfilter = new queryfilterclass();
124 queryfilter->set_gdbmptr (gdbmhandler);
125 queryfilter->set_mgsearchptr (mgsearch);
126 cserver->add_filter (queryfilter);
127
128 // add a mg and gdbm source
129 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
130 mggdbmsource->set_gdbmptr (gdbmhandler);
131 mggdbmsource->set_mgsearchptr (mgsearch);
132 cserver->add_source (mggdbmsource);
133
134 // inform collection server and everything it contains about its
135 // collection name
136 cserver->configure ("collection", *thiscol);
137
138 nproto.add_collectserver (cserver);
139 thiscol ++;
140 }
141
142 // add the protocol to the receptionist
143 recpt.add_protocol (&nproto);
144
145 // the list of actions. Note: these actions will become invalid
146 // at the end of this function.
147 statusaction astatusaction;
148 astatusaction.set_receptionist (&recpt);
149 recpt.add_action (&astatusaction);
150
151 pageaction apageaction;
152 apageaction.set_receptionist (&recpt);
153 recpt.add_action (&apageaction);
154
155 pingaction apingaction;
156 recpt.add_action (&apingaction);
157
158 queryaction aqueryaction;
159 recpt.add_action (&aqueryaction);
160
161 documentaction adocumentaction;
162 recpt.add_action (&adocumentaction);
163
164 usersaction ausersaction;
165 recpt.add_action (&ausersaction);
166
167 authenaction aauthenaction;
168 aauthenaction.set_receptionist(&recpt);
169 recpt.add_action (&aauthenaction);
170
171 cgiwrapper (recpt, "");
172 return 0;
173}
174
Note: See TracBrowser for help on using the repository browser.