[8182] | 1 | #include "identityaction.h"
|
---|
| 2 | #include "recptconfig.h"
|
---|
| 3 |
|
---|
| 4 | bool identityaction::validateAction(recptproto *protocol, oaiargs ¶ms)
|
---|
| 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 |
|
---|
| 17 | bool identityaction::output_content(ostream &output, recptproto *protocol, oaiargs ¶ms)
|
---|
| 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 |
|
---|
[14283] | 28 | //site_cfg_read(gsdlhome, httpdomain, httpprefix);
|
---|
| 29 | text_t baseURL = this->configuration->getCollectionConfig("", "baseURL");
|
---|
[8182] | 30 |
|
---|
| 31 | output << " <repositoryName>" << repositoryName << "</repositoryName>" << endl;
|
---|
[14283] | 32 | output << " <baseURL>" << baseURL << "</baseURL>" << endl; // Tack on the app name
|
---|
[8182] | 33 | output << " <adminEmail>" << maintainer << "</adminEmail>" << endl;
|
---|
| 34 | output << " <protocolVersion>" << version << "</protocolVersion>" << 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;
|
---|
[9608] | 51 | ++here;
|
---|
[8182] | 52 | }
|
---|
| 53 |
|
---|
| 54 | return true;
|
---|
| 55 | }
|
---|
| 56 |
|
---|