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

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

Got multiple collections working

  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/**********************************************************************
2 *
3 * librarymain.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: librarymain.cpp 268 1999-06-15 01:56:12Z sjboddie $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.7 1999/06/15 01:56:12 sjboddie
15 Got multiple collections working
16
17 Revision 1.6 1999/05/10 03:40:39 sjboddie
18 lots of changes - slowly getting document action sorted out
19
20 Revision 1.5 1999/04/19 23:56:10 rjmcnab
21 Finished the gdbm metadata stuff
22
23 Revision 1.4 1999/04/12 03:45:05 rjmcnab
24 Finished the query filter.
25
26 Revision 1.3 1999/04/06 22:20:35 rjmcnab
27 Got browsefilter working.
28
29 Revision 1.2 1999/03/05 03:53:54 sjboddie
30
31 fixed some bugs
32
33 Revision 1.1 1999/02/21 22:35:22 rjmcnab
34
35 Initial revision.
36
37 */
38
39
40#include "receptionist.h"
41#include "cgiwrapper.h"
42#include "nullproto.h"
43#include "collectserver.h"
44#include "filter.h"
45#include "browsefilter.h"
46#include "queryfilter.h"
47#include "infodbclass.h"
48#include "mgsearch.h"
49#include "mggdbmsource.h"
50#include <assert.h>
51
52int main () {
53 receptionist recpt;
54 nullproto nproto;
55
56 // add a collection server for each collection
57 text_tarray collections;
58 collections.push_back ("gberg");
59 collections.push_back ("hdl");
60
61 text_tarray::const_iterator thiscol = collections.begin();
62 text_tarray::const_iterator endcol = collections.end();
63
64 while (thiscol != endcol) {
65
66 // this memory is created but never destroyed
67 // we're also not doing any error checking to make sure we didn't
68 // run out of memory
69 collectserver *cserver = new collectserver();
70 gdbmclass *gdbmhandler = new gdbmclass();
71 mgsearchclass *mgsearch = new mgsearchclass();
72
73 // add a null filter
74 filterclass *filter = new filterclass ();
75 cserver->add_filter (filter);
76
77 // add a browse filter
78 browsefilterclass *browsefilter = new browsefilterclass();
79 browsefilter->set_gdbmptr (gdbmhandler);
80 cserver->add_filter (browsefilter);
81
82 // add a query filter
83 queryfilterclass *queryfilter = new queryfilterclass();
84 queryfilter->set_gdbmptr (gdbmhandler);
85 queryfilter->set_mgsearchptr (mgsearch);
86 cserver->add_filter (queryfilter);
87
88 // add a mg and gdbm source
89 mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
90 mggdbmsource->set_gdbmptr (gdbmhandler);
91 mggdbmsource->set_mgsearchptr (mgsearch);
92 cserver->add_source (mggdbmsource);
93
94 // inform collection server and everything it contains about its
95 // collection name
96 cserver->configure ("collection", *thiscol);
97
98 nproto.add_collectserver (cserver);
99 thiscol ++;
100 }
101
102 // add the protocol to the receptionist
103 recpt.add_protocol (&nproto);
104
105 cgiwrapper (recpt, "");
106 return 0;
107}
108
Note: See TracBrowser for help on using the repository browser.