#include "identityaction.h"
#include "recptconfig.h"
bool identityaction::validateAction(recptproto *protocol, oaiargs ¶ms)
{
//"Verb=Identify" should be the only parameter - if there are others, throw an error.
// Don't need to check that the param we have is "Verb=Identify", as it has to be to get to here.
if(params.getSize() != 1){
this->errorType = "badArgument";
return false;
}
return true;
}
bool identityaction::output_content(ostream &output, recptproto *protocol, oaiargs ¶ms)
{
text_t gsdlhome, httpdomain, httpprefix;
// Get the repository name (some human-readable name for the site, or superset of collections)
text_t repositoryName = this->configuration->getCollectionConfig("", "repositoryName");
// Get admin's email address (i.e. the site maintainer)
text_t maintainer = this->configuration->getCollectionConfig("", "maintainer");
// Get baseURL by extracting httpdomain from the gsdlsite.cfg file
text_t version = (this->configuration->getOAIVersion() <= 110) ? (text_t)"1.1":(text_t)"2.0";
//site_cfg_read(gsdlhome, httpdomain, httpprefix);
text_t baseURL = this->configuration->getCollectionConfig("", "baseURL");
output << " " << repositoryName << "" << endl;
output << " " << baseURL << "" << endl; // Tack on the app name
output << " " << maintainer << "" << endl;
output << " " << version << "" << endl;
if(version == "2.0"){
// earliestDatestamp *should* be the YYYY-MM-DD format of the oldest lastmodified record in the
// repository, but we're just setting it to be the default oldest possible date - ugly, but judged
// not to be worth the effort of trolling through all the lastmodified dates (by others with more
// say than me)
output << " 1970-01-01\n"
<< " no\n"
<< " YYYY-MM-DD\n";
}
// list all configuration information
text_tmap::iterator here = this->configuration->getInformation()->begin();
text_tmap::iterator end = this->configuration->getInformation()->end();
while (here != end) {
output << " <" << here->first << ">" << here->second;
output << " " << here->first << ">" << endl;
++here;
}
return true;
}