/********************************************************************** * * cstrlibrarymain.cpp -- * Copyright (C) 1999 The New Zealand Digital Library Project * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: cstrlibrarymain.cpp 891 2000-02-01 22:32:36Z sjboddie $ * *********************************************************************/ /* $Log$ Revision 1.1 2000/02/01 22:32:37 sjboddie Initial revision Revision 1.1 1999/09/07 21:49:43 sjboddie new cstr receptionist */ #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 "fileutil.h" #include #include "action.h" #include "statusaction.h" #include "pageaction.h" #include "pingaction.h" #include "queryaction.h" #include "cstrdocaction.h" #include "authenaction.h" #include "usersaction.h" #include "authenaction.h" #include "browserclass.h" #include "vlistbrowserclass.h" #include "hlistbrowserclass.h" #include "datelistbrowserclass.h" #include "invbrowserclass.h" #include "pagedbrowserclass.h" #include "htmlbrowserclass.h" #include "gsdlhome.h" int main () { receptionist recpt; nullproto nproto; // add a collection server text_tarray collections; collections.push_back ("cstr"); 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); // add other converters utf8inconvertclass utf8inconvert; utf8outconvertclass utf8outconvert; recpt.add_converter ("u", &utf8inconvert, &utf8outconvert); mapinconvertclass gbinconvert; gbinconvert.setmapfile (GSDL_GSDLHOME, "gbku", 0x25a1); mapoutconvertclass gboutconvert; gboutconvert.setmapfile (GSDL_GSDLHOME, "ugbk", 0xa1f5); recpt.add_converter ("g", &gbinconvert, &gboutconvert); // 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; recpt.add_action (&apageaction); pingaction apingaction; recpt.add_action (&apingaction); queryaction aqueryaction; recpt.add_action (&aqueryaction); cstrdocaction adocumentaction; recpt.add_action (&adocumentaction); usersaction ausersaction; recpt.add_action (&ausersaction); authenaction aauthenaction; aauthenaction.set_receptionist(&recpt); recpt.add_action (&aauthenaction); // list of browsers vlistbrowserclass avlistbrowserclass; recpt.add_browser (&avlistbrowserclass); recpt.setdefaultbrowser ("VList"); hlistbrowserclass ahlistbrowserclass; recpt.add_browser (&ahlistbrowserclass); datelistbrowserclass adatelistbrowserclass; recpt.add_browser (&adatelistbrowserclass); invbrowserclass ainvbrowserclass; recpt.add_browser (&ainvbrowserclass); pagedbrowserclass apagedbrowserclass; recpt.add_browser (&apagedbrowserclass); htmlbrowserclass ahtmlbrowserclass; recpt.add_browser (&ahtmlbrowserclass); cgiwrapper (recpt, "cstr"); return 0; }