source: gsdl/trunk/runtime-src/src/oaiservr/metaformat.h@ 18895

Last change on this file since 18895 was 18895, checked in by kjdon, 15 years ago

added is_valid_element to metaformat, which checks elementSet for the element name. metaformat subclass constructors must set up elementSet. Currently they do this in the code. would be good if it could read in from a file eventually, maybe?? When metaformat is outputting the m,etadata, it checks whether the element is valid before outputting. otherwise it will invalidate the response as it won't conform to the schema. also, changed where we lowercased the entire name to lowercasing only the first letter - some qdc fields have an internal upper case letter.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/**
2 * A framework class for metadata formats.
3 *
4 * Example child classes include oaimeta and rfc8507meta
5 */
6
7#ifndef _METAFORMAT_H_
8#define _METAFORMAT_H_
9#include <stdio.h>
10
11#include "text_t.h"
12#include "comtypes.h"
13#include "recptproto.h"
14
15#include "oaiconfig.h"
16
17class metaformat
18{
19 protected:
20 virtual void output_metadata_header(ostream &output) = 0;
21 virtual void output_item(ostream &output, outconvertclass &outconvert,
22 bool &headerDone, const text_t &label,
23 const text_tarray &values);
24 virtual void output_metadata_footer(ostream &output) = 0;
25 virtual bool is_valid_element(text_t &meta_name);
26 virtual bool scan_metadata(ostream &output, const text_t &collection,
27 ResultDocInfo_t &docInfo, bool doOutput);
28 oaiconfig * oaiConfigure;
29
30 // a set containing all the valid element names for the set. Must be
31 // initialized by each metadata class
32 text_tset elementSet;
33
34 public:
35 metaformat(); // Must be given the desired oai version when created
36 virtual const text_t formatName() = 0;
37 virtual const text_t formatPrefix() = 0;
38 virtual bool output_record(ostream &output, recptproto *protocol,
39 const text_t &collection,
40 const text_t &record_OID);
41 virtual bool is_available(const text_t &collection, ResultDocInfo_t &docInfo);
42 virtual bool output_metadata(ostream &output, const text_t &collection,
43 ResultDocInfo_t &docInfo);
44 virtual bool output_formatdata(ostream &output) = 0;
45 void set_configuration(oaiconfig *config) { this->oaiConfigure = config; }
46 text_t get_mapping(const text_t &collection, const text_t &collectionField);
47 virtual ~metaformat() { this->oaiConfigure = NULL; }
48};
49
50class metaformatptr
51{
52 public:
53 metaformat *ptr;
54
55 metaformatptr() { this->ptr = NULL; }
56 metaformat *get_class() { return this->ptr; }
57 void set_class(metaformat *ptr) { this->ptr = ptr; }
58 void set_configuration(oaiconfig *config) { this->ptr->set_configuration(config);}
59 void clear() { delete this->ptr; this->ptr = NULL; }
60};
61
62typedef map<text_t, metaformatptr, lttext_t> metaformat_map;
63
64#endif
Note: See TracBrowser for help on using the repository browser.