1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * gdbmsource.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef GDBMSOURCE_H
|
---|
28 | #define GDBMSOURCE_H
|
---|
29 |
|
---|
30 | #include "gsdlconf.h"
|
---|
31 | #include "text_t.h"
|
---|
32 | #include "comtypes.h"
|
---|
33 | #include "infodbclass.h"
|
---|
34 | #include "maptools.h"
|
---|
35 | #include "search.h"
|
---|
36 | #include "source.h"
|
---|
37 |
|
---|
38 |
|
---|
39 | class gdbmsourceclass : public sourceclass {
|
---|
40 | protected:
|
---|
41 | text_t gsdlhome;
|
---|
42 | text_t gdbmhome;
|
---|
43 | text_t collection;
|
---|
44 | text_t collectdir;
|
---|
45 |
|
---|
46 | // these maps are only needed to convert the default indexes
|
---|
47 | stringmap indexmap;
|
---|
48 | stringmap subcollectionmap;
|
---|
49 | stringmap languagemap;
|
---|
50 |
|
---|
51 | text_t defaultindex;
|
---|
52 | text_t defaultsubcollection;
|
---|
53 | text_t defaultlanguage;
|
---|
54 |
|
---|
55 | text_t indexstem;
|
---|
56 |
|
---|
57 | text_t parentOID;
|
---|
58 | infodbclass parentinfo;
|
---|
59 | text_tarray parentcontents;
|
---|
60 |
|
---|
61 | text_t gdbm_filename;
|
---|
62 | gdbmclass *gdbmptr;
|
---|
63 |
|
---|
64 | searchclass *textsearchptr;
|
---|
65 |
|
---|
66 | public:
|
---|
67 | gdbmsourceclass ();
|
---|
68 | virtual ~gdbmsourceclass ();
|
---|
69 |
|
---|
70 | // the gdbmptr remains the responsability of the calling code
|
---|
71 | void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}
|
---|
72 |
|
---|
73 | // the textsearchptr remains the responsability of the calling code
|
---|
74 | void set_textsearchptr (searchclass *thetextsearchptr) {textsearchptr=thetextsearchptr;}
|
---|
75 |
|
---|
76 | void configure (const text_t &key, const text_tarray &cfgline);
|
---|
77 | bool init (ostream &logout);
|
---|
78 | bool translate_OID (const text_t &OIDin, text_t &OIDout,
|
---|
79 | comerror_t &err, ostream &logout);
|
---|
80 | bool get_metadata (const text_t &requestParams, const text_t &refParams,
|
---|
81 | bool getParents, const text_tset &fields,
|
---|
82 | const text_t &OID, MetadataInfo_tmap &metadata,
|
---|
83 | comerror_t &err, ostream &logout);
|
---|
84 | bool get_document (const text_t &OID, text_t &doc,
|
---|
85 | comerror_t &err, ostream &logout);
|
---|
86 | bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout);
|
---|
87 |
|
---|
88 | protected:
|
---|
89 | text_t classname;
|
---|
90 |
|
---|
91 | };
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 | #endif
|
---|