/********************************************************************** * * librarymain.cpp -- * Copyright (C) 1999 The New Zealand Digital Library Project * * PUT COPYRIGHT NOTICE HERE * * $Id: librarymain.cpp 390 1999-07-15 06:08:55Z rjmcnab $ * *********************************************************************/ /* $Log$ Revision 1.8 1999/07/15 06:08:55 rjmcnab Moved the adding of the actions to librarymain so that they can be overriden easier. Revision 1.7 1999/06/15 01:56:12 sjboddie Got multiple collections working Revision 1.6 1999/05/10 03:40:39 sjboddie lots of changes - slowly getting document action sorted out Revision 1.5 1999/04/19 23:56:10 rjmcnab Finished the gdbm metadata stuff Revision 1.4 1999/04/12 03:45:05 rjmcnab Finished the query filter. Revision 1.3 1999/04/06 22:20:35 rjmcnab Got browsefilter working. Revision 1.2 1999/03/05 03:53:54 sjboddie fixed some bugs Revision 1.1 1999/02/21 22:35:22 rjmcnab Initial revision. */ #include "receptionist.h" #include "cgiwrapper.h" #include "nullproto.h" #include "collectserver.h" #include "filter.h" #include "browsefilter.h" #include "queryfilter.h" #include "infodbclass.h" #include "mgsearch.h" #include "mggdbmsource.h" #include #include "action.h" #include "statusaction.h" #include "pageaction.h" #include "pingaction.h" #include "queryaction.h" #include "documentaction.h" #include "authenaction.h" #include "usersaction.h" #include "authenaction.h" int main () { receptionist recpt; nullproto nproto; // add a collection server for each collection text_tarray collections; collections.push_back ("gberg"); collections.push_back ("hdl"); text_tarray::const_iterator thiscol = collections.begin(); text_tarray::const_iterator endcol = collections.end(); while (thiscol != endcol) { // this memory is created but never destroyed // we're also not doing any error checking to make sure we didn't // run out of memory collectserver *cserver = new collectserver(); gdbmclass *gdbmhandler = new gdbmclass(); mgsearchclass *mgsearch = new mgsearchclass(); // add a null filter filterclass *filter = new filterclass (); cserver->add_filter (filter); // add a browse filter browsefilterclass *browsefilter = new browsefilterclass(); browsefilter->set_gdbmptr (gdbmhandler); cserver->add_filter (browsefilter); // add a query filter queryfilterclass *queryfilter = new queryfilterclass(); queryfilter->set_gdbmptr (gdbmhandler); queryfilter->set_mgsearchptr (mgsearch); cserver->add_filter (queryfilter); // add a mg and gdbm source mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass (); mggdbmsource->set_gdbmptr (gdbmhandler); mggdbmsource->set_mgsearchptr (mgsearch); cserver->add_source (mggdbmsource); // inform collection server and everything it contains about its // collection name cserver->configure ("collection", *thiscol); nproto.add_collectserver (cserver); thiscol ++; } // add the protocol to the receptionist recpt.add_protocol (&nproto); // the list of actions. Note: these actions will become invalid // at the end of this function. statusaction astatusaction; astatusaction.set_receptionist (&recpt); recpt.add_action (&astatusaction); pageaction apageaction; apageaction.set_receptionist (&recpt); recpt.add_action (&apageaction); pingaction apingaction; recpt.add_action (&apingaction); queryaction aqueryaction; recpt.add_action (&aqueryaction); documentaction adocumentaction; recpt.add_action (&adocumentaction); usersaction ausersaction; recpt.add_action (&ausersaction); authenaction aauthenaction; aauthenaction.set_receptionist(&recpt); recpt.add_action (&aauthenaction); cgiwrapper (recpt, ""); return 0; }