Ignore:
Timestamp:
1999-04-12T17:21:52+12:00 (25 years ago)
Author:
rjmcnab
Message:

Started on a mg and gdbm source.

Location:
trunk/gsdl/src/colservr
Files:
2 edited

Legend:

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

    r234 r236  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/04/12 05:21:51  rjmcnab
     15   Started on a mg and gdbm source.
     16
    1417   Revision 1.1  1999/04/12 03:40:40  rjmcnab
    1518   Initial revision.
     
    2023#include "mggdbmsource.h"
    2124
     25
     26
     27
     28mggdbmsourceclass::mggdbmsourceclass () {
     29  gdbmptr = NULL;
     30  mgsearchptr = NULL;
     31}
     32
     33mggdbmsourceclass::~mggdbmsourceclass () {
     34}
     35
     36void mggdbmsourceclass::configure (const text_t &key, const text_tarray &cfgline) {
     37  if (cfgline.size() >= 1) {
     38    const text_t &value = cfgline[0];
     39
     40    if (key == "collection") collection = value;
     41    else if (key == "collectdir") collectdir = value;
     42    else if (key == "gsdlhome") gsdlhome = value;
     43  }
     44}
     45
     46bool mggdbmsourceclass::init (ostream &logout) {
     47  outconvertclass text_t2ascii;
     48 
     49  if (!sourceclass::init (logout)) return false;
     50 
     51  // get the collection directory name
     52  if (collectdir.empty()) {
     53    collectdir = filename_cat (gsdlhome, "collect", collection);
     54  }
     55 
     56  // get the filename for the database and make sure it exists
     57  gdbm_filename = filename_cat(collectdir,"index","text",collection);
     58#ifdef _LITTLE_ENDIAN
     59  gdbm_filename += ".ldb";
     60#else
     61  gdbm_filename += ".bdb";
     62#endif
     63  if (!file_exists(gdbm_filename)) {
     64    logout << text_t2ascii
     65       << "error: gdbm database \""
     66       << gdbm_filename << "\" does not exist\n\n";
     67    return false;
     68  }
     69 
     70  return true;
     71}
     72
     73bool mggdbmsourceclass::get_metadata (const text_t &requestParams, const text_t &refParams,
     74                      const text_tarray &fields, const text_t &OID,
     75                      MetadataInfo_tarray &metadata,
     76                      comerror_t &err, ostream &logout) {
     77  metadata.erase(metadata.begin(), metadata.end());
     78
     79  err = noError;
     80  return false;
     81}
  • trunk/gsdl/src/colservr/mggdbmsource.h

    r234 r236  
    1414#define MGGDBMSOURCE_H
    1515
     16#include "gsdlconf.h"
     17#include "text_t.h"
     18#include "comtypes.h"
     19#include "infodbclass.h"
     20#include "maptools.h"
     21#include "mgsearch.h"
     22#include "source.h"
     23
     24
     25class mggdbmsourceclass : public sourceclass {
     26protected:
     27  text_t gsdlhome;
     28  text_t collection;
     29  text_t collectdir;
     30
     31  text_t gdbm_filename;
     32  gdbmclass *gdbmptr;
     33 
     34  mgsearchclass *mgsearchptr;
     35
     36public:
     37  mggdbmsourceclass ();
     38  virtual ~mggdbmsourceclass ();
     39
     40  // the gdbmptr remains the responsability of the calling code
     41  void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}
     42
     43  // the mgsearchptr remains the responsability of the calling code
     44  void set_mgsearchptr (mgsearchclass *themgsearchptr) {mgsearchptr=themgsearchptr;}
     45
     46  void configure (const text_t &key, const text_tarray &cfgline);
     47  bool init (ostream &logout);
     48  bool get_metadata (const text_t &requestParams, const text_t &refParams,
     49             const text_tarray &fields, const text_t &OID,
     50             MetadataInfo_tarray &metadata,
     51             comerror_t &err, ostream &logout);
     52};
    1653
    1754
Note: See TracChangeset for help on using the changeset viewer.