source: gsdl/trunk/src/oaiservr/identityaction.cpp@ 15193

Last change on this file since 15193 was 15193, checked in by mdewsnip, 16 years ago

Moved the "protocolVersion" field above the "adminEmail" field, so this validates with the OAI validator. By DL Consulting Ltd.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#include "identityaction.h"
2#include "recptconfig.h"
3
4bool identityaction::validateAction(recptproto *protocol, oaiargs &params)
5{
6 //"Verb=Identify" should be the only parameter - if there are others, throw an error.
7 // Don't need to check that the param we have is "Verb=Identify", as it has to be to get to here.
8
9 if(params.getSize() != 1){
10 this->errorType = "badArgument";
11 return false;
12 }
13
14 return true;
15}
16
17bool identityaction::output_content(ostream &output, recptproto *protocol, oaiargs &params)
18{
19 text_t gsdlhome, httpdomain, httpprefix;
20
21 // Get the repository name (some human-readable name for the site, or superset of collections)
22 text_t repositoryName = this->configuration->getCollectionConfig("", "repositoryName");
23 // Get admin's email address (i.e. the site maintainer)
24 text_t maintainer = this->configuration->getCollectionConfig("", "maintainer");
25 // Get baseURL by extracting httpdomain from the gsdlsite.cfg file
26 text_t version = (this->configuration->getOAIVersion() <= 110) ? (text_t)"1.1":(text_t)"2.0";
27
28 //site_cfg_read(gsdlhome, httpdomain, httpprefix);
29 text_t baseURL = this->configuration->getCollectionConfig("", "baseURL");
30
31 output << " <repositoryName>" << repositoryName << "</repositoryName>" << endl;
32 output << " <baseURL>" << baseURL << "</baseURL>" << endl; // Tack on the app name
33 output << " <protocolVersion>" << version << "</protocolVersion>" << endl;
34 output << " <adminEmail>" << maintainer << "</adminEmail>" << endl;
35
36 if(version == "2.0"){
37 // earliestDatestamp *should* be the YYYY-MM-DD format of the oldest lastmodified record in the
38 // repository, but we're just setting it to be the default oldest possible date - ugly, but judged
39 // not to be worth the effort of trolling through all the lastmodified dates (by others with more
40 // say than me)
41 output << " <earliestDatestamp>1970-01-01</earliestDatestamp>\n"
42 << " <deletedRecord>no</deletedRecord>\n"
43 << " <granularity>YYYY-MM-DD</granularity>\n";
44 }
45 // list all configuration information
46 text_tmap::iterator here = this->configuration->getInformation()->begin();
47 text_tmap::iterator end = this->configuration->getInformation()->end();
48 while (here != end) {
49 output << " <" << here->first << ">" << here->second;
50 output << " </" << here->first << ">" << endl;
51 ++here;
52 }
53
54 return true;
55}
56
Note: See TracBrowser for help on using the repository browser.