Changeset 24108

Show
Ignore:
Timestamp:
01.06.2011 16:19:14 (8 years ago)
Author:
ak19
Message:

Preliminary changes that were needed to get the GS2 OAIserver validated again: 1. IDs were OAI-IDs that needed their OAI prefixes removed before we can do a look up in Greenstone for those IDs; 2. lastmodified date was never retrieved since gs.oaidatestamp was retrieved even when this was empty, and so retrieval of date ranges were failing. (To get their OAI server validated, users need to change etc\oai.cfg to set repositoryId and optionally repositoryName, and provide emails for the creator and maintainer fields in the collect.cfg files of those of their collections to be visible over OAI, and use the GSI app to allow external connections to get it validated.) With the current commit, GS2's OAIserver validates successfully against the official online validator, when the validator is given the full URL (containing full domain) to a running GS server's oaiserver.cgi page. In the next commits, will be using oailastmodified(date) and working out the earliestOAIDateStamp as GS3 has been made to do this now.

Location:
main/trunk/greenstone2/runtime-src/src/oaiservr
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/metaformatsaction.cpp

    r22739 r24108  
    8080  { 
    8181    text_t identifier = params["identifier"]; 
     82     
     83    text_t oai_OID_prefix = "oai:"+this->configuration->getRepositoryId()+":"; 
     84    if(identifier.replace(oai_OID_prefix, "") <= 0) { 
     85        this->errorType = "idDoesNotExist"; 
     86        // Only throw an error if we're using v2.0.  
     87        if (this->configuration->getOAIVersion() >= 200) { 
     88            return false; 
     89        } 
     90    } 
    8291 
    8392    // Extract the collection name from the identifier specification 
     
    8695   
    8796    // Check a document with the specified identifier exists 
    88     text_tset metadata; 
     97    text_tset metadata;  
     98     
    8999    if (!get_info(identifier, collection, "", metadata, false, protocol, this->gsdlResponse, *logout)) 
    90100    { 
  • main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp

    r23234 r24108  
    442442      // assume it is correct format 
    443443      lastModified = current->second.values[0]; 
    444       return; 
     444      if(lastModified != "") { 
     445            return; 
     446      } 
    445447    } 
    446448    else{  
  • main/trunk/greenstone2/runtime-src/src/oaiservr/recordaction.cpp

    r22739 r24108  
    132132  } 
    133133 
     134    // before checking the specified identifier exists, need to extract the greenstone OID from it 
     135    text_t oai_OID_prefix = "oai:"+this->configuration->getRepositoryId()+":"; 
     136    if(identifier.replace(oai_OID_prefix, "") <= 0) { 
     137        this->errorType = "idDoesNotExist"; 
     138        // Only throw an error if we're using v2.0.  
     139        if (this->configuration->getOAIVersion() >= 200) { 
     140            return false; 
     141        } 
     142    } 
     143   
    134144  // Extract the collection name from the identifier specification 
    135145  text_t collection = ""; 
     
    165175  text_t gsdlCollect; 
    166176 
     177  /* 
     178    text_t oai_coll_OID_prefix = "oai:"+this->configuration->getRepositoryId()+":"+collection+":";   
     179    if(gsdlId.replace(oai_coll_OID_prefix, "") <= 0) { 
     180        this->errorType = "idDoesNotExist"; 
     181        // Only throw an error if we're using v2.0.  
     182        if (this->configuration->getOAIVersion() >= 200) { 
     183            return false; 
     184        } 
     185    } 
     186  */ 
     187   
    167188  // convert record identifier into GSDL format from OAI 
    168189  oaiclassifier::toGSDL(gsdlCollect, gsdlId); 
     
    181202  text_tset        metadata; 
    182203  ofstream         logout("oai.log", ios::app); 
    183  
     204   
    184205  // get the document information 
    185206  if (!get_info(OID, collection, "", metadata, false, protocol, this->gsdlResponse, logout)) {