Changeset 32870 for main

Show
Ignore:
Timestamp:
06.03.2019 17:41:15 (9 months ago)
Author:
ak19
Message:

1. set_set now renamed to set_oaiset after Dr Bainbridge suggested the variable name could be better. 2. Dr Bainbridge suggested informative comments around why ACTIVE and DEACTIVATED constants were Integers and not ints for anyone reading the code in future. 3. When (de)activating a collection, better to check that the collname is not in collection_name_list rather than checking against set_oaiset. This is because set_oaiset can contain values like 'lucene-jdbm-demo:cl1' which are not collection names but which are oaisets. 4. Corrected part of a display string.

Files:
1 modified

Legend:

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

    r32869 r32870  
    7272  */ 
    7373  protected Vector<Integer> collection_state_list = null; 
    74   /** Possible states for a collection */ 
     74  /** Possible states for a collection. 
     75    * NOTE: Being done with Integer instead of int because they're put into Vectors and they can only contain Objects not primitive data types. 
     76  */ 
    7577  protected static final Integer DEACTIVATED = new Integer(0); 
    7678  protected static final Integer ACTIVE = new Integer(1); 
     
    7981  protected boolean noRecordsMatch = false; 
    8082       
    81   /** A set of all known 'sets' */ 
    82   protected HashSet<String> set_set = null; 
     83  /** A set of all known 'sets' TODO: set_oaiset as name */ 
     84  protected HashSet<String> set_oaiset = null; 
    8385 
    8486  protected boolean has_super_colls = false; 
     
    185187  } 
    186188  private boolean configureSetInfo() { 
    187     this.set_set = new HashSet<String>(); 
     189    this.set_oaiset = new HashSet<String>(); 
    188190 
    189191    // First, we get a list of all the OAI enabled collections 
     
    278280          // not in there yet 
    279281          subcolls = new Vector<String>(); 
    280           this.set_set.add(set_spec); 
     282          this.set_oaiset.add(set_spec); 
    281283          this.super_coll_map.put(set_spec, subcolls); 
    282284          // the first time a supercoll is mentioned, add into the set list 
     
    290292      // add in the set 
    291293      listsets_element.appendChild(listsets_doc.importNode(set, true)); 
    292       this.set_set.add(set_spec); 
     294      this.set_oaiset.add(set_spec); 
    293295    } 
    294296      } // for each set in the collection 
     
    409411        String collname = request.getAttribute(GSXML.SYSTEM_TYPE_ACTIVATE); 
    410412        // don't bother activating if it's not an OAI collection 
    411         if (!this.set_set.contains(collname)) { 
     413        if (!this.collection_name_list.contains(collname)) { 
    412414            return OAIXML.createDeActivationOfNonOAICollResponse(OAIXML.ACTIVATION, collname); 
    413415        } 
     
    417419        String collname = request.getAttribute(GSXML.SYSTEM_TYPE_DEACTIVATE); 
    418420        // don't bother deactivating if it's not an OAI collection 
    419         if (!this.set_set.contains(collname)) { 
     421        if (!this.collection_name_list.contains(collname)) { 
    420422            return OAIXML.createDeActivationOfNonOAICollResponse(OAIXML.DEACTIVATION, collname); 
    421423        } 
     
    620622      if(set_requested == true) { 
    621623    set_spec_str = param_map.get(OAIXML.SET); 
    622     if (!this.set_set.contains(set_spec_str)) { 
     624    if (!this.set_oaiset.contains(set_spec_str)) { 
    623625      // the set is not one we know about 
    624626      logger.error("requested set is not found in this repository"); 
     
    692694            // 0 collections are active, but (the remaining one) would have been deactivated, not other reason 
    693695            String errorCode = (record_type.equals(OAIXML.RECORD)) ? OAIXML.NO_RECORDS_MATCH : OAIXML.ID_DOES_NOT_EXIST; // GetRecords vs GetIdentifiers request 
    694             return OAIXML.createErrorMessage(errorCode, "OAI collections temporarily active. Likely because of collection rebuilding. Check back shortly."); 
     696            return OAIXML.createErrorMessage(errorCode, "OAI collections temporarily inactive. Likely because of (a) collection rebuilding. Check back shortly."); 
    695697        } 
    696698    }