#include "identifyaction.h" bool identifyaction::validateAction(recptproto *protocol, oaiargs ¶ms) { // ---------------------------------------------------------------------------- // 1. Check for invalid arguments // ---------------------------------------------------------------------------- bool invalid_argument_supplied = false; text_tmap::const_iterator param_iterator = params.begin(); while (param_iterator != params.end()) { // Check for arguments that aren't valid for this action if (param_iterator->first != "verb") { // We've found an invalid argument invalid_argument_supplied = true; // Delete the invalid argument from the list so it doesn't end up in the tag that is returned params.erase(param_iterator->first); } param_iterator++; } // If we found an invalid argument it's an error, so don't go any further if (invalid_argument_supplied) { this->errorType = "badArgument"; return false; } // ---------------------------------------------------------------------------- // 2. Handle any exclusive arguments // ---------------------------------------------------------------------------- // None! // ---------------------------------------------------------------------------- // 3. Handle any required arguments // ---------------------------------------------------------------------------- // None! // ---------------------------------------------------------------------------- // 4. Check any remaining arguments // ---------------------------------------------------------------------------- // None! // If we've reached here everything must be fine this->errorType = ""; return true; } bool identifyaction::output_content(ostream &output, recptproto *protocol, oaiargs ¶ms) { utf8outconvertclass utf8convert; // Get the repository name (some human-readable name for the site, or superset of collections) text_t repositoryName = this->configuration->getRepositoryName(); text_t repositoryId = this->configuration->getRepositoryId(); // Get admin's email address (i.e. the site maintainer) text_t maintainer = this->configuration->getMaintainer(); text_t version = (this->configuration->getOAIVersion() <= 110) ? (text_t)"1.1":(text_t)"2.0"; text_t id_version = this->configuration->getRepositoryIdVersion(); text_t baseURL = this->configuration->getBaseURL(); output << utf8convert << " " << repositoryName << "\n"; output << utf8convert << " " << baseURL << "\n"; output << utf8convert << " " << version << "\n"; output << utf8convert << " " << maintainer << "\n"; 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 << utf8convert << " 1970-01-01\n"; output << utf8convert << " no\n"; output << utf8convert << " YYYY-MM-DD\n"; } // list the oai identifier output << " \n"; if (id_version == "1.1") { output << " \n"; } else { output << " \n"; } output << " oai\n"; output << " "<< repositoryId <<"\n"; output << " :\n"; output << " oai:"<\n"; output << " \n"; // list all configuration information text_tmap::iterator here = this->configuration->getInformation()->begin(); text_tmap::iterator end = this->configuration->getInformation()->end(); if (here != end) { output << " \n"; while (here != end) { output << utf8convert << " first << "\">" << here->second << "\n"; ++here; } output << " \n"; } output << utf8convert << " \n"; return true; }