Changeset 2344


Ignore:
Timestamp:
2001-04-30T10:44:08+12:00 (23 years ago)
Author:
sjboddie
Message:

Made the web library print some more reasonable debug info if gsdlhome
isn't set to a valid value

Location:
trunk/gsdl/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/collectset.cpp

    r1886 r2344  
    4242#include "colservrconfig.h"
    4343#include "recptconfig.h"
    44 
     44#include "fileutil.h"
    4545#include "collectset.h"
    4646
     
    5353  // cgiwrapper)
    5454  if (site_cfg_read (gsdlhome, httpdomain, httpprefix)) {
    55     collectdir = filename_cat (gsdlhome, "collect");
    56 
    57     if (!read_dir (collectdir, collections)) {
    58       cerr << "couldn't read collect directory - make sure gsdlhome field is correct in gsdlsite.cfg\n";
    59       exit (1);
    60     }
    61   }
    62    
    63   text_tarray::const_iterator thiscol = collections.begin();
    64   text_tarray::const_iterator endcol = collections.end();
    65 
    66   while (thiscol != endcol) {
    67     // ignore the modelcol
    68     if (*thiscol == "modelcol") {
    69       thiscol ++;
    70       continue;
    71     }
    72 
    73     // Dummy call to add collection added 24/11/2000;
    74     // we already do this ourselves!
    75     // this->add_collection(*thiscol, &recpt, gsdlghome, gsdlhome);
    76 
    77     // read config file to see if built with mg or mgpp
    78     text_t buildtype = "mg"; // mg is default
    79     text_tarray cfgline;
    80     text_t key;
    81     text_t filename = filename_cat(collectdir, *thiscol, "index" , "build.cfg");
    82     ifstream confin(filename.getcstr());
    83 
    84     if (confin) {
    85       while (read_cfg_line(confin, cfgline) >= 0) {
    86     if (cfgline.size() ==2 ) {
    87       key = cfgline[0];
    88       cfgline.erase(cfgline.begin());
    89       if (key =="buildtype") {
    90         buildtype = cfgline[0];
    91         break;
     55    if (directory_exists(gsdlhome)) {
     56      collectdir = filename_cat (gsdlhome, "collect");
     57      if (read_dir (collectdir, collections)) {
     58   
     59    text_tarray::const_iterator thiscol = collections.begin();
     60    text_tarray::const_iterator endcol = collections.end();
     61
     62    while (thiscol != endcol) {
     63      // ignore the modelcol
     64      if (*thiscol == "modelcol") {
     65        thiscol ++;
     66        continue;
    9267      }
     68
     69      // read config file to see if built with mg or mgpp
     70      text_t buildtype = "mg"; // mg is default
     71      text_tarray cfgline;
     72      text_t key;
     73      text_t filename = filename_cat(collectdir, *thiscol, "index" , "build.cfg");
     74      ifstream confin(filename.getcstr());
     75
     76      if (confin) {
     77        while (read_cfg_line(confin, cfgline) >= 0) {
     78          if (cfgline.size() ==2 ) {
     79        key = cfgline[0];
     80        cfgline.erase(cfgline.begin());
     81        if (key =="buildtype") {
     82          buildtype = cfgline[0];
     83          break;
     84        }
     85          }
     86        }
     87      }
     88     
     89      confin.close();
     90   
     91      // this memory is created but never destroyed
     92      // we're also not doing any error checking to make sure we didn't
     93      // run out of memory
     94      collectserver *cserver = new collectserver();
     95      gdbmclass *gdbmhandler = new gdbmclass();
     96   
     97      // add a null filter
     98      filterclass *filter = new filterclass ();
     99      cserver->add_filter (filter);
     100     
     101      // add a browse filter
     102      browsefilterclass *browsefilter = new browsefilterclass();
     103      browsefilter->set_gdbmptr (gdbmhandler);
     104      cserver->add_filter (browsefilter);
     105     
     106      if (buildtype == "mg") {
     107        mgsearchclass *mgsearch = new mgsearchclass();
     108       
     109        // add a query filter
     110        mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
     111        queryfilter->set_gdbmptr (gdbmhandler);
     112        queryfilter->set_mgsearchptr (mgsearch);
     113        cserver->add_filter (queryfilter);
     114       
     115        // add a mg and gdbm source
     116        mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
     117        mggdbmsource->set_gdbmptr (gdbmhandler);
     118        mggdbmsource->set_mgsearchptr (mgsearch);
     119        cserver->add_source (mggdbmsource);
     120      }
     121#ifndef __WIN32__
     122     
     123      else if (buildtype == "mgpp") {
     124       
     125        mgppsearchclass *mgsearch = new mgppsearchclass();
     126       
     127        // add a query filter
     128        mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
     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#endif
     140     
     141      // inform collection server and everything it contains about its
     142      // collection name
     143      cserver->configure ("collection", *thiscol);
     144      // AZIZ: added on 10/10/00
     145      //       the cserver object does not have a reference to gsdlhome
     146      cserver->configure ("gsdlhome", gsdlhome);
     147   
     148      // GRB: removed    proto.add_collectserver (cserver);
     149      // GRB: added to build our own cservers list
     150      cservers.addcollectserver (cserver);
     151
     152      thiscol ++;
    93153    }
    94154      }
    95155    }
    96    
    97     confin.close();
    98 
    99     // this memory is created but never destroyed
    100     // we're also not doing any error checking to make sure we didn't
    101     // run out of memory
    102     collectserver *cserver = new collectserver();
    103     gdbmclass *gdbmhandler = new gdbmclass();
    104    
    105     // add a null filter
    106     filterclass *filter = new filterclass ();
    107     cserver->add_filter (filter);
    108    
    109     // add a browse filter
    110     browsefilterclass *browsefilter = new browsefilterclass();
    111     browsefilter->set_gdbmptr (gdbmhandler);
    112     cserver->add_filter (browsefilter);
    113    
    114     if (buildtype == "mg") {
    115        mgsearchclass *mgsearch = new mgsearchclass();
    116  
    117        // add a query filter
    118        mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
    119        queryfilter->set_gdbmptr (gdbmhandler);
    120        queryfilter->set_mgsearchptr (mgsearch);
    121        cserver->add_filter (queryfilter);
    122        
    123        // add a mg and gdbm source
    124        mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
    125        mggdbmsource->set_gdbmptr (gdbmhandler);
    126        mggdbmsource->set_mgsearchptr (mgsearch);
    127        cserver->add_source (mggdbmsource);
    128     }
    129 #ifndef __WIN32__
    130 
    131     else if (buildtype == "mgpp") {
    132 
    133       mgppsearchclass *mgsearch = new mgppsearchclass();
    134 
    135       // add a query filter
    136       mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
    137       queryfilter->set_gdbmptr (gdbmhandler);
    138       queryfilter->set_mgsearchptr (mgsearch);
    139       cserver->add_filter (queryfilter);
    140      
    141       // add a mg and gdbm source
    142       mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
    143       mggdbmsource->set_gdbmptr (gdbmhandler);
    144       mggdbmsource->set_mgsearchptr (mgsearch);
    145       cserver->add_source (mggdbmsource);   
    146     }
    147 #endif
    148 
    149     // inform collection server and everything it contains about its
    150     // collection name
    151     cserver->configure ("collection", *thiscol);
    152     // AZIZ: added on 10/10/00
    153     //       the cserver object does not have a reference to gsdlhome
    154     cserver->configure ("gsdlhome", gsdlhome);
    155    
    156     // GRB: removed    proto.add_collectserver (cserver);
    157     // GRB: added to build our own cservers list
    158     cservers.addcollectserver (cserver);
    159 
    160     thiscol ++;
    161156  }
    162157}
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r2113 r2344  
    513513  char *script_name = getenv("SCRIPT_NAME");
    514514  if (script_name != NULL) recpt.configure("gwcgi", script_name);
    515   else recpt.configure("gwcgi", "/cgi-bin/gw");
     515  else recpt.configure("gwcgi", "/gsdl");
    516516
    517517  // read in the configuration files.
     
    523523    // no gsdlhome in gsdlsite.cfg
    524524    page_errorsitecfg (errorpage, debug, 1);
     525  } else if (!directory_exists(gsdlhome)) {
     526    // gsdlhome not a valid directory
     527    page_errorsitecfg (errorpage, debug, 1);
    525528  } else if (!main_cfg_read (recpt, gsdlhome, collection)) {
    526529    // couldn't find the main configuration file
    527530    page_errormaincfg (gsdlhome, collection, debug, errorpage);
    528   } else  if (configinfo.collectinfo.empty() && false) {  // GRB: TODO: *** THIS WAS COMMENTED OUT TO MAKE CORBA WORK 7/9/2000 ****
     531  } else  if (configinfo.collectinfo.empty() && false) { // commented out for corba
    529532    // don't have any collections
    530533    page_errorcollect (gsdlhome, errorpage, debug);
  • trunk/gsdl/src/recpt/librarymain.cpp

    r1937 r2344  
    7070  collectset  *cservers;
    7171#if defined(USE_Z3950)
    72   /*#ifndef __WIN32__*/
    7372  z3950proto   zproto;
    7473#endif
     
    7776  cservers = new collectset(gsdlhome);
    7877
    79   // GRB: removed 7/9/2000; perhaps needs to be here!site_cfg_read (gsdlhome);
    80 
    8178  // set up the null protocol
    8279  nproto.set_collectset(cservers);
     
    8481  // configure the receptionist server list
    8582  cservers->setReceptionistServers(recpt, gsdlhome); 
    86  
    87  
    88   /*
    89   text_t collectdir = filename_cat (gsdlhome, "collect");
    90   text_tarray collections;
    91   read_dir (collectdir, collections);
    92 
    93   text_tarray::const_iterator thiscol = collections.begin();
    94   text_tarray::const_iterator endcol = collections.end();
    95 
    96   while (thiscol != endcol) {
    97 
    98     // ignore the modelcol
    99     if (*thiscol == "modelcol") {
    100       thiscol ++;
    101       continue;
    102     }
    103    
    104     // create collection server and add to null protocol
    105     nproto.add_collection (*thiscol, &recpt, gsdlhome, gsdlhome);
    106    
    107     confin.close();
    108 // #endif ? does this tie in with a WIN32 ifdef?
    109 
    110     collectserver *cserver = new collectserver();
    111     gdbmclass *gdbmhandler = new gdbmclass();
    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 
    121     cserver->add_filter (browsefilter); 
    122 
    123     if (buildtype == "mg") {
    124        mgsearchclass *mgsearch = new mgsearchclass();
    125  
    126        // add a query filter
    127        mgqueryfilterclass *queryfilter = new mgqueryfilterclass();
    128        queryfilter->set_gdbmptr (gdbmhandler);
    129        queryfilter->set_mgsearchptr (mgsearch);
    130        cserver->add_filter (queryfilter);
    131        
    132        // add a mg and gdbm source
    133        mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
    134        mggdbmsource->set_gdbmptr (gdbmhandler);
    135        mggdbmsource->set_mgsearchptr (mgsearch);
    136        cserver->add_source (mggdbmsource);
    137     }
    138 #ifndef __WIN32__
    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     }
    157 #endif   
    158 
    159     // inform collection server and everything it contains about its
    160     // collection name
    161     cserver->configure ("collection", *thiscol);
    162  
    163     // configure receptionist's collectinfo structure
    164     text_tarray colinfo;
    165     colinfo.push_back (*thiscol);
    166     colinfo.push_back (gsdlhome);
    167     colinfo.push_back (gsdlhome);
    168     recpt.configure ("collectinfo", colinfo);
    169    
    170     nproto.add_collectserver (cserver);
    171     thiscol ++;
    172   }
    173   */
    17483
    17584  // add the protocol to the receptionist
     
    17887  // z39.50 stuff - johnmcp
    17988#if defined(USE_Z3950)
    180   /*#ifndef __WIN32__*/
    18189  // add the z39.50 server information. Read in the file
    18290  // etc/recpt/z3950.cfg for list of servers and their databases.
Note: See TracChangeset for help on using the changeset viewer.