Ignore:
Timestamp:
2019-02-28T22:00:57+13:00 (5 years ago)
Author:
ak19
Message:

Second and final part of fixing up OAI stuff so that there's no lock on the index db by OAI servlet side when a collection is being rebuilt. The bug was that the OAI servlet side would still keep a filelock on the db (index col db and etc oai-inf db, to be precise) when a collection was deactivated before moving build to index during the activate.pl stage. That's because the OAIMessageRouter does not responde to (de)activate messages sent to the regular library servlet's MessageRouter. This commit: Getting servercontrol.pm of activate.pl to send a request to (de)activate a collection to the OAIMessageRouter was far more involved: although OAIMessageRouter inherits from MessageRouter, it did not recognise the (de)activate query params because it specifically only recognises OAI verbs like Identify and the special case of 'reset' sent to the OAIMessageRouter. So added in pathways for activate and deactivate to be recognised and processed. Now servercontrol.pm will send (de)activate requests to both the MessageRouter and the OAIMessageRouter. And there's further support for if a collection is not an OAICollection (not part of the list of collections maintained by OAIReceptionist). What I don't have working, is that the collection is still enumerated by ListSets of the OAI servlet whereas attempting to view records and identifiers of the deactivated set fails. This misbehaviour doesn't impact rebuilding with activate.pl since it both deactivates then activates a collection, so a collection is not meant to remain in the deactivated state. The fix may be more complicated than removing the collection from OAIReceptionist's list of sets, since the OAI side deals with supercollections etc when it first loads OAICollections. So any fix has to take that into account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/OAIServer.java

    r29311 r32830  
    140140        this.recept = new OAIReceptionist();
    141141
    142         // the receptionist uses a OAIMessageRouter or Communicator to send its requests to. We either create a OAIMessageRouter here for the designated site (if site_name set), or we create a Communicator for a remote site. The is given to teh Receptionist, and the servlet never talks to it again.directly.
     142        // the receptionist uses a OAIMessageRouter or Communicator to send its requests to. We either create a OAIMessageRouter here for the designated site (if site_name set), or we create a Communicator for a remote site. The is given to the Receptionist, and the servlet never talks to it again directly.
    143143        if (site_name != null)
    144144        {
     
    342342
    343343        if (query!=null && query.equals("reset")) {
    344           logger.error("reset was called*******************");
     344          logger.info("reset was called*******************");
    345345          out.println("<?xml version='1.0' encoding='UTF-8' ?>");
    346346          out.println(this.recept.process("<message><request reset='true'/></message>"));
     
    348348        }
    349349        String[] pairs = (query == null) ? null : query.split("&");//split into key/value pairs
     350       
     351        // besides "reset", the only other non-verb (non-OAI) requests allowed would be: (de)activate="collName"
     352        if(pairs.length == 1) {
     353            String command = pairs[0];
     354            int index = command.indexOf('=');
     355            if(index != -1) {
     356                String collName = command.substring(index+1);
     357                command = command.substring(0, index);
     358                if(command.equals(GSXML.SYSTEM_TYPE_ACTIVATE)) {
     359                    logger.info("activating OAI collection " + collName + " was called*******************");
     360                    out.println("<?xml version='1.0' encoding='UTF-8' ?>");
     361                    out.println(this.recept.process("<message><request " + GSXML.SYSTEM_TYPE_ACTIVATE+"='"+collName+"'/></message>"));
     362                    return;
     363                   
     364                } else if(command.equals(GSXML.SYSTEM_TYPE_DEACTIVATE)) {
     365                    logger.info("deactivating OAI collection " + collName + " was called*******************");
     366                    out.println("<?xml version='1.0' encoding='UTF-8' ?>");
     367                    out.println(this.recept.process("<message><request " + GSXML.SYSTEM_TYPE_DEACTIVATE+"='"+collName+"'/></message>"));
     368                    return;
     369                }
     370            }
     371            // any other format for activate/deactivate command in query is wrong, continue processing and fail with "badVerb" message:
     372        }
     373       
    350374       
    351375        String verb = getVerb(query);
Note: See TracChangeset for help on using the changeset viewer.