Changeset 1327


Ignore:
Timestamp:
2000-08-02T14:05:36+12:00 (24 years ago)
Author:
kjm18
Message:

incorporated support for mgpp collections. searchclass and queryfilter type (mg/mgpp)
for a collection are determined on basis of buildtype field in build.cfg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/librarymain.cpp

    r1285 r1327  
    3030#include "filter.h"
    3131#include "browsefilter.h"
    32 #include "queryfilter.h"
     32#include "mgqueryfilter.h"
     33#include "mgppqueryfilter.h"
    3334#include "infodbclass.h"
     35#include "mggdbmsource.h"
    3436#include "mgsearch.h"
    35 #include "mggdbmsource.h"
     37#include "mgppsearch.h"
    3638#include "fileutil.h"
    3739#include <assert.h>
     
    6264  receptionist recpt;
    6365  nullproto nproto;
     66
    6467  text_tarray collections;
    6568
     
    6972  text_t collectdir = filename_cat (gsdlhome, "collect");
    7073  read_dir (collectdir, collections);
    71 
     74 
    7275  text_tarray::const_iterator thiscol = collections.begin();
    7376  text_tarray::const_iterator endcol = collections.end();
     
    7679   
    7780    // ignore the modelcol
    78     if (*thiscol == "modelcol") {thiscol ++; continue;}
    79    
     81
     82    if (*thiscol == "modelcol") {
     83      thiscol ++;
     84      continue;
     85    }
     86   
     87    // read config file to see if built with mg or mgpp
     88    text_t buildtype = "mg"; // mg is default
     89    text_tarray cfgline;
     90    text_t key;
     91    text_t filename = filename_cat(collectdir, *thiscol, "index/build.cfg");
     92    ifstream confin(filename.getcstr());
     93
     94    if (confin) {
     95      while (read_cfg_line(confin, cfgline) >= 0) {
     96    if (cfgline.size() ==2 ) {
     97      key = cfgline[0];
     98      cfgline.erase(cfgline.begin());
     99      if (key =="buildtype") {
     100        buildtype = cfgline[0];
     101        break;
     102      }
     103    }
     104      }
     105    }
     106   
     107    confin.close();
     108
    80109    // this memory is created but never destroyed
    81110    // we're also not doing any error checking to make sure we didn't
     
    83112    collectserver *cserver = new collectserver();
    84113    gdbmclass *gdbmhandler = new gdbmclass();
    85     mgsearchclass *mgsearch = new mgsearchclass();
    86    
     114
    87115    // add a null filter
    88116    filterclass *filter = new filterclass ();
     
    92120    browsefilterclass *browsefilter = new browsefilterclass();
    93121    browsefilter->set_gdbmptr (gdbmhandler);
    94     cserver->add_filter (browsefilter);
    95    
    96     // add a query filter
    97     queryfilterclass *queryfilter = new queryfilterclass();
    98     queryfilter->set_gdbmptr (gdbmhandler);
    99     queryfilter->set_mgsearchptr (mgsearch);
    100     cserver->add_filter (queryfilter);
    101    
    102     // add a mg and gdbm source
    103     mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
    104     mggdbmsource->set_gdbmptr (gdbmhandler);
    105     mggdbmsource->set_mgsearchptr (mgsearch);
    106     cserver->add_source (mggdbmsource);
     122    cserver->add_filter (browsefilter); 
     123 
     124    if (buildtype == "mg") {
     125       mgsearchclass *mgsearch = new mgsearchclass();
     126 
     127       // add a query filter
     128       mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
     129       queryfilter->set_gdbmptr (gdbmhandler);
     130       queryfilter->set_mgsearchptr (mgsearch);
     131       cserver->add_filter (queryfilter);
     132       
     133       // add a mg and gdbm source
     134       mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
     135       mggdbmsource->set_gdbmptr (gdbmhandler);
     136       mggdbmsource->set_mgsearchptr (mgsearch);
     137       cserver->add_source (mggdbmsource);
     138   
     139    }
     140    else if (buildtype == "mgpp") {
     141     
     142      mgppsearchclass *mgsearch = new mgppsearchclass();
     143
     144      // add a query filter
     145      mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
     146      queryfilter->set_gdbmptr (gdbmhandler);
     147      queryfilter->set_mgsearchptr (mgsearch);
     148      cserver->add_filter (queryfilter);
     149     
     150      // add a mg and gdbm source
     151      mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
     152      mggdbmsource->set_gdbmptr (gdbmhandler);
     153      mggdbmsource->set_mgsearchptr (mgsearch);
     154      cserver->add_source (mggdbmsource);
     155   
     156    }
    107157   
    108158    // inform collection server and everything it contains about its
Note: See TracChangeset for help on using the changeset viewer.