Changeset 22050 for main/trunk
- Timestamp:
- 2010-05-06T12:58:19+12:00 (14 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src/colservr
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in
r21472 r22050 158 158 search.cpp \ 159 159 source.cpp \ 160 sqlbrowsefilter.cpp 160 sqlbrowsefilter.cpp \ 161 sqlqueryfilter.cpp \ 162 sqlfilter.cpp 161 163 162 164 OBJECTS = \ … … 179 181 search.o \ 180 182 source.o \ 181 sqlbrowsefilter.o 183 sqlbrowsefilter.o \ 184 sqlqueryfilter.o \ 185 sqlfilter.o 182 186 183 187 LIBRARY = gsdlcolservr.a -
main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp
r21324 r22050 52 52 else { 53 53 cerr << "Error: buildtype '" << buildtype << "' is not a recognized indexer for Greenstone." << endl; 54 } 55 56 } 57 58 59 void check_if_valid_infodbtype(const text_t& infodbtype) 60 { 61 if (infodbtype=="gdbm") { 62 #ifndef USE_GDBM 63 cerr << "Warning: Greenstone installation has not been compiled to support infodbtype 'gdbm'." << endl; 64 #endif 65 } 66 else if (infodbtype=="gdbm-txtgz") { 67 #ifndef USE_GDBM 68 cerr << "Warning: Greenstone installation has not been compiled to support infodbtype 'gdbm-txtgz'." << endl; 69 #endif 70 } 71 else if (infodbtype=="jdbm") { 72 #ifndef USE_JDBM 73 cerr << "Warning: Greenstone installation has not been compiled to support infodbtype 'jdbm'." << endl; 74 #endif 75 } 76 else if (infodbtype=="sqlite") { 77 #ifndef USE_SQLITE 78 cerr << "Warning: Greenstone installation has not been compiled to support infodbtype 'sqlite'." << endl; 79 #endif 80 } 81 else if (infodbtype=="mssql") { 82 #ifndef USE_MSSQL 83 cerr << "Warning: Greenstone installation has not been compiled to support infodbtype 'mssql'." << endl; 84 #endif 85 } 86 87 else { 88 cerr << "Error: infodbtype '" << infodbtype << "' is not a recognized database type for Greenstone." << endl; 54 89 } 55 90 … … 242 277 //collectinfo.searchTypes = cfgline; 243 278 } 279 else if (key == "infodbtype") { 280 check_if_valid_infodbtype(value); // prints warning if value (database type) is invalid 281 collectinfo.infodbType = value; 282 } 244 283 else if (key == "separate_cjk") { 245 284 if (value == "true") collectinfo.isSegmented = true; -
main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp
r21472 r22050 34 34 #include "browsefilter.h" 35 35 #include "sqlbrowsefilter.h" 36 #include "sqlqueryfilter.h" 36 37 #include "queryfilter.h" 37 38 … … 335 336 dbclass *db_ptr = NULL; 336 337 337 #ifdef USE_SQLITE338 338 if (infodbtype == "sqlite") 339 339 { 340 #ifdef USE_SQLITE 340 341 sqlitedbclass *sql_db_ptr = new sqlitedbclass(); 341 342 db_ptr = sql_db_ptr; … … 345 346 sqlbrowsefilter->set_sql_db_ptr(sql_db_ptr); 346 347 cserver->add_filter (sqlbrowsefilter); 347 } 348 #endif 348 349 // add a sql query filter 350 sqlqueryfilterclass *sqlqueryfilter = new sqlqueryfilterclass(); 351 sqlqueryfilter->set_sql_db_ptr(sql_db_ptr); 352 cserver->add_filter (sqlqueryfilter); 353 354 #else 355 cerr << "Warning: infodbtype of 'sqlite' was not compiled in to " << endl; 356 cerr << " this installation of Greenstone"; 357 #endif 358 } 349 359 350 #ifdef USE_MSSQL351 360 if (infodbtype == "mssql") 352 361 { 362 #ifdef USE_MSSQL 353 363 mssqldbclass *mssql_db_ptr = new mssqldbclass(); 354 364 db_ptr = mssql_db_ptr; … … 358 368 sqlbrowsefilter->set_sql_db_ptr(mssql_db_ptr); 359 369 cserver->add_filter (sqlbrowsefilter); 360 } 361 #endif 370 #else 371 cerr << "Warning: infodbtype of 'mssql' was not compiled in to " << endl; 372 cerr << " this installation of Greenstone"; 373 #endif 374 } 375 376 if (infodbtype == "jdbm") { 362 377 363 378 #ifdef USE_JDBM 364 if (infodbtype == "jdbm") {365 366 379 jdbmnaiveclass *jdbm_db_ptr = new jdbmnaiveclass(gsdlhome); 367 380 db_ptr = jdbm_db_ptr; 368 } 369 #endif 381 #else 382 cerr << "Warning: infodbtype of 'jdbm' was not compiled in to " << endl; 383 cerr << " this installation of Greenstone"; 384 #endif 385 } 370 386 371 387 // Use GDBM if the infodb type is empty or not one of the values above … … 373 389 #ifdef USE_GDBM 374 390 db_ptr = new gdbmclass(); 391 #else 392 cerr << "Warning: infodbtype of 'gdbm' was not compiled in to " << endl; 393 cerr << " this installation of Greenstone"; 375 394 #endif 376 395 } -
main/trunk/greenstone2/runtime-src/src/colservr/comtypes.h
r15802 r22050 106 106 text_t receptionist; 107 107 text_t buildType; // 'mg' or 'mgpp' or 'lucene' 108 text_t authenticate; // 'document' or 'collection' 108 text_t infodbType; // 'gdbm', 'sqlite', etc. 109 text_t authenticate; // 'document' or 'collection' 109 110 text_t auth_group; // 'mygroup' 'yourgroup' 110 111 text_tmap public_documents; // the acl to allow access to listed documents -
main/trunk/greenstone2/runtime-src/src/colservr/lucenequeryfilter.cpp
r20727 r22050 265 265 endresults, phrasematch, logout); 266 266 267 267 vector<queryparamclass>::const_iterator query_here = queryfilterparams.begin(); 268 268 269 269 // do query -
main/trunk/greenstone2/runtime-src/src/colservr/sqlbrowsefilter.cpp
r16310 r22050 3 3 * sqlbrowsefilter.cpp -- 4 4 * Copyright (C) 2008 DL Consulting Ltd 5 * Copyright (C) 2010 New Zealand Digital Library Project 5 6 * 6 7 * A component of the Greenstone digital library software … … 25 26 26 27 #include "sqlbrowsefilter.h" 27 #include "fileutil.h"28 29 28 30 29 sqlbrowsefilterclass::sqlbrowsefilterclass () 31 { 32 sql_db_ptr = NULL; 33 } 30 : sqlfilterclass() 31 {} 34 32 35 33 36 34 sqlbrowsefilterclass::~sqlbrowsefilterclass () 37 { 38 } 39 40 41 void sqlbrowsefilterclass::configure (const text_t &key, const text_tarray &cfgline) 42 { 43 filterclass::configure (key, cfgline); 44 45 if (key == "indexstem") 46 { 47 indexstem = cfgline[0]; 48 } 49 } 50 51 52 bool sqlbrowsefilterclass::init (ostream &logout) 53 { 54 outconvertclass text_t2ascii; 55 56 if (!filterclass::init(logout)) return false; 57 58 if (sql_db_ptr == NULL) 59 { 60 // most likely a configuration problem 61 logout << text_t2ascii << "configuration error: sqlbrowsefilter contains a null sqldbclass\n\n"; 62 return false; 63 } 64 65 if (indexstem.empty()) 66 { 67 indexstem = collection; 68 } 69 70 // get the filename for the database and make sure it exists 71 sql_db_filename = resolve_db_filename(indexstem,sql_db_ptr->getfileextension()); 72 if (!file_exists(sql_db_filename)) 73 { 74 logout << text_t2ascii << "warning: database \"" << sql_db_filename << "\" does not exist\n\n"; 75 return false; 76 } 77 78 return true; 79 } 80 35 {} 81 36 82 37 void sqlbrowsefilterclass::filter (const FilterRequest_t &request, … … 86 41 outconvertclass text_t2ascii; 87 42 88 response.clear(); 89 err = noError; 90 91 if (sql_db_ptr == NULL) { 92 // most likely a configuration problem 93 logout << text_t2ascii << "configuration error: sqlbrowsefilter contains a null sqldbclass\n\n"; 94 err = configurationError; 95 return; 96 } 97 98 // open the database 99 sql_db_ptr->setlogout (&logout); 100 if (!sql_db_ptr->opendatabase (sql_db_filename, DB_READER, 100, false)) { 101 // most likely a system problem (we have already checked that the database exists) 102 logout << text_t2ascii << "system problem: open on database \"" << sql_db_filename << "\" failed\n\n"; 103 err = systemProblem; 43 if (!connect_to_sqldb(response,err,logout)) { 104 44 return; 105 45 } … … 201 141 } 202 142 203 sql_db_ptr->closedatabase(); // Important that local library doesn't leave any files open 143 disconnect_from_sqldb(); 144 204 145 } -
main/trunk/greenstone2/runtime-src/src/colservr/sqlbrowsefilter.h
r15757 r22050 3 3 * sqlbrowsefilter.h -- 4 4 * Copyright (C) 2008 DL Consulting Ltd 5 * Copyright (C) 2010 New Zealand Digital Library Project 5 6 * 6 7 * A component of the Greenstone digital library software … … 27 28 #define SQLBROWSEFILTER_H 28 29 29 30 #include "filter.h" 31 #include "comtypes.h" 32 #include "sqldbclass.h" 33 #include "text_t.h" 30 #include "sqlfilter.h" 34 31 35 32 36 class sqlbrowsefilterclass : public filterclass { 37 protected: 38 text_t sql_db_filename; 39 text_t indexstem; 40 sqldbclass *sql_db_ptr; 41 42 public: 33 class sqlbrowsefilterclass : public sqlfilterclass 34 { 35 public: 43 36 sqlbrowsefilterclass (); 44 37 virtual ~sqlbrowsefilterclass (); 45 38 46 39 text_t get_filter_name () { return "SQLBrowseFilter"; } 47 48 // configure should be called once for each configuration line 49 // default configures the default filter options 50 virtual void configure (const text_t &key, const text_tarray &cfgline); 51 52 // the sql db ptr remains the responsibility of the calling code and 53 // should be destroyed after this sqlbrowsefilter is destroyed 54 void set_sql_db_ptr (sqldbclass *sql_db_ptr_arg) { sql_db_ptr = sql_db_ptr_arg; } 55 56 bool init (ostream &logout); 40 57 41 void filter (const FilterRequest_t &request, 58 42 FilterResponse_t &response,
Note:
See TracChangeset
for help on using the changeset viewer.