[22739] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * oaiconfig.h --
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 2004-2010 The New Zealand Digital Library Project
|
---|
| 6 | *
|
---|
| 7 | * A component of the Greenstone digital library software
|
---|
| 8 | * from the New Zealand Digital Library Project at the
|
---|
| 9 | * University of Waikato, New Zealand.
|
---|
| 10 | *
|
---|
| 11 | * This program is free software; you can redistribute it and/or modify
|
---|
| 12 | * it under the terms of the GNU General Public License as published by
|
---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | * (at your option) any later version.
|
---|
| 15 | *
|
---|
| 16 | * This program is distributed in the hope that it will be useful,
|
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | * GNU General Public License for more details.
|
---|
| 20 | *
|
---|
| 21 | * You should have received a copy of the GNU General Public License
|
---|
| 22 | * along with this program; if not, write to the Free Software
|
---|
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 24 | *
|
---|
| 25 | *********************************************************************/
|
---|
| 26 |
|
---|
[8182] | 27 | #ifndef _OAICONFIG_H_
|
---|
| 28 | #define _OAICONFIG_H_
|
---|
| 29 |
|
---|
| 30 | #include "cnfgable.h"
|
---|
| 31 |
|
---|
| 32 | #include <map>
|
---|
| 33 |
|
---|
| 34 | class oaicollectconfig {
|
---|
| 35 | public:
|
---|
| 36 | oaicollectconfig(const text_t &collectname) { this->collection = collectname; }
|
---|
| 37 | text_t collection;
|
---|
[22212] | 38 | text_t setName; // A display name for the set (collection)
|
---|
| 39 | text_t setDescription; // A display description for the set (collection)
|
---|
[8182] | 40 | text_tmap fieldMap; // maps from OAI name to GSDL name
|
---|
[27528] | 41 | text_tarray superCollectList; // a list of all super collections this belongs to
|
---|
[8182] | 42 | };
|
---|
| 43 |
|
---|
| 44 | typedef map<text_t, oaicollectconfig *, lttext_t> oaicollectmap;
|
---|
| 45 |
|
---|
[27528] | 46 | class oaisupercollectconfig {
|
---|
| 47 | public:
|
---|
| 48 | oaisupercollectconfig(const text_t &supercollectionname) { this->supercollection = supercollectionname; }
|
---|
| 49 | text_t supercollection;
|
---|
| 50 | text_t setName; // A display name for the set (supercollection)
|
---|
| 51 | text_t setDescription; // A display description for the set (supercollection)
|
---|
| 52 | text_tarray collectionList; // a list of collections contained in this super collection
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | typedef map<text_t, oaisupercollectconfig *, lttext_t> oaisupercollectmap;
|
---|
| 56 |
|
---|
| 57 |
|
---|
[8182] | 58 | class oaiconfig : configurable {
|
---|
| 59 | public:
|
---|
| 60 | oaiconfig();
|
---|
| 61 | oaiconfig(text_t &gsdlhome, text_t &gsdlcollect);
|
---|
[21455] | 62 | virtual ~oaiconfig();
|
---|
[8303] | 63 | virtual void configure(const text_t &key, const text_tarray &cfgline);
|
---|
| 64 | text_tarray & getCollectionsList() { return this->collectList; }
|
---|
[27534] | 65 | // get a list of all collections - those part of a super coll and those individual ones
|
---|
| 66 | text_tarray & getAllCollectionsList() {return this->allCollectList; }
|
---|
[27528] | 67 | text_tarray & getSuperCollectionsList() { return this->superCollectList; }
|
---|
[27534] | 68 | // get the list of collections for this super coll
|
---|
[27528] | 69 | text_tarray & getSuperCollectionCollections(const text_t super_coll) {
|
---|
| 70 | return this->superCollectMap[super_coll]->collectionList;
|
---|
| 71 | }
|
---|
[27534] | 72 | // is this collection valid
|
---|
| 73 | bool isValidCollection(const text_t &collection);
|
---|
| 74 | // what super collections is this collection part of?
|
---|
[27528] | 75 | text_tarray getSuperCollectionsForThisCollection(const text_t &collection);
|
---|
[18891] | 76 | text_tset & getMetadataSet() { return this->metadataSet; }
|
---|
[8303] | 77 | text_t getMapping(const text_t &collection, const text_t &collectfield);
|
---|
| 78 | text_t getMapping(const text_t &collection, const text_t &collectfield, const text_t &format);
|
---|
| 79 | text_tmap * getInformation() { return &this->infoMap; }
|
---|
[20629] | 80 | text_t getSetName(const text_t &setSpec);
|
---|
| 81 | text_t getSetDescription(const text_t &setSpec);
|
---|
[22212] | 82 | int getOAIVersion();
|
---|
| 83 | int resumeAfter();
|
---|
| 84 | text_t getBaseURL();
|
---|
| 85 | text_t getBaseLibraryURL();
|
---|
| 86 | text_t getBaseDocRoot();
|
---|
[23233] | 87 | text_t getRelativeBaseDocRoot();
|
---|
[22212] | 88 | text_t getRepositoryName();
|
---|
[22284] | 89 | text_t getRepositoryId();
|
---|
| 90 | text_t getRepositoryIdVersion();
|
---|
[22212] | 91 | text_t getMaintainer();
|
---|
[8182] | 92 | private:
|
---|
[18903] | 93 | bool configureCollection(const text_t &gsdlhome, const text_t &collection);
|
---|
[27534] | 94 | void addToAllCollectionsList(const text_t coll_name);
|
---|
[23233] | 95 | text_t generateBaseServerURL();
|
---|
[22284] | 96 | text_t repositoryName; // human readable name
|
---|
| 97 | text_t repositoryId; // unique (among oai servers) domain name or id for the repository
|
---|
| 98 | text_t repositoryIdVersion; // 1.1 or 2.0 for identifier scheme
|
---|
[23233] | 99 | text_t baseServerURL; // URL of web server
|
---|
| 100 | text_t oaiserverPath; // relative path for oaiserver
|
---|
| 101 | text_t libraryPath; //relative path for library.cgi (used for urls to greenstone documents )
|
---|
| 102 | text_t docRootPath; // relative path for gsdl directory (used for urls to source documents and oai xsl )
|
---|
[22212] | 103 | text_t oaiVersion; // The version of OAI running
|
---|
| 104 | int resumptionSize; // The number of items to produce before spitting out a resumptionToken
|
---|
| 105 | text_t maintainer;
|
---|
| 106 |
|
---|
[8303] | 107 | text_tarray collectList; // The list of collections to be taken in hand
|
---|
[18891] | 108 | text_tset metadataSet; // The list of metadata sets to be supported
|
---|
[8182] | 109 | text_tmap infoMap; // Holds the information to be given in the case
|
---|
| 110 | // of an OAI identify request
|
---|
| 111 | oaicollectmap collectMap; // The configuration of collections
|
---|
| 112 | text_t collection; // Used to track which collection is being configured
|
---|
[27528] | 113 | text_tarray superCollectList; //a list of super collections. may be empty
|
---|
| 114 | oaisupercollectmap superCollectMap; // The configuration of the super collections
|
---|
[27534] | 115 | text_tarray allCollectList; //a list of all collections, includes those in collectList and those that are part of a super collection and not in collectList
|
---|
[8182] | 116 | };
|
---|
| 117 | #endif
|
---|
[22286] | 118 |
|
---|
| 119 |
|
---|