#include "identityaction.h"
bool identityaction::validateAction(recptproto *protocol, oaiargs ¶ms)
{
int params_size = params.getSize();
// Remove any parameters that aren't valid for this action
text_tmap::const_iterator param_iterator = params.begin();
while (param_iterator != params.end())
{
if (param_iterator->first != "verb")
{
params.erase(param_iterator->first);
}
param_iterator++;
}
//"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_size != 1){
this->errorType = "badArgument";
return false;
}
return true;
}
bool identityaction::output_content(ostream &output, recptproto *protocol, oaiargs ¶ms)
{
// 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");
text_t version = (this->configuration->getOAIVersion() <= 110) ? (text_t)"1.1":(text_t)"2.0";
text_t baseURL = this->configuration->getCollectionConfig("", "baseURL");
output << " " << repositoryName << "" << endl;
output << " " << baseURL << "" << endl; // Tack on the app name
output << " " << version << "" << endl;
output << " " << maintainer << "" << 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;
}