Changeset 16310


Ignore:
Timestamp:
2008-07-09T13:12:15+12:00 (16 years ago)
Author:
davidb
Message:

Introduction of 'collecthome' which parallels 'gsdlhome' to allow the toplevel collect folder to be outside of the gsdlhome area

Location:
gsdl/trunk/src
Files:
37 edited

Legend:

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

    r15680 r16310  
    8585    indexstem = collection;
    8686  }
    87   // get the filename for the database and make sure it exists
    88   db_filename = filename_cat(dbhome, "collect", collection, "index", "text", indexstem);
    89   db_filename += db_ptr->getfileextension();
     87
     88  db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension());
    9089  if (!file_exists(db_filename)) {
    9190    logout << text_t2ascii
  • gsdl/trunk/src/colservr/collectserver.cpp

    r16027 r16310  
    8585    else if (key == "gsdlhome") configinfo.gsdlhome = value;
    8686    else if (key == "gdbmhome") configinfo.dbhome = value;
     87    else if (key == "collecthome") configinfo.collecthome = value;
    8788    else if (key == "collection") {
    8889      configinfo.collection = value;
    8990      collectinfo.shortInfo.name = value;
    90     } else if (key == "collectdir") configinfo.collectdir = value;
     91    }
     92    else if (key == "collectdir") configinfo.collectdir = value;
    9193    else if (key == "host") collectinfo.shortInfo.host = value;
    9294    else if (key == "port") collectinfo.shortInfo.port = value.getint();
  • gsdl/trunk/src/colservr/collectserver.h

    r15587 r16310  
    5959struct colservrconf {
    6060  text_t gsdlhome;
     61  text_t collecthome;
    6162  text_t dbhome;
    6263  text_t collection;
  • gsdl/trunk/src/colservr/collectset.h

    r15401 r16310  
    2626
    2727 public:
    28   collectset(text_t &gsdlhome);
     28  collectset(text_t& gsdlhome, text_t& collecthome);
    2929  // this constructor is used by the local library
    3030  collectset() {}
     
    3939
    4040  // Add/remove collections
    41   void add_all_collections (const text_t &gsdlhome);
     41  void add_all_collections (const text_t &gsdlhome, const text_t& collecthome);
    4242  void remove_all_collections ();
    4343 
     
    4646
    4747  void add_collection (const text_t &collection,
    48                const text_t &gsdlhome);
     48               const text_t &gsdlhome,
     49               const text_t& collecthome);
    4950
    5051  void add_collection_group(const text_t& collection,
    51                 const text_t& gsdlhome);
    52   void add_all_collection_groups (const text_t& gsdlhome);
     52                const text_t& gsdlhome,
     53                const text_t& collecthome);
     54
     55  void add_all_collection_groups (const text_t& gsdlhome,
     56                  const text_t& collecthome);
    5357
    5458  // return the total number of servers in the set
  • gsdl/trunk/src/colservr/colservrconfig.cpp

    r15458 r16310  
    4444// collect_cfg_read reads collect.cfg returning true on success.
    4545bool collect_cfg_read (collectserver &cserver, const text_t &gsdlhome,
    46                const text_t &collection) {
    47   text_t filename = filename_cat (gsdlhome, "collect");
    48   filename = filename_cat (filename, collection);
    49   filename = filename_cat (filename, "custom");
    50   filename = filename_cat (filename, collection);
    51   filename = filename_cat (filename, "etc");
    52   filename = filename_cat (filename, "custom.cfg");
     46               const text_t& collecthome,
     47               const text_t &collection)
     48{
     49  text_t filename = filename_cat (collecthome, collection);
     50  filename = filename_cat (filename, "custom",collection,"etc","custom.cfg");
    5351
    5452  if (!file_exists (filename)) {
    55     filename = filename_cat (gsdlhome, "collect");
    56     filename = filename_cat (filename, collection);
    57     filename = filename_cat (filename, "etc");
    58     filename = filename_cat (filename, "collect.cfg");
     53    filename = filename_cat (collecthome, collection, "etc", "collect.cfg");
    5954
    6055    if (!file_exists (filename)) {
    61       filename = filename_cat (gsdlhome, "etc");
    62       filename = filename_cat (filename, "collect.cfg");
     56      filename = filename_cat (gsdlhome, "etc", "collect.cfg");
    6357      if (!file_exists (filename)) return false;
    6458    }
     
    6660
    6761  return cserver.read_configfile(filename);
    68   /*
    69   // read in the collection configuration file
    70   text_t key;
    71   text_tarray cfgline;
    72   char *cstr = filename.getcstr();
    73   ifstream confin (cstr);
    74   delete []cstr;
    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 
    82     // configure the collection server
    83     cserver.configure (key, cfgline);
    84       }
    85     }
    86     confin.close ();
    87     return true;
    88   }
    89   return false;
    90   */
    9162}
    9263
     
    9465// build_cfg_read reads build.cfg and returns true on success.
    9566bool build_cfg_read (collectserver &cserver, const text_t &gsdlhome,
     67             const text_t& collecthome,
    9668             const text_t &collection) {
    97   text_t filename = filename_cat (gsdlhome, "collect");
    98   filename = filename_cat (filename, collection);
    99   filename = filename_cat (filename, "index");
     69  text_t filename = filename_cat (collecthome, collection,"index","build.cfg");
    10070
    101   filename = filename_cat (filename, "build.cfg");
    10271  if (!file_exists (filename)) {
    103     filename = filename_cat (gsdlhome, "index");
    104     filename = filename_cat (filename, "build.cfg");
     72    filename = filename_cat (gsdlhome, "index", "build.cfg");
    10573    if (!file_exists (filename)) return false;
    10674  }
     
    10876  return cserver.read_configfile(filename);
    10977
    110   /*
    111   // read in the build configuration file
    112   text_t key;
    113   text_tarray cfgline;
    114   char *cstr = filename.getcstr();
    115   ifstream confin (cstr);
    116   delete []cstr;
    117 
    118   if (confin) {
    119     while (read_cfg_line(confin, cfgline) >= 0) {
    120       if (cfgline.size () >= 2) {
    121     key = cfgline[0];
    122     cfgline.erase(cfgline.begin());
    123 
    124     // configure the collection server
    125     cserver.configure (key, cfgline);
    126       }
    127     }
    128     confin.close ();
    129     return true;
    130   }
    131   return false;
    132   */
    13378}
  • gsdl/trunk/src/colservr/colservrconfig.h

    r1285 r16310  
    3636// collect_cfg_read reads collect.cfg returning true on success.
    3737bool collect_cfg_read (collectserver &cserver, const text_t &gsdlhome,
    38                const text_t &collection);
     38               const text_t& collecthome, const text_t &collection);
    3939
    4040// build_cfg_read reads build.cfg and returns true on success.
    4141bool build_cfg_read (collectserver &cserver, const text_t &gsdlhome,
    42              const text_t &collection);
     42             const text_t& collecthome, const text_t &collection);
    4343
    4444
  • gsdl/trunk/src/colservr/filter.cpp

    r15587 r16310  
    2727#include "fileutil.h"
    2828#include <assert.h>
     29
     30#include <iostream>
     31using namespace std;
    2932
    3033
     
    4649    else if (key == "collectdir") collectdir = value;
    4750    else if (key == "gsdlhome") gsdlhome = value;
     51    else if (key == "collecthome") collecthome = value;
    4852    else if (key == "gdbmhome") dbhome = value;
    4953    else if ((key == "filteroptdefault") && (cfgline.size() == 2)) {
     
    5660  }
    5761}
     62
     63text_t filterclass::resolve_db_filename(const text_t& idx,
     64                    const text_t& file_ext)
     65{
     66  text_t resolved_filename;
     67
     68  if (gsdlhome==dbhome) {
     69    // dbhome has defaulted to gsdlhome which we take to means the
     70    // database has been specifically moved out of gsdlhome area.
     71    // => it should be whereever collecthome is set to
     72    resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);
     73  }
     74  else {
     75    // dbhome is explicitly set to something other than gsdlhome
     76    // => use dbhome
     77    resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);
     78  }
     79
     80  resolved_filename += file_ext;
     81
     82  return resolved_filename;
     83}
     84
    5885
    5986// init should be called after all the configuration is done but
     
    7097  }
    7198
     99  if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect");
    72100  if (dbhome.empty()) dbhome = gsdlhome;
    73101 
    74102  // get the collection directory name
    75103  if (collectdir.empty()) {
    76     collectdir = filename_cat (gsdlhome, "collect", collection);
     104    collectdir = filename_cat (collecthome, collection);
    77105  }
    78106 
  • gsdl/trunk/src/colservr/filter.h

    r15587 r16310  
    3636protected:
    3737  text_t gsdlhome;
     38  text_t collecthome;
    3839  text_t dbhome;
    3940  text_t collection;
     
    6566               FilterResponse_t &response,
    6667               comerror_t &err, ostream &logout);
     68
     69 protected:
     70  text_t resolve_db_filename(const text_t& idx,const text_t& file_ext);
     71
     72
    6773};
    6874
  • gsdl/trunk/src/colservr/lucenesearch.cpp

    r15594 r16310  
    8484}
    8585
     86
    8687bool lucenesearchclass::search(const queryparamclass &queryparams,
    8788                   queryresultsclass &queryresult) {
     
    147148    }
    148149
    149   cerr << "Lucene command: " << cmd << endl;
    150  
    151150  text_t xml_text = "";
    152151
  • gsdl/trunk/src/colservr/mgqueryfilter.cpp

    r15681 r16310  
    195195  err = noError;
    196196  textsearchptr->setcollectdir (collectdir);
     197
    197198  multiresults.clear();
    198199 
  • gsdl/trunk/src/colservr/queryfilter.cpp

    r15680 r16310  
    413413    indexstem = collection;
    414414  }
    415   db_filename = filename_cat(dbhome, "collect", collection, "index", "text", indexstem);
    416   db_filename += db_ptr->getfileextension();
     415  db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension());
    417416  if (!file_exists(db_filename)) {
    418417    logout << text_t2ascii
  • gsdl/trunk/src/colservr/source.cpp

    r15680 r16310  
    5252    else if (key == "collectdir") collectdir = value;
    5353    else if (key == "gsdlhome") gsdlhome = value;
     54    else if (key == "collecthome") collecthome = value;
    5455    else if (key == "gdbmhome") dbhome = value;
    5556  }
     
    7778}
    7879
     80text_t sourceclass::resolve_db_filename(const text_t& idx,
     81                    const text_t& file_ext)
     82{
     83  // This is an exact copy of the method (of the same name) in filterclass
     84  // Makes sense to merge them, in which either gsdlhome, collecthome,
     85  // dbhome, and collection need to also be passed in as parameters,
     86  // or else there is some notion of a shared base class that both
     87  // filter and source inherit from
     88
     89  // NB: there is an even greater opportunity to share more code in this
     90  // function if sql_db_ptr/db_ptr and db_filename and sql_db_filename
     91  // are also drawn from one object
     92
     93  text_t resolved_filename;
     94
     95  if (gsdlhome==dbhome) {
     96    // dbhome has defaulted to gsdlhome which we take to means the
     97    // database has been specifically moved out of gsdlhome area.
     98    // => it should be whereever collecthome is set to
     99
     100    resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);
     101  }
     102  else {
     103    // dbhome is explicitly set to something other than gsdlhome
     104    // => use dbhome
     105    resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);
     106  }
     107
     108  resolved_filename += file_ext;
     109
     110  return resolved_filename;
     111}
     112
     113
     114
    79115// init should be called after all the configuration is done but
    80116// before any other methods are called
     
    83119  outconvertclass text_t2ascii;
    84120 
     121  if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect");
    85122  if (dbhome.empty()) dbhome = gsdlhome;
    86123
     
    114151  // get the collection directory name
    115152  if (collectdir.empty()) {
    116     collectdir = filename_cat (gsdlhome, "collect", collection);
     153    collectdir = filename_cat (collecthome, collection);
    117154  }
    118155
     
    128165    indexstem = collection;
    129166  }
    130   db_filename = filename_cat(dbhome, "collect", collection, "index", "text", indexstem);
    131   db_filename += db_ptr->getfileextension();
     167  db_filename = resolve_db_filename(indexstem, db_ptr->getfileextension());
    132168  if (!file_exists(db_filename)) {
    133169    logout << text_t2ascii
  • gsdl/trunk/src/colservr/source.h

    r15591 r16310  
    4141
    4242  text_t gsdlhome;
     43  text_t collecthome;
    4344  text_t dbhome;
    4445  text_t collection;
     
    9697
    9798  virtual bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout);
     99
     100 protected:
     101  text_t resolve_db_filename(const text_t& idx,
     102                 const text_t& file_ext);
     103
    98104};
    99105
  • gsdl/trunk/src/colservr/sqlbrowsefilter.cpp

    r16180 r16310  
    6969
    7070  // get the filename for the database and make sure it exists
    71   sql_db_filename = filename_cat(dbhome, "collect", collection, "index", "text", indexstem);
    72   sql_db_filename += sql_db_ptr->getfileextension();
     71  sql_db_filename = resolve_db_filename(indexstem,sql_db_ptr->getfileextension());
    7372  if (!file_exists(sql_db_filename))
    7473  {
  • gsdl/trunk/src/lib/gsdlsitecfg.cpp

    r15402 r16310  
    2424 *********************************************************************/
    2525
    26 
     26#include "fileutil.h"
    2727#include "gsdlsitecfg.h"
    2828
     
    4242private:
    4343  text_t *gsdlhome;
     44  text_t *collecthome;
    4445  text_t *httpdomain;
    4546  text_t *httpprefix;
     
    4950  int    *maxrequests;
    5051public:
    51   __site_configuration (text_t *_gsdlhome, int *_maxrequests) {
     52  __site_configuration (text_t *_gsdlhome, text_t* _collecthome, int *_maxrequests) {
    5253    gsdlhome = _gsdlhome;
     54    collecthome = _collecthome;
    5355    httpdomain = NULL;
    5456    httpprefix = NULL;
     
    5961  }
    6062
    61   __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,
    62                         text_t *_httpprefix) {
     63  __site_configuration (text_t *_gsdlhome, text_t* _collecthome,
     64            text_t *_httpdomain, text_t *_httpprefix) {
    6365    gsdlhome    = _gsdlhome;
     66    collecthome  = _collecthome;
    6467    httpdomain = _httpdomain;
    6568    httpprefix = _httpprefix;
     
    7073  }
    7174
    72   __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,
     75  __site_configuration (text_t *_gsdlhome, text_t* _collecthome,
     76            text_t *_httpdomain,
    7377            text_t *_httpprefix, text_t *_collection) {
    7478    gsdlhome    = _gsdlhome;
     79    collecthome  = _collecthome;
    7580    httpdomain = _httpdomain;
    7681    httpprefix = _httpprefix;
     
    8388  __site_configuration (text_t *_httpprefix, text_tset *_actions, text_tset *_browsers) {
    8489    gsdlhome    = NULL;
     90    collecthome  = NULL;
    8591    httpdomain = NULL;
    8692    httpprefix = _httpprefix;
     
    94100    if (gsdlhome != NULL && key == "gsdlhome") {
    95101      *gsdlhome = cfgline[0];
     102
     103      if ((collecthome != NULL) && (collecthome->empty())) {
     104    // defaults to <gsdlhome>/collect
     105    *collecthome = filename_cat(*gsdlhome,"collect");
     106      }
     107    }
     108
     109    if (collecthome != NULL && key == "collecthome") {
     110      if (!collecthome->empty()) {
     111    // if it has been previously set to default, free and then reassign
     112    collecthome->clear();
     113      }
     114      *collecthome = cfgline[0];
    96115    }
    97116
     
    141160// also sets gsdlhome and maxrequests
    142161// gsdlsite.cfg should be in same directory as library executable
    143 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, int &maxrequests)
     162bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome,
     163            text_t& collecthome, int &maxrequests)
    144164{
    145   __site_configuration sitecfg(&gsdlhome, &maxrequests);
     165  __site_configuration sitecfg(&gsdlhome, &collecthome, &maxrequests);
    146166  gsdlconfigurator.add_configurable(&sitecfg);
    147167
    148   // blank the gsdl home text
     168  // blank the gsdlhome and collecthome text
    149169  gsdlhome.clear();
     170  collecthome.clear();
    150171
    151172  if (gsdlconfigurator.configure("gsdlsite.cfg"))
     
    158179
    159180
    160 // this version grabs gsdlhome, httpdomain and httpprefix,
     181// this version grabs gsdlhome, collecthome, httpdomain and httpprefix,
    161182// returns false if it can't find all of them
    162 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,
     183bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain,
    163184            text_t &httpprefix)
    164185{
    165186  // get gsdlhome etc
    166   __site_configuration sitecfg(&gsdlhome, &httpdomain, &httpprefix);
     187  __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix);
    167188  configurator gsdlconfigurator(&sitecfg);
    168189
    169190  gsdlhome.clear();
     191  collecthome.clear();
    170192  httpdomain.clear();
    171193  httpprefix.clear();
     
    180202
    181203
    182 // this version grabs gsdlhome, httpdomain, httpprefix, collection,
     204// this version grabs gsdlhome, collecthome, httpdomain, httpprefix, collection,
    183205// returns false if it can't find gsdlhome, httpdomain and httpprefix
    184 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,
     206bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain,
    185207            text_t &httpprefix, text_t &collection)
    186208{
    187209  // get gsdlhome etc
    188   __site_configuration sitecfg(&gsdlhome, &httpdomain, &httpprefix, &collection);
     210  __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix, &collection);
    189211  configurator gsdlconfigurator(&sitecfg);
    190212   
    191213  gsdlhome.clear();
     214  collecthome.clear();
    192215  httpdomain.clear();
    193216  httpprefix.clear();
     
    195218   
    196219  if (gsdlconfigurator.configure("gsdlsite.cfg") &&
    197       !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty())
     220      !gsdlhome.empty() && !collecthome.empty()
     221      && !httpdomain.empty() && !httpprefix.empty())
    198222  {
    199223    return true;
  • gsdl/trunk/src/lib/gsdlsitecfg.h

    r15402 r16310  
    3434
    3535// reads gsdlsite.cfg file returning true on success
    36 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, int &maxrequests);
    37 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, text_t &httpprefix);
    38 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, text_t &httpprefix, text_t &collection);
     36bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome,
     37            text_t& collecthome, int &maxrequests);
     38bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, text_t &httpprefix);
     39bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, text_t &httpprefix, text_t &collection);
    3940
    4041
  • gsdl/trunk/src/oaiservr/oaimain.cpp

    r15844 r16310  
    103103  collectset   *cservers;
    104104  text_t        gsdlhome;
     105  text_t        collecthome;
    105106  text_t        gsdlcollect = "";
    106107  oaiargs       args;
     
    122123  delete []cstr;
    123124 
    124   cservers = new collectset(gsdlhome);
     125  cservers = new collectset(gsdlhome,collecthome);
    125126
    126127  // set up the null protocol
  • gsdl/trunk/src/protocol/nullproto.cpp

    r15588 r16310  
    4545// collectset has been added to the protocol with set_collectset()
    4646void nullproto::add_collection (const text_t &collection, void *recpt,
    47                 const text_t &gsdlhome, const text_t &dbhome) {     
     47                const text_t &gsdlhome, const text_t& collecthome,
     48                const text_t &dbhome)
     49{     
    4850 
    4951  if (cset != NULL) {
    50     this->cset->add_collection (collection, gsdlhome);
     52    this->cset->add_collection (collection, gsdlhome, collecthome);
    5153  }
    5254}
     
    7072  // the protocol should not configure the collection set; it should be
    7173  // done direct to the collection server set
    72   if (key == "gsdlhome" || key == "gdbmhome") {
     74  if (key == "gsdlhome" || key == "gdbmhome"
     75      || key == "collecthome" || key == "collectdir") {
    7376    cset->configure(key, cfgline);
    7477  }
  • gsdl/trunk/src/protocol/nullproto.h

    r15588 r16310  
    4444  // add_collectserver
    4545  virtual void add_collection (const text_t &collection, void *recpt,
    46                    const text_t &gsdlhome, const text_t &dbhome);
     46                   const text_t &gsdlhome, const text_t& collecthome,
     47                   const text_t &dbhome);
    4748
    4849  void set_collectset(collectset *set) { this->cset = set; }
  • gsdl/trunk/src/protocol/recptproto.cpp

    r15588 r16310  
    3030// add collection server to protocol
    3131void recptproto::add_collection (const text_t &/*collection*/, void * /*recpt*/,
    32                  const text_t &/*gsdlhome*/, const text_t &/*dbhome*/) {
     32                 const text_t &/*gsdlhome*/, const text_t& /*collecthome */,
     33                 const text_t &/*dbhome*/)
     34{
    3335}
    3436
  • gsdl/trunk/src/protocol/recptproto.h

    r15588 r16310  
    5656  // add collection server to protocol
    5757  virtual void add_collection (const text_t &collection, void *recpt,
    58                    const text_t &gsdlhome, const text_t &dbhome);
     58                   const text_t &gsdlhome, const text_t& collecthome,
     59                   const text_t &dbhome);
    5960
    6061  virtual void remove_collection (const text_t &collection, ostream &logout);
  • gsdl/trunk/src/recpt/action.cpp

    r15589 r16310  
    2424 *********************************************************************/
    2525
     26#include "fileutil.h"
     27
    2628#include "action.h"
    2729#include <assert.h>
     
    4446  if (key == "gsdlhome") {
    4547    gsdlhome = cfgline[0];
     48    if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect");
    4649    if (dbhome.empty()) dbhome = cfgline[0];
    4750  }
     51  if (key == "collecthome") {collecthome = cfgline[0];}
    4852  if (key == "gdbmhome") {dbhome = cfgline[0];}
    4953}
  • gsdl/trunk/src/recpt/action.h

    r15589 r16310  
    4848  cgiargsinfoclass argsinfo;
    4949  text_t gsdlhome;
     50  text_t collecthome;
    5051  text_t dbhome;
    5152
  • gsdl/trunk/src/recpt/cgiwrapper.cpp

    r15589 r16310  
    129129static void page_errorcollect (const text_t &gsdlhome, text_t &errorpage, bool debug) {
    130130
    131   text_t collectdir = filename_cat (gsdlhome, "collect");
     131  text_t collecthome = filename_cat (gsdlhome, "collect");
    132132
    133133  text_t errortext = "No valid collections were found: Check that your collect directory\n";
    134   errortext += "(" + collectdir + ") is readable and contains at least one valid collection.\n";
     134  errortext += "(" + collecthome + ") is readable and contains at least one valid collection.\n";
    135135  errortext += "Note that modelcol is NOT a valid collection.\n";
    136136  errortext += "If the path to your collect directory is wrong edit the 'gsdlhome' field\n";
     
    301301  bool colspec = false;
    302302  if (configinfo.collection.empty()) {
    303     cout << "Receptionist is running in \"general\" (i.e. not \"collection\n"
     303    cout << "Receptionist is running in \"general\" (i.e. not \"collection "
    304304     << "specific\") mode.\n";
    305305  } else {
     
    311311  }
    312312 
    313   cout << text_t2ascii << "gsdlhome=" << configinfo.gsdlhome << "\n";
     313  cout << text_t2ascii << "  gsdlhome=" << configinfo.gsdlhome << "\n";
     314  if (!configinfo.collecthome.empty())
     315    cout << text_t2ascii << "  collecthome=" << configinfo.collecthome << "\n";
    314316  if (!configinfo.dbhome.empty())
    315     cout << text_t2ascii << "dbhome=" << configinfo.dbhome << "\n";
    316   cout << text_t2ascii << "httpprefix=" << configinfo.httpprefix << "\n";
    317   cout << text_t2ascii << "httpimg=" << configinfo.httpimg << "\n";
    318   cout << text_t2ascii << "gwcgi=" << configinfo.gwcgi << "\n"
     317    cout << text_t2ascii << "  dbhome=" << configinfo.dbhome << "\n";
     318  cout << text_t2ascii << "  httpprefix=" << configinfo.httpprefix << "\n";
     319  cout << text_t2ascii << "  httpimg=" << configinfo.httpimg << "\n";
     320  cout << text_t2ascii << "  gwcgi=" << configinfo.gwcgi << "\n\n"
    319321       << "  Note that unless gwcgi has been set from a configuration\n"
    320322       << "  file it is dependent on environment variables set by your\n"
     
    483485  // read in the configuration files.
    484486  text_t gsdlhome;
     487  text_t collecthome;
    485488  configurator gsdlconfigurator(&recpt);
    486   if (!site_cfg_read (gsdlconfigurator, gsdlhome, maxrequests)) {
     489  if (!site_cfg_read (gsdlconfigurator, gsdlhome, collecthome, maxrequests)) {
    487490    // couldn't find the site configuration file
    488491    page_errorsitecfg (errorpage, debug, 0);
     
    493496    // gsdlhome not a valid directory
    494497    page_errorsitecfg (errorpage, debug, 1);
    495   } else if (!main_cfg_read (recpt, gsdlhome, collection)) {
     498  } else if (!main_cfg_read (recpt, gsdlhome, collecthome, collection)) {
    496499    // couldn't find the main configuration file
    497500    page_errormaincfg (gsdlhome, collection, debug, errorpage);
  • gsdl/trunk/src/recpt/collectoraction.cpp

    r15597 r16310  
    381381    // etc directory to the new collection.
    382382    if (args["bc1clone"] == "1") {
    383       text_t clone_etc = filename_cat(gsdlhome, "collect", args["bc1clonecol"], "etc");
     383      text_t clone_etc = filename_cat(collecthome, args["bc1clonecol"], "etc");
    384384      text_t new_etc = filename_cat(get_collectdir(args), args["bc1dirname"], "etc");
    385385      text_tarray files;
     
    454454    // cloning was turned on
    455455
    456     text_t cfgfile_clone = filename_cat(gsdlhome, "collect", args["bc1clonecol"], "etc", "collect.cfg");
     456    text_t cfgfile_clone = filename_cat(collecthome, args["bc1clonecol"], "etc", "collect.cfg");
    457457    if (file_exists (cfgfile_clone)) {
    458458      // if .org file doesn't exist already create it
     
    11701170      // delete it
    11711171      text_t colmaintainer;
    1172       text_t cfgfile = filename_cat(gsdlhome, "collect", collection, "etc", "collect.cfg");
     1172      text_t cfgfile = filename_cat(collecthome, collection, "etc", "collect.cfg");
    11731173      char *cfgfilec = cfgfile.getcstr();
    11741174      ifstream cfg_in (cfgfilec);
  • gsdl/trunk/src/recpt/depositoraction.cpp

    r15453 r16310  
    612612    } else {
    613613   
    614       text_t col_dirname = filename_cat(gsdlhome,"collect",args[macro_prefix+"dirname"]);
     614      text_t col_dirname = filename_cat(collecthome,args[macro_prefix+"dirname"]);
    615615      text_t import_dirname = filename_cat(col_dirname,"import");
    616616      if(!directory_exists(import_dirname)) {
     
    756756
    757757    //create metadata.xml file
    758     text_t metadata_path = filename_cat(gsdlhome,"collect", args[macro_prefix+"dirname"], "import", timestamp_str, "metadata.xml");
     758    text_t metadata_path = filename_cat(collecthome, args[macro_prefix+"dirname"], "import", timestamp_str, "metadata.xml");
    759759    text_t my_path = filename_cat(gsdlhome,"tmp", "metadata.xml");
    760760
     
    792792
    793793    //create manifest.xml file
    794     text_t manifest_path = filename_cat(gsdlhome,"collect", args[macro_prefix+"dirname"], "manifest.xml");
     794    text_t manifest_path = filename_cat(collecthome, args[macro_prefix+"dirname"], "manifest.xml");
    795795
    796796    char* manifest_cstr = manifest_path.getcstr();
  • gsdl/trunk/src/recpt/librarymain.cpp

    r15744 r16310  
    7070#endif
    7171  text_t       gsdlhome;
    72 
    73   cservers = new collectset(gsdlhome);
     72  text_t       collecthome;
     73
     74  cservers = new collectset(gsdlhome,collecthome);
    7475
    7576  // configure the receptionist server list
     
    8283    colinfo.push_back(*collection_iterator);
    8384    colinfo.push_back(gsdlhome);
     85    colinfo.push_back(collecthome);
    8486    colinfo.push_back(gsdlhome);
    8587    recpt.configure("collectinfo", colinfo);
  • gsdl/trunk/src/recpt/maincfg.cpp

    r15402 r16310  
    4040
    4141
     42bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome,
     43            const text_t &collection)
     44{
     45
     46  cerr << "Warning: Using version of main_cfg_read() that does not support 'collecthome'" << endl;
     47
     48  text_t collecthome = filename_cat(gsdlhome,"collect");
     49  return main_cfg_read(recpt,gsdlhome,collecthome,collection);
     50}
     51
     52
    4253// main_cfg_read reads both main.cfg and collect.cfg. It attempts
    4354// to read main.cfg first so values in collect.cfg override those
    4455// set earlier by main.cfg
    4556bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome,
    46             const text_t &collection) {
     57            const text_t& collecthome, const text_t &collection) {
    4758
    4859  // read in the main configuration file
     
    6273  }
    6374
    64   // Look for collect.cfg in GSDLHOME/collect/collection-name/etc directory
     75  // Look for collect.cfg in <collecthome>/collection-name/etc directory
    6576  // (if this is for a particular collection), and then GSDLHOME/etc.
    6677  if (!collection.empty()) {
    67     filename = filename_cat (gsdlhome, "collect");
    68     filename = filename_cat (filename, collection);
     78    filename = filename_cat (collecthome, collection);
    6979    filename = filename_cat (filename, "etc");
    7080    filename = filename_cat (filename, "collect.cfg");
  • gsdl/trunk/src/recpt/maincfg.h

    r15402 r16310  
    4040// collection is specified and then it tries to read in main.cfg
    4141bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome,
     42            const text_t& collecthome, const text_t &collection);
     43
     44bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome,
    4245            const text_t &collection);
    4346
  • gsdl/trunk/src/recpt/pageaction.cpp

    r15418 r16310  
    979979
    980980    set_macro_to_file_contents (disp, "importlog", "bsummary",
    981                 filename_cat(gsdlhome, "collect", arg_c, "etc", "import.log"));
     981                filename_cat(collecthome, arg_c, "etc", "import.log"));
    982982    set_macro_to_file_contents (disp, "faillog", "bsummary",
    983                 filename_cat(gsdlhome, "collect", arg_c, "etc", "fail.log"));
     983                filename_cat(collecthome, arg_c, "etc", "fail.log"));
    984984    set_macro_to_file_contents (disp, "buildlog", "bsummary",
    985                 filename_cat(gsdlhome, "collect", arg_c, "etc", "build.log"));
     985                filename_cat(collecthome, arg_c, "etc", "build.log"));
    986986  }
    987987}
  • gsdl/trunk/src/recpt/phindaction.cpp

    r12315 r16310  
    168168  unsigned long ef, lf, df;
    169169 
    170   text_t basepath = filename_cat(gsdlhome, "collect", args["c"],
     170  text_t basepath = filename_cat(collecthome, args["c"],
    171171                 "index", "phind" + args["pc"]);
    172172
  • gsdl/trunk/src/recpt/receptionist.cpp

    r15589 r16310  
    5252void recptconf::clear () {
    5353  gsdlhome.clear();
     54  collecthome.clear();
    5455  dbhome.clear();
    5556  collectinfo.erase(collectinfo.begin(), collectinfo.end());
     
    222223      if (configinfo.dbhome.empty()) configinfo.dbhome = cfgline[0];
    223224    }
     225    else if (key == "collecthome") configinfo.collecthome = cfgline[0];
    224226    else if (key == "gdbmhome") configinfo.dbhome = cfgline[0];
    225227    else if (key == "collection") {
     
    231233      }
    232234     
    233     } else if (key == "collectdir") configinfo.collectdir = cfgline[0];
     235    }
     236    else if (key == "collectdir") configinfo.collectdir = cfgline[0];
    234237    else if (key == "httpprefix") configinfo.httpprefix = cfgline[0];
    235238    else if (key == "httpimg") configinfo.httpimg = cfgline[0];
     
    269272    else if (key == "macroprecedence") configinfo.macroprecedence = cfgline[0];
    270273    else if (key == "collectinfo") {
    271       if (cfgline.size() >= 3) {
     274      if (cfgline.size() == 3) {
     275    // for backwards compatability with older collections that only use
     276    // gsdlhome and dbhome
    272277    collectioninfo_t cinfo;
    273278    cinfo.gsdl_gsdlhome = cfgline[1];
     279    cinfo.gsdl_collecthome = filename_cat(cfgline[1],"collect");
    274280    cinfo.gsdl_dbhome = cfgline[2];
     281    configinfo.collectinfo[cfgline[0]] = cinfo;
     282      }
     283      else if (cfgline.size() >= 4) {
     284    collectioninfo_t cinfo;
     285    cinfo.gsdl_gsdlhome = cfgline[1];
     286    cinfo.gsdl_collecthome = cfgline[2];
     287    cinfo.gsdl_dbhome = cfgline[3];
    275288    configinfo.collectinfo[cfgline[0]] = cinfo;
    276289      }
     
    427440
    428441  // first configure collectdir
    429   text_t thecollectdir = configinfo.gsdlhome;
    430442  if (!configinfo.collection.empty()) {
     443
    431444    // collection specific mode
     445
     446    text_t collectdir = configinfo.gsdlhome;
     447
    432448    if (!configinfo.collectdir.empty()) {
    433449      // has already been configured
    434       thecollectdir = configinfo.collectdir;
     450      collectdir = configinfo.collectdir;
    435451    } else {
     452
    436453      // decide where collectdir is by searching for collect.cfg
    437454      // look in $GSDLHOME/collect/collection-name/etc/collect.cfg and
    438455      // then $GSDLHOME/etc/collect.cfg
    439       thecollectdir = filename_cat (configinfo.gsdlhome, "collect");
    440       thecollectdir = filename_cat (thecollectdir, configinfo.collection);
    441       text_t filename = filename_cat (thecollectdir, "etc");
     456      collectdir = filename_cat (configinfo.gsdlhome, "collect");
     457      collectdir = filename_cat (collectdir, configinfo.collection);
     458      text_t filename = filename_cat (collectdir, "etc");
    442459      filename = filename_cat (filename, "collect.cfg");
    443 
    444       if (!file_exists(filename)) thecollectdir = configinfo.gsdlhome;
    445     }
    446   }
    447   configure("collectdir", thecollectdir);
     460     
     461      if (!file_exists(filename)) collectdir = configinfo.gsdlhome;
     462    }
     463
     464    configure("collectdir", collectdir);
     465
     466  }
     467  else {
     468
     469    text_t collecthome;
     470    if (configinfo.collecthome.empty()) {
     471      collecthome = filename_cat(configinfo.gsdlhome,"collect");
     472    }
     473    else {
     474      collecthome = configinfo.collecthome;
     475    }
     476
     477    configure("collecthome", collecthome);
     478
     479    // for backwards compatability collectdir set to gsdlhome
     480    // (possible it could now be removed)
     481    configure("collectdir", configinfo.gsdlhome);
     482  }
     483
    448484
    449485  // read in the macro files
     
    824860    collectname=args["c"];
    825861    if (collectname != "") {
    826       text_t collectdir=filename_cat(configinfo.gsdlhome,"collect");
    827       collectdir=filename_cat(collectdir,collectname);
     862
     863      text_t collecthome;
     864      if (!configinfo.collecthome.empty()) {
     865    collecthome = configinfo.collecthome;
     866      }   
     867      else {
     868    collecthome=filename_cat(configinfo.gsdlhome,"collect");
     869      }
     870      text_t collectdir=filename_cat(collecthome,collectname);
     871     
    828872      text_t buildcfg=filename_cat(collectdir,"index");
    829873      buildcfg=filename_cat(buildcfg,"build.cfg");
     
    11861230
    11871231  text_t colmacrodir
    1188     = filename_cat (configinfo.gsdlhome,"collect",collection, "macros");
     1232    = filename_cat (configinfo.collecthome,collection, "macros");
    11891233
    11901234  if (directory_exists (colmacrodir)) {
  • gsdl/trunk/src/recpt/receptionist.h

    r15589 r16310  
    5555
    5656  text_t gsdl_gsdlhome;
     57  text_t gsdl_collecthome;
    5758  text_t gsdl_dbhome;
    5859
     
    7778struct recptconf {
    7879   text_t gsdlhome;
     80   text_t collecthome;
    7981   text_t dbhome;   // will equal gsdlhome if not set
    8082   text_t collection; // will equal "" in 'general' mode
  • gsdl/trunk/src/recpt/wizardaction.cpp

    r15597 r16310  
    201201// collect.cfg file is writable
    202202bool wizardaction::collection_protected (const text_t &collection) {
    203   text_t cfgfile = filename_cat(gsdlhome, "collect", collection, "etc", "collect.cfg");
     203  text_t cfgfile = filename_cat(collecthome, collection, "etc", "collect.cfg");
    204204  if (file_writable(cfgfile)) return false;
    205205  return true;
     
    310310
    311311  // check to see if shortname is unique
    312   text_t fulldirname = filename_cat (gsdlhome, "collect", shortname);
     312  text_t fulldirname = filename_cat (collecthome, shortname);
    313313  if (directory_exists (fulldirname)) {
    314314    int version = 0;
     
    319319      newname.push_back ('v');
    320320      newname.appendint (version);
    321       fulldirname = filename_cat (gsdlhome, "collect", newname);
     321      fulldirname = filename_cat (collecthome, newname);
    322322    } while (directory_exists (fulldirname));
    323323
     
    468468
    469469  text_t cfgfile_content;
    470   text_t cfgfile_name = filename_cat (gsdlhome, "collect", collection, "etc", "collect.cfg");
     470  text_t cfgfile_name = filename_cat (collecthome, collection, "etc", "collect.cfg");
    471471  text_t pluginstr, pluginname;
    472472
     
    654654  if ((args[macro_prefix+"econf"] == 1) || (args[macro_prefix+"esrce"] == 1)) {
    655655    // we're adding to a collection in place
    656     return filename_cat(gsdlhome, "collect"); 
     656    return collecthome;
    657657  }
    658658  else {
     
    673673      if ((*rprotolist_here).p->get_protocol_name (err) == "nullproto") {
    674674    // create collection server and add it to nullproto
    675     (*rprotolist_here).p->add_collection (collection, recpt, gsdlhome, gsdlhome);
     675    (*rprotolist_here).p->add_collection (collection, recpt, gsdlhome, collecthome, dbhome);
    676676    // make sure gsdlhome is configured
    677677    text_tarray tmp;
  • gsdl/trunk/src/w32server/cgiwrapper.cpp

    r15852 r16310  
    392392    // that we can find the relevant directories
    393393    if (!checkdir (gsdl_gsdlhome + "\\")) return 0;
     394    if (!checkdir (gsdl_collecthome + "\\")) return 0;
    394395    if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0;
    395396  }   
     
    409410    collectioninfo_t tmp;
    410411    tmp.gsdl_gsdlhome = gsdl_gsdlhome;
     412    tmp.gsdl_collecthome = gsdl_collecthome;
    411413    tmp.gsdl_dbhome = gsdl_dbhome;
    412414    translated_collectinfo[collection] = tmp;
     
    424426      if (dbhomes.find ((*this_info).second.gsdl_dbhome) == dbhomes.end()) {
    425427    these_collections.erase (these_collections.begin(), these_collections.end());
    426     read_dir (filename_cat ((*this_info).second.gsdl_gsdlhome, "collect"), these_collections);
     428    read_dir (filename_cat ((*this_info).second.gsdl_collecthome), these_collections);
    427429    colhere = these_collections.begin();
    428430    colend = these_collections.end();
     
    433435        // file is installed here -- it's real gdbm will therefore be
    434436        // somewhere else).
    435         text_t build_cfg = filename_cat ((*this_info).second.gsdl_gsdlhome, "collect",
     437        text_t build_cfg = filename_cat ((*this_info).second.gsdl_collecthome,
    436438                         *colhere, "index", "build.cfg");
    437439        if (file_exists (build_cfg)) {
     
    462464    collectioninfo_t tmp;
    463465    tmp.gsdl_gsdlhome = gsdl_gsdlhome;
     466    tmp.gsdl_collecthome = gsdl_collecthome;
    464467    tmp.gsdl_dbhome = gsdl_dbhome;
    465468    translated_collectinfo[*colhere] = tmp;
     
    483486    // create collection server and add to null protocol
    484487    text_t this_gsdlhome = gsdl_gsdlhome;
     488    text_t this_collecthome = gsdl_collecthome;
    485489    text_t this_dbhome = gsdl_dbhome;
    486490    colinfo_tmap::const_iterator it = translated_collectinfo.find (*thiscol);
    487491    assert (it != translated_collectinfo.end());
    488492    this_gsdlhome = (*it).second.gsdl_gsdlhome;
     493    this_collecthome = (*it).second.gsdl_collecthome;
    489494    this_dbhome = (*it).second.gsdl_dbhome;
    490495
     
    623628  // set defaults
    624629  recpt.configure ("gsdlhome", gsdl_gsdlhome);
     630  recpt.configure ("collecthome", gsdl_collecthome);
    625631  recpt.configure ("gdbmhome", gsdl_dbhome);
    626632  recpt.configure ("collection", collection);
     
    637643    tmpconf.push_back ((*this_info).first);
    638644    tmpconf.push_back ((*this_info).second.gsdl_gsdlhome);
     645    tmpconf.push_back ((*this_info).second.gsdl_collecthome);
    639646    tmpconf.push_back ((*this_info).second.gsdl_dbhome);
    640647    recpt.configure ("collectinfo", tmpconf);
     
    646653  // collections being used together in this way should be
    647654  // careful not to have main.cfg files that might
    648   // screw with each other.
     655  // interfere with each other.
    649656  text_tset::const_iterator thome = dbhomes.begin();
    650657  text_tset::const_iterator ehome = dbhomes.end();
  • gsdl/trunk/src/w32server/settings.cpp

    r15625 r16310  
    4747text_t gsdl_enterlib;
    4848text_t gsdl_gsdlhome;
     49text_t gsdl_collecthome;
    4950text_t gsdl_dbhome;
    5051text_t gsdl_collections;
     
    300301    write_ini_line(fout, "enterlib", gsdl_enterlib);
    301302    write_ini_line(fout, "gsdlhome", gsdl_gsdlhome);
     303    write_ini_line(fout, "collecthome", gsdl_collecthome);
    302304    write_ini_line(fout, "gdbmhome", gsdl_dbhome);
    303305   
     
    321323      if (!(*here).second.gsdl_gsdlhome.empty())
    322324    write_ini_line(fout, "gsdlhome", (*here).second.gsdl_gsdlhome);
     325      if (!(*here).second.gsdl_collecthome.empty())
     326    write_ini_line(fout, "collecthome", (*here).second.gsdl_collecthome);
    323327      if (!(*here).second.gsdl_dbhome.empty())
    324328    write_ini_line(fout, "gdbmhome", (*here).second.gsdl_dbhome);
     
    385389  gsdl_enterlib = "/gsdl";
    386390  gsdl_gsdlhome = data_location;
     391  gsdl_collecthome = filename_cat(data_location,"collect");
    387392  gsdl_dbhome = data_location;
    388393 
     
    474479      } else if (key == "collections") {
    475480        gsdl_collections = value;
    476 
     481      }
    477482      // gsdlhome must occur in file before dbhome     
    478       } else if (key == "gsdlhome") {
     483      else if (key == "gsdlhome") {
    479484        gsdl_gsdlhome = value;
    480         gsdl_dbhome = value;
    481      
    482       } else if (key == "gdbmhome") {
     485        gsdl_collecthome = filename_cat(value,"collect");
     486        gsdl_dbhome = value;     
     487      }
     488      else if (key == "collecthome") {
     489        gsdl_collecthome = value;
     490      }
     491      else if (key == "gdbmhome") {
    483492        gsdl_dbhome = value;
    484493      }
     
    488497      if (key == "gsdlhome") {
    489498        gsdl_collectinfo[section].gsdl_gsdlhome = value;
     499        gsdl_collectinfo[section].gsdl_collecthome = filename_cat(value,"collecct");
    490500        gsdl_collectinfo[section].gsdl_dbhome = value;
    491       } else if (key == "gdbmhome") {
     501      }
     502      else if (key == "collecthome") {
     503        gsdl_collectinfo[section].gsdl_collecthome = value;
     504      }
     505      else if (key == "gdbmhome") {
    492506        gsdl_collectinfo[section].gsdl_dbhome = value;
    493507      }
     
    502516  // extra slashes at the end
    503517  remove_end_slashes (gsdl_gsdlhome);
     518  remove_end_slashes (gsdl_collecthome);
    504519  remove_end_slashes (gsdl_dbhome);
    505520  colinfo_tmap::iterator here = gsdl_collectinfo.begin();
     
    507522  while (here != end) {
    508523    remove_end_slashes ((*here).second.gsdl_gsdlhome);
     524    remove_end_slashes ((*here).second.gsdl_collecthome);
    509525    remove_end_slashes ((*here).second.gsdl_dbhome);
    510526    ++here;
  • gsdl/trunk/src/w32server/settings.h

    r15625 r16310  
    4848extern text_t gsdl_enterlib;
    4949extern text_t gsdl_gsdlhome;
     50extern text_t gsdl_collecthome;
    5051extern text_t gsdl_dbhome;
    5152extern text_t gsdl_collections;
Note: See TracChangeset for help on using the changeset viewer.