source: gsdl/trunk/src/colservr/source.cpp@ 15580

Last change on this file since 15580 was 4774, checked in by sjboddie, 21 years ago

No longer show search page (or search form on "about" page) if a collection
doesn't have at least one searchable index. Note that this change includes
the addition of an is_searchable() function to the protocol.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/**********************************************************************
2 *
3 * source.cpp --
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#include "source.h"
27#include <assert.h>
28
29
30// default constructor does nothing
31sourceclass::sourceclass () {
32}
33
34// default destructor does nothing
35sourceclass::~sourceclass () {
36}
37
38// configure should be called once for each configuration line
39// default does nothing
40void sourceclass::configure (const text_t &/*key*/, const text_tarray &/*cfgline*/) {
41}
42
43// init should be called after all the configuration is done but
44// before any other methods are called
45// default does nothing
46bool sourceclass::init (ostream &/*logout*/) {
47 return true;
48}
49
50
51// translate_OID translates OIDs using ".pr", ."fc" etc.
52bool sourceclass::translate_OID (const text_t &/*OIDin*/, text_t &/*OIDout*/,
53 comerror_t &err, ostream &/*logout*/) {
54 err = noError;
55
56 return false;
57}
58
59
60// get_metadata fills out the metadata if possible, if it is not responsable
61// for the given OID then it will return false.
62bool sourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
63 bool /*getParents*/, const text_tset &/*fields*/,
64 const text_t &/*OID*/, MetadataInfo_tmap &metadata,
65 comerror_t &err, ostream &/*logout*/) {
66 metadata.erase(metadata.begin(), metadata.end());
67 err = noError;
68
69 return false;
70}
71
72bool sourceclass::get_document (const text_t &/*OID*/, text_t &/*doc*/,
73 comerror_t &err, ostream &/*logout*/) {
74 err = noError;
75
76 return false;
77}
78
79bool sourceclass::is_searchable(bool &issearchable, comerror_t &err, ostream &logout) {
80
81 // currently defaults to claiming the collection is searchable!!
82 issearchable = true;
83
84 err = noError;
85
86 return false;
87}
88
89bool operator==(const sourceptr &x, const sourceptr &y) {
90 return (x.s == y.s);
91}
92
93bool operator<(const sourceptr &x, const sourceptr &y) {
94 return (x.s < y.s);
95}
96
97
98// thesource remains the property of the calling code but
99// should not be deleted until it is removed from this list.
100void sourcelistclass::addsource (sourceclass *thesource) {
101 // can't add a source that doesn't exist
102 assert (thesource != NULL);
103 if (thesource == NULL) return;
104
105 sourceptr sp;
106 sp.s = thesource;
107
108 sourceptrs.push_back(sp);
109}
Note: See TracBrowser for help on using the repository browser.