source: main/trunk/greenstone2/runtime-src/src/oaiservr/rfc1807.cpp@ 24411

Last change on this file since 24411 was 22739, checked in by mdewsnip, 14 years ago

Added copyright header to runtime-src/src/oaiserver/*.cpp and runtime-src/src/oaiserver/*.h.

  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/**********************************************************************
2 *
3 * rfc1807.cpp --
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
27#include "rfc1807.h"
28
29rfc1807::rfc1807() : metaformat(){
30 // These element names taken from the schema
31 // http://www.openarchives.org/OAI/1.1/rfc1807.xsd
32 elementSet.insert("bib-version");
33 elementSet.insert("id");
34 elementSet.insert("entry");
35 elementSet.insert("organization");
36 elementSet.insert("title");
37 elementSet.insert("type");
38 elementSet.insert("revision");
39 elementSet.insert("withdraw");
40 elementSet.insert("author");
41 elementSet.insert("corp-author");
42 elementSet.insert("contact");
43 elementSet.insert("date");
44 elementSet.insert("pages");
45 elementSet.insert("copyright");
46 elementSet.insert("handle");
47 elementSet.insert("other_access");
48 elementSet.insert("retrieval");
49 elementSet.insert("keyword");
50 elementSet.insert("cr-category");
51 elementSet.insert("period");
52 elementSet.insert("series");
53 elementSet.insert("monitoring");
54 elementSet.insert("funding");
55 elementSet.insert("contract");
56 elementSet.insert("grant");
57 elementSet.insert("language");
58 elementSet.insert("notes");
59 elementSet.insert("abstract");
60
61};
62
63const text_t rfc1807::formatName()
64{
65 return "rfc1807";
66}
67
68const text_t rfc1807::formatPrefix() {
69 return "rfc1807";
70}
71
72bool rfc1807::output_record(ostream &output, recptproto *protocol, const text_t &collection,
73 const text_t &record_OID)
74{
75 return metaformat::output_record(output, protocol, collection, record_OID);
76}
77
78void rfc1807::output_metadata_header(ostream &output)
79{
80 output << "<metadata>\n";
81
82 if(this->oaiConfigure->getOAIVersion() <= 110){
83 // output rfc1807 wrapper for OAI v1.1
84 output << "<rfc1807 xmlns=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\"" << endl;
85 output << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"" << endl;
86 output << " xsi:schemaLocation=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"
87 << endl;
88 output << " http://www.openarchives.org/OAI/1.1/rfc1807.xsd\">" << endl;
89 }
90 else {
91 // TODO: output rfc1807 wrapper for OAI v2.0
92 output << "<rfc1807 xmlns=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\"" << endl;
93 output << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"" << endl;
94 output << " xsi:schemaLocation=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt"
95 << endl;
96 output << " http://www.openarchives.org/OAI/1.1/rfc1807.xsd\">" << endl;
97 }
98}
99
100void rfc1807::output_metadata_footer(ostream &output)
101{
102 // end rfc1807 wrapper
103 output << "</rfc1807>" << endl;
104
105 output << "</metadata>\n";
106}
107
108bool rfc1807::output_formatdata(ostream &output)
109{
110 // Both versions of the protocol use the same schema (yes?)
111 output << " <metadataPrefix>rfc1807</metadataPrefix>" << endl;
112 output << " <schema>http://www.openarchives.org/OAI/1.1/rfc1807.xsd</schema>" << endl;
113 // Correct namespace for rfc1807 according to OAI documentation, even though this link seems to be broken
114 output << " <metadataNamespace>http://info.internet.isi.edu/in-notes/rfc/files/rfc1807.txt</metadataNamespace>" << endl;
115
116 return true;
117}
118
119
Note: See TracBrowser for help on using the repository browser.