Changeset 16310
- Timestamp:
- 2008-07-09T13:12:15+12:00 (15 years ago)
- Location:
- gsdl/trunk/src
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/colservr/browsefilter.cpp
r15680 r16310 85 85 indexstem = collection; 86 86 } 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()); 90 89 if (!file_exists(db_filename)) { 91 90 logout << text_t2ascii -
gsdl/trunk/src/colservr/collectserver.cpp
r16027 r16310 85 85 else if (key == "gsdlhome") configinfo.gsdlhome = value; 86 86 else if (key == "gdbmhome") configinfo.dbhome = value; 87 else if (key == "collecthome") configinfo.collecthome = value; 87 88 else if (key == "collection") { 88 89 configinfo.collection = value; 89 90 collectinfo.shortInfo.name = value; 90 } else if (key == "collectdir") configinfo.collectdir = value; 91 } 92 else if (key == "collectdir") configinfo.collectdir = value; 91 93 else if (key == "host") collectinfo.shortInfo.host = value; 92 94 else if (key == "port") collectinfo.shortInfo.port = value.getint(); -
gsdl/trunk/src/colservr/collectserver.h
r15587 r16310 59 59 struct colservrconf { 60 60 text_t gsdlhome; 61 text_t collecthome; 61 62 text_t dbhome; 62 63 text_t collection; -
gsdl/trunk/src/colservr/collectset.h
r15401 r16310 26 26 27 27 public: 28 collectset(text_t &gsdlhome);28 collectset(text_t& gsdlhome, text_t& collecthome); 29 29 // this constructor is used by the local library 30 30 collectset() {} … … 39 39 40 40 // 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); 42 42 void remove_all_collections (); 43 43 … … 46 46 47 47 void add_collection (const text_t &collection, 48 const text_t &gsdlhome); 48 const text_t &gsdlhome, 49 const text_t& collecthome); 49 50 50 51 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); 53 57 54 58 // return the total number of servers in the set -
gsdl/trunk/src/colservr/colservrconfig.cpp
r15458 r16310 44 44 // collect_cfg_read reads collect.cfg returning true on success. 45 45 bool 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"); 53 51 54 52 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"); 59 54 60 55 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"); 63 57 if (!file_exists (filename)) return false; 64 58 } … … 66 60 67 61 return cserver.read_configfile(filename); 68 /*69 // read in the collection configuration file70 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 server83 cserver.configure (key, cfgline);84 }85 }86 confin.close ();87 return true;88 }89 return false;90 */91 62 } 92 63 … … 94 65 // build_cfg_read reads build.cfg and returns true on success. 95 66 bool build_cfg_read (collectserver &cserver, const text_t &gsdlhome, 67 const text_t& collecthome, 96 68 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"); 100 70 101 filename = filename_cat (filename, "build.cfg");102 71 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"); 105 73 if (!file_exists (filename)) return false; 106 74 } … … 108 76 return cserver.read_configfile(filename); 109 77 110 /*111 // read in the build configuration file112 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 server125 cserver.configure (key, cfgline);126 }127 }128 confin.close ();129 return true;130 }131 return false;132 */133 78 } -
gsdl/trunk/src/colservr/colservrconfig.h
r1285 r16310 36 36 // collect_cfg_read reads collect.cfg returning true on success. 37 37 bool collect_cfg_read (collectserver &cserver, const text_t &gsdlhome, 38 const text_t &collection);38 const text_t& collecthome, const text_t &collection); 39 39 40 40 // build_cfg_read reads build.cfg and returns true on success. 41 41 bool build_cfg_read (collectserver &cserver, const text_t &gsdlhome, 42 const text_t &collection);42 const text_t& collecthome, const text_t &collection); 43 43 44 44 -
gsdl/trunk/src/colservr/filter.cpp
r15587 r16310 27 27 #include "fileutil.h" 28 28 #include <assert.h> 29 30 #include <iostream> 31 using namespace std; 29 32 30 33 … … 46 49 else if (key == "collectdir") collectdir = value; 47 50 else if (key == "gsdlhome") gsdlhome = value; 51 else if (key == "collecthome") collecthome = value; 48 52 else if (key == "gdbmhome") dbhome = value; 49 53 else if ((key == "filteroptdefault") && (cfgline.size() == 2)) { … … 56 60 } 57 61 } 62 63 text_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 58 85 59 86 // init should be called after all the configuration is done but … … 70 97 } 71 98 99 if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect"); 72 100 if (dbhome.empty()) dbhome = gsdlhome; 73 101 74 102 // get the collection directory name 75 103 if (collectdir.empty()) { 76 collectdir = filename_cat ( gsdlhome, "collect", collection);104 collectdir = filename_cat (collecthome, collection); 77 105 } 78 106 -
gsdl/trunk/src/colservr/filter.h
r15587 r16310 36 36 protected: 37 37 text_t gsdlhome; 38 text_t collecthome; 38 39 text_t dbhome; 39 40 text_t collection; … … 65 66 FilterResponse_t &response, 66 67 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 67 73 }; 68 74 -
gsdl/trunk/src/colservr/lucenesearch.cpp
r15594 r16310 84 84 } 85 85 86 86 87 bool lucenesearchclass::search(const queryparamclass &queryparams, 87 88 queryresultsclass &queryresult) { … … 147 148 } 148 149 149 cerr << "Lucene command: " << cmd << endl;150 151 150 text_t xml_text = ""; 152 151 -
gsdl/trunk/src/colservr/mgqueryfilter.cpp
r15681 r16310 195 195 err = noError; 196 196 textsearchptr->setcollectdir (collectdir); 197 197 198 multiresults.clear(); 198 199 -
gsdl/trunk/src/colservr/queryfilter.cpp
r15680 r16310 413 413 indexstem = collection; 414 414 } 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()); 417 416 if (!file_exists(db_filename)) { 418 417 logout << text_t2ascii -
gsdl/trunk/src/colservr/source.cpp
r15680 r16310 52 52 else if (key == "collectdir") collectdir = value; 53 53 else if (key == "gsdlhome") gsdlhome = value; 54 else if (key == "collecthome") collecthome = value; 54 55 else if (key == "gdbmhome") dbhome = value; 55 56 } … … 77 78 } 78 79 80 text_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 79 115 // init should be called after all the configuration is done but 80 116 // before any other methods are called … … 83 119 outconvertclass text_t2ascii; 84 120 121 if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect"); 85 122 if (dbhome.empty()) dbhome = gsdlhome; 86 123 … … 114 151 // get the collection directory name 115 152 if (collectdir.empty()) { 116 collectdir = filename_cat ( gsdlhome, "collect", collection);153 collectdir = filename_cat (collecthome, collection); 117 154 } 118 155 … … 128 165 indexstem = collection; 129 166 } 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()); 132 168 if (!file_exists(db_filename)) { 133 169 logout << text_t2ascii -
gsdl/trunk/src/colservr/source.h
r15591 r16310 41 41 42 42 text_t gsdlhome; 43 text_t collecthome; 43 44 text_t dbhome; 44 45 text_t collection; … … 96 97 97 98 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 98 104 }; 99 105 -
gsdl/trunk/src/colservr/sqlbrowsefilter.cpp
r16180 r16310 69 69 70 70 // 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()); 73 72 if (!file_exists(sql_db_filename)) 74 73 { -
gsdl/trunk/src/lib/gsdlsitecfg.cpp
r15402 r16310 24 24 *********************************************************************/ 25 25 26 26 #include "fileutil.h" 27 27 #include "gsdlsitecfg.h" 28 28 … … 42 42 private: 43 43 text_t *gsdlhome; 44 text_t *collecthome; 44 45 text_t *httpdomain; 45 46 text_t *httpprefix; … … 49 50 int *maxrequests; 50 51 public: 51 __site_configuration (text_t *_gsdlhome, int *_maxrequests) {52 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, int *_maxrequests) { 52 53 gsdlhome = _gsdlhome; 54 collecthome = _collecthome; 53 55 httpdomain = NULL; 54 56 httpprefix = NULL; … … 59 61 } 60 62 61 __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,62 63 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, 64 text_t *_httpdomain, text_t *_httpprefix) { 63 65 gsdlhome = _gsdlhome; 66 collecthome = _collecthome; 64 67 httpdomain = _httpdomain; 65 68 httpprefix = _httpprefix; … … 70 73 } 71 74 72 __site_configuration (text_t *_gsdlhome, text_t *_httpdomain, 75 __site_configuration (text_t *_gsdlhome, text_t* _collecthome, 76 text_t *_httpdomain, 73 77 text_t *_httpprefix, text_t *_collection) { 74 78 gsdlhome = _gsdlhome; 79 collecthome = _collecthome; 75 80 httpdomain = _httpdomain; 76 81 httpprefix = _httpprefix; … … 83 88 __site_configuration (text_t *_httpprefix, text_tset *_actions, text_tset *_browsers) { 84 89 gsdlhome = NULL; 90 collecthome = NULL; 85 91 httpdomain = NULL; 86 92 httpprefix = _httpprefix; … … 94 100 if (gsdlhome != NULL && key == "gsdlhome") { 95 101 *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]; 96 115 } 97 116 … … 141 160 // also sets gsdlhome and maxrequests 142 161 // gsdlsite.cfg should be in same directory as library executable 143 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, int &maxrequests) 162 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, 163 text_t& collecthome, int &maxrequests) 144 164 { 145 __site_configuration sitecfg(&gsdlhome, & maxrequests);165 __site_configuration sitecfg(&gsdlhome, &collecthome, &maxrequests); 146 166 gsdlconfigurator.add_configurable(&sitecfg); 147 167 148 // blank the gsdl 168 // blank the gsdlhome and collecthome text 149 169 gsdlhome.clear(); 170 collecthome.clear(); 150 171 151 172 if (gsdlconfigurator.configure("gsdlsite.cfg")) … … 158 179 159 180 160 // this version grabs gsdlhome, httpdomain and httpprefix,181 // this version grabs gsdlhome, collecthome, httpdomain and httpprefix, 161 182 // returns false if it can't find all of them 162 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,183 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, 163 184 text_t &httpprefix) 164 185 { 165 186 // get gsdlhome etc 166 __site_configuration sitecfg(&gsdlhome, & httpdomain, &httpprefix);187 __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix); 167 188 configurator gsdlconfigurator(&sitecfg); 168 189 169 190 gsdlhome.clear(); 191 collecthome.clear(); 170 192 httpdomain.clear(); 171 193 httpprefix.clear(); … … 180 202 181 203 182 // this version grabs gsdlhome, httpdomain, httpprefix, collection,204 // this version grabs gsdlhome, collecthome, httpdomain, httpprefix, collection, 183 205 // returns false if it can't find gsdlhome, httpdomain and httpprefix 184 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,206 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, 185 207 text_t &httpprefix, text_t &collection) 186 208 { 187 209 // get gsdlhome etc 188 __site_configuration sitecfg(&gsdlhome, & httpdomain, &httpprefix, &collection);210 __site_configuration sitecfg(&gsdlhome, &collecthome, &httpdomain, &httpprefix, &collection); 189 211 configurator gsdlconfigurator(&sitecfg); 190 212 191 213 gsdlhome.clear(); 214 collecthome.clear(); 192 215 httpdomain.clear(); 193 216 httpprefix.clear(); … … 195 218 196 219 if (gsdlconfigurator.configure("gsdlsite.cfg") && 197 !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty()) 220 !gsdlhome.empty() && !collecthome.empty() 221 && !httpdomain.empty() && !httpprefix.empty()) 198 222 { 199 223 return true; -
gsdl/trunk/src/lib/gsdlsitecfg.h
r15402 r16310 34 34 35 35 // 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); 36 bool site_cfg_read (configurator gsdlconfigurator, text_t &gsdlhome, 37 text_t& collecthome, int &maxrequests); 38 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, text_t &httpprefix); 39 bool site_cfg_read (text_t &gsdlhome, text_t& collecthome, text_t &httpdomain, text_t &httpprefix, text_t &collection); 39 40 40 41 -
gsdl/trunk/src/oaiservr/oaimain.cpp
r15844 r16310 103 103 collectset *cservers; 104 104 text_t gsdlhome; 105 text_t collecthome; 105 106 text_t gsdlcollect = ""; 106 107 oaiargs args; … … 122 123 delete []cstr; 123 124 124 cservers = new collectset(gsdlhome );125 cservers = new collectset(gsdlhome,collecthome); 125 126 126 127 // set up the null protocol -
gsdl/trunk/src/protocol/nullproto.cpp
r15588 r16310 45 45 // collectset has been added to the protocol with set_collectset() 46 46 void 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 { 48 50 49 51 if (cset != NULL) { 50 this->cset->add_collection (collection, gsdlhome );52 this->cset->add_collection (collection, gsdlhome, collecthome); 51 53 } 52 54 } … … 70 72 // the protocol should not configure the collection set; it should be 71 73 // done direct to the collection server set 72 if (key == "gsdlhome" || key == "gdbmhome") { 74 if (key == "gsdlhome" || key == "gdbmhome" 75 || key == "collecthome" || key == "collectdir") { 73 76 cset->configure(key, cfgline); 74 77 } -
gsdl/trunk/src/protocol/nullproto.h
r15588 r16310 44 44 // add_collectserver 45 45 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); 47 48 48 49 void set_collectset(collectset *set) { this->cset = set; } -
gsdl/trunk/src/protocol/recptproto.cpp
r15588 r16310 30 30 // add collection server to protocol 31 31 void 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 { 33 35 } 34 36 -
gsdl/trunk/src/protocol/recptproto.h
r15588 r16310 56 56 // add collection server to protocol 57 57 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); 59 60 60 61 virtual void remove_collection (const text_t &collection, ostream &logout); -
gsdl/trunk/src/recpt/action.cpp
r15589 r16310 24 24 *********************************************************************/ 25 25 26 #include "fileutil.h" 27 26 28 #include "action.h" 27 29 #include <assert.h> … … 44 46 if (key == "gsdlhome") { 45 47 gsdlhome = cfgline[0]; 48 if (collecthome.empty()) collecthome = filename_cat(gsdlhome,"collect"); 46 49 if (dbhome.empty()) dbhome = cfgline[0]; 47 50 } 51 if (key == "collecthome") {collecthome = cfgline[0];} 48 52 if (key == "gdbmhome") {dbhome = cfgline[0];} 49 53 } -
gsdl/trunk/src/recpt/action.h
r15589 r16310 48 48 cgiargsinfoclass argsinfo; 49 49 text_t gsdlhome; 50 text_t collecthome; 50 51 text_t dbhome; 51 52 -
gsdl/trunk/src/recpt/cgiwrapper.cpp
r15589 r16310 129 129 static void page_errorcollect (const text_t &gsdlhome, text_t &errorpage, bool debug) { 130 130 131 text_t collect dir= filename_cat (gsdlhome, "collect");131 text_t collecthome = filename_cat (gsdlhome, "collect"); 132 132 133 133 text_t errortext = "No valid collections were found: Check that your collect directory\n"; 134 errortext += "(" + collect dir+ ") is readable and contains at least one valid collection.\n";134 errortext += "(" + collecthome + ") is readable and contains at least one valid collection.\n"; 135 135 errortext += "Note that modelcol is NOT a valid collection.\n"; 136 136 errortext += "If the path to your collect directory is wrong edit the 'gsdlhome' field\n"; … … 301 301 bool colspec = false; 302 302 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 " 304 304 << "specific\") mode.\n"; 305 305 } else { … … 311 311 } 312 312 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"; 314 316 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" 319 321 << " Note that unless gwcgi has been set from a configuration\n" 320 322 << " file it is dependent on environment variables set by your\n" … … 483 485 // read in the configuration files. 484 486 text_t gsdlhome; 487 text_t collecthome; 485 488 configurator gsdlconfigurator(&recpt); 486 if (!site_cfg_read (gsdlconfigurator, gsdlhome, maxrequests)) {489 if (!site_cfg_read (gsdlconfigurator, gsdlhome, collecthome, maxrequests)) { 487 490 // couldn't find the site configuration file 488 491 page_errorsitecfg (errorpage, debug, 0); … … 493 496 // gsdlhome not a valid directory 494 497 page_errorsitecfg (errorpage, debug, 1); 495 } else if (!main_cfg_read (recpt, gsdlhome, collect ion)) {498 } else if (!main_cfg_read (recpt, gsdlhome, collecthome, collection)) { 496 499 // couldn't find the main configuration file 497 500 page_errormaincfg (gsdlhome, collection, debug, errorpage); -
gsdl/trunk/src/recpt/collectoraction.cpp
r15597 r16310 381 381 // etc directory to the new collection. 382 382 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"); 384 384 text_t new_etc = filename_cat(get_collectdir(args), args["bc1dirname"], "etc"); 385 385 text_tarray files; … … 454 454 // cloning was turned on 455 455 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"); 457 457 if (file_exists (cfgfile_clone)) { 458 458 // if .org file doesn't exist already create it … … 1170 1170 // delete it 1171 1171 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"); 1173 1173 char *cfgfilec = cfgfile.getcstr(); 1174 1174 ifstream cfg_in (cfgfilec); -
gsdl/trunk/src/recpt/depositoraction.cpp
r15453 r16310 612 612 } else { 613 613 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"]); 615 615 text_t import_dirname = filename_cat(col_dirname,"import"); 616 616 if(!directory_exists(import_dirname)) { … … 756 756 757 757 //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"); 759 759 text_t my_path = filename_cat(gsdlhome,"tmp", "metadata.xml"); 760 760 … … 792 792 793 793 //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"); 795 795 796 796 char* manifest_cstr = manifest_path.getcstr(); -
gsdl/trunk/src/recpt/librarymain.cpp
r15744 r16310 70 70 #endif 71 71 text_t gsdlhome; 72 73 cservers = new collectset(gsdlhome); 72 text_t collecthome; 73 74 cservers = new collectset(gsdlhome,collecthome); 74 75 75 76 // configure the receptionist server list … … 82 83 colinfo.push_back(*collection_iterator); 83 84 colinfo.push_back(gsdlhome); 85 colinfo.push_back(collecthome); 84 86 colinfo.push_back(gsdlhome); 85 87 recpt.configure("collectinfo", colinfo); -
gsdl/trunk/src/recpt/maincfg.cpp
r15402 r16310 40 40 41 41 42 bool 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 42 53 // main_cfg_read reads both main.cfg and collect.cfg. It attempts 43 54 // to read main.cfg first so values in collect.cfg override those 44 55 // set earlier by main.cfg 45 56 bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome, 46 const text_t &collection) {57 const text_t& collecthome, const text_t &collection) { 47 58 48 59 // read in the main configuration file … … 62 73 } 63 74 64 // Look for collect.cfg in GSDLHOME/collect/collection-name/etc directory75 // Look for collect.cfg in <collecthome>/collection-name/etc directory 65 76 // (if this is for a particular collection), and then GSDLHOME/etc. 66 77 if (!collection.empty()) { 67 filename = filename_cat (gsdlhome, "collect"); 68 filename = filename_cat (filename, collection); 78 filename = filename_cat (collecthome, collection); 69 79 filename = filename_cat (filename, "etc"); 70 80 filename = filename_cat (filename, "collect.cfg"); -
gsdl/trunk/src/recpt/maincfg.h
r15402 r16310 40 40 // collection is specified and then it tries to read in main.cfg 41 41 bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome, 42 const text_t& collecthome, const text_t &collection); 43 44 bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome, 42 45 const text_t &collection); 43 46 -
gsdl/trunk/src/recpt/pageaction.cpp
r15418 r16310 979 979 980 980 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")); 982 982 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")); 984 984 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")); 986 986 } 987 987 } -
gsdl/trunk/src/recpt/phindaction.cpp
r12315 r16310 168 168 unsigned long ef, lf, df; 169 169 170 text_t basepath = filename_cat( gsdlhome, "collect", args["c"],170 text_t basepath = filename_cat(collecthome, args["c"], 171 171 "index", "phind" + args["pc"]); 172 172 -
gsdl/trunk/src/recpt/receptionist.cpp
r15589 r16310 52 52 void recptconf::clear () { 53 53 gsdlhome.clear(); 54 collecthome.clear(); 54 55 dbhome.clear(); 55 56 collectinfo.erase(collectinfo.begin(), collectinfo.end()); … … 222 223 if (configinfo.dbhome.empty()) configinfo.dbhome = cfgline[0]; 223 224 } 225 else if (key == "collecthome") configinfo.collecthome = cfgline[0]; 224 226 else if (key == "gdbmhome") configinfo.dbhome = cfgline[0]; 225 227 else if (key == "collection") { … … 231 233 } 232 234 233 } else if (key == "collectdir") configinfo.collectdir = cfgline[0]; 235 } 236 else if (key == "collectdir") configinfo.collectdir = cfgline[0]; 234 237 else if (key == "httpprefix") configinfo.httpprefix = cfgline[0]; 235 238 else if (key == "httpimg") configinfo.httpimg = cfgline[0]; … … 269 272 else if (key == "macroprecedence") configinfo.macroprecedence = cfgline[0]; 270 273 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 272 277 collectioninfo_t cinfo; 273 278 cinfo.gsdl_gsdlhome = cfgline[1]; 279 cinfo.gsdl_collecthome = filename_cat(cfgline[1],"collect"); 274 280 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]; 275 288 configinfo.collectinfo[cfgline[0]] = cinfo; 276 289 } … … 427 440 428 441 // first configure collectdir 429 text_t thecollectdir = configinfo.gsdlhome;430 442 if (!configinfo.collection.empty()) { 443 431 444 // collection specific mode 445 446 text_t collectdir = configinfo.gsdlhome; 447 432 448 if (!configinfo.collectdir.empty()) { 433 449 // has already been configured 434 thecollectdir = configinfo.collectdir;450 collectdir = configinfo.collectdir; 435 451 } else { 452 436 453 // decide where collectdir is by searching for collect.cfg 437 454 // look in $GSDLHOME/collect/collection-name/etc/collect.cfg and 438 455 // 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"); 442 459 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 448 484 449 485 // read in the macro files … … 824 860 collectname=args["c"]; 825 861 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 828 872 text_t buildcfg=filename_cat(collectdir,"index"); 829 873 buildcfg=filename_cat(buildcfg,"build.cfg"); … … 1186 1230 1187 1231 text_t colmacrodir 1188 = filename_cat (configinfo. gsdlhome,"collect",collection, "macros");1232 = filename_cat (configinfo.collecthome,collection, "macros"); 1189 1233 1190 1234 if (directory_exists (colmacrodir)) { -
gsdl/trunk/src/recpt/receptionist.h
r15589 r16310 55 55 56 56 text_t gsdl_gsdlhome; 57 text_t gsdl_collecthome; 57 58 text_t gsdl_dbhome; 58 59 … … 77 78 struct recptconf { 78 79 text_t gsdlhome; 80 text_t collecthome; 79 81 text_t dbhome; // will equal gsdlhome if not set 80 82 text_t collection; // will equal "" in 'general' mode -
gsdl/trunk/src/recpt/wizardaction.cpp
r15597 r16310 201 201 // collect.cfg file is writable 202 202 bool 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"); 204 204 if (file_writable(cfgfile)) return false; 205 205 return true; … … 310 310 311 311 // check to see if shortname is unique 312 text_t fulldirname = filename_cat ( gsdlhome, "collect", shortname);312 text_t fulldirname = filename_cat (collecthome, shortname); 313 313 if (directory_exists (fulldirname)) { 314 314 int version = 0; … … 319 319 newname.push_back ('v'); 320 320 newname.appendint (version); 321 fulldirname = filename_cat ( gsdlhome, "collect", newname);321 fulldirname = filename_cat (collecthome, newname); 322 322 } while (directory_exists (fulldirname)); 323 323 … … 468 468 469 469 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"); 471 471 text_t pluginstr, pluginname; 472 472 … … 654 654 if ((args[macro_prefix+"econf"] == 1) || (args[macro_prefix+"esrce"] == 1)) { 655 655 // we're adding to a collection in place 656 return filename_cat(gsdlhome, "collect");656 return collecthome; 657 657 } 658 658 else { … … 673 673 if ((*rprotolist_here).p->get_protocol_name (err) == "nullproto") { 674 674 // 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); 676 676 // make sure gsdlhome is configured 677 677 text_tarray tmp; -
gsdl/trunk/src/w32server/cgiwrapper.cpp
r15852 r16310 392 392 // that we can find the relevant directories 393 393 if (!checkdir (gsdl_gsdlhome + "\\")) return 0; 394 if (!checkdir (gsdl_collecthome + "\\")) return 0; 394 395 if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0; 395 396 } … … 409 410 collectioninfo_t tmp; 410 411 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 412 tmp.gsdl_collecthome = gsdl_collecthome; 411 413 tmp.gsdl_dbhome = gsdl_dbhome; 412 414 translated_collectinfo[collection] = tmp; … … 424 426 if (dbhomes.find ((*this_info).second.gsdl_dbhome) == dbhomes.end()) { 425 427 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); 427 429 colhere = these_collections.begin(); 428 430 colend = these_collections.end(); … … 433 435 // file is installed here -- it's real gdbm will therefore be 434 436 // 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, 436 438 *colhere, "index", "build.cfg"); 437 439 if (file_exists (build_cfg)) { … … 462 464 collectioninfo_t tmp; 463 465 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 466 tmp.gsdl_collecthome = gsdl_collecthome; 464 467 tmp.gsdl_dbhome = gsdl_dbhome; 465 468 translated_collectinfo[*colhere] = tmp; … … 483 486 // create collection server and add to null protocol 484 487 text_t this_gsdlhome = gsdl_gsdlhome; 488 text_t this_collecthome = gsdl_collecthome; 485 489 text_t this_dbhome = gsdl_dbhome; 486 490 colinfo_tmap::const_iterator it = translated_collectinfo.find (*thiscol); 487 491 assert (it != translated_collectinfo.end()); 488 492 this_gsdlhome = (*it).second.gsdl_gsdlhome; 493 this_collecthome = (*it).second.gsdl_collecthome; 489 494 this_dbhome = (*it).second.gsdl_dbhome; 490 495 … … 623 628 // set defaults 624 629 recpt.configure ("gsdlhome", gsdl_gsdlhome); 630 recpt.configure ("collecthome", gsdl_collecthome); 625 631 recpt.configure ("gdbmhome", gsdl_dbhome); 626 632 recpt.configure ("collection", collection); … … 637 643 tmpconf.push_back ((*this_info).first); 638 644 tmpconf.push_back ((*this_info).second.gsdl_gsdlhome); 645 tmpconf.push_back ((*this_info).second.gsdl_collecthome); 639 646 tmpconf.push_back ((*this_info).second.gsdl_dbhome); 640 647 recpt.configure ("collectinfo", tmpconf); … … 646 653 // collections being used together in this way should be 647 654 // careful not to have main.cfg files that might 648 // screwwith each other.655 // interfere with each other. 649 656 text_tset::const_iterator thome = dbhomes.begin(); 650 657 text_tset::const_iterator ehome = dbhomes.end(); -
gsdl/trunk/src/w32server/settings.cpp
r15625 r16310 47 47 text_t gsdl_enterlib; 48 48 text_t gsdl_gsdlhome; 49 text_t gsdl_collecthome; 49 50 text_t gsdl_dbhome; 50 51 text_t gsdl_collections; … … 300 301 write_ini_line(fout, "enterlib", gsdl_enterlib); 301 302 write_ini_line(fout, "gsdlhome", gsdl_gsdlhome); 303 write_ini_line(fout, "collecthome", gsdl_collecthome); 302 304 write_ini_line(fout, "gdbmhome", gsdl_dbhome); 303 305 … … 321 323 if (!(*here).second.gsdl_gsdlhome.empty()) 322 324 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); 323 327 if (!(*here).second.gsdl_dbhome.empty()) 324 328 write_ini_line(fout, "gdbmhome", (*here).second.gsdl_dbhome); … … 385 389 gsdl_enterlib = "/gsdl"; 386 390 gsdl_gsdlhome = data_location; 391 gsdl_collecthome = filename_cat(data_location,"collect"); 387 392 gsdl_dbhome = data_location; 388 393 … … 474 479 } else if (key == "collections") { 475 480 gsdl_collections = value; 476 481 } 477 482 // gsdlhome must occur in file before dbhome 478 }else if (key == "gsdlhome") {483 else if (key == "gsdlhome") { 479 484 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") { 483 492 gsdl_dbhome = value; 484 493 } … … 488 497 if (key == "gsdlhome") { 489 498 gsdl_collectinfo[section].gsdl_gsdlhome = value; 499 gsdl_collectinfo[section].gsdl_collecthome = filename_cat(value,"collecct"); 490 500 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") { 492 506 gsdl_collectinfo[section].gsdl_dbhome = value; 493 507 } … … 502 516 // extra slashes at the end 503 517 remove_end_slashes (gsdl_gsdlhome); 518 remove_end_slashes (gsdl_collecthome); 504 519 remove_end_slashes (gsdl_dbhome); 505 520 colinfo_tmap::iterator here = gsdl_collectinfo.begin(); … … 507 522 while (here != end) { 508 523 remove_end_slashes ((*here).second.gsdl_gsdlhome); 524 remove_end_slashes ((*here).second.gsdl_collecthome); 509 525 remove_end_slashes ((*here).second.gsdl_dbhome); 510 526 ++here; -
gsdl/trunk/src/w32server/settings.h
r15625 r16310 48 48 extern text_t gsdl_enterlib; 49 49 extern text_t gsdl_gsdlhome; 50 extern text_t gsdl_collecthome; 50 51 extern text_t gsdl_dbhome; 51 52 extern text_t gsdl_collections;
Note:
See TracChangeset
for help on using the changeset viewer.