Ignore:
Timestamp:
2009-12-09T15:28:39+13:00 (14 years ago)
Author:
kjdon
Message:

a little bit of code rearranging and editing so that we can have a serviceRackList in collectionConfig.xml (as well as buildConfig.xml) - may want to manually specify one and not have to edit the file each time after a rebuild

File:
1 edited

Legend:

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

    r18664 r21312  
    6161     *  the OAIPMH serviceRack
    6262     */
    63     protected Element service_rack_list = null;
     63    //protected Element service_rack_list = null;
    6464   
    6565    protected XMLTransformer transformer = null;
     
    108108    findAndLoadInfo(coll_config_xml, build_config_xml);
    109109   
    110     // now do the services 
    111     Element service_list = (Element)GSXML.getChildByTagName(build_config_xml, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
    112     configureServiceRack(service_list, coll_config_xml);
    113 
    114     this.service_rack_list = service_list;
    115  
     110    // now do the services
     111    configureServiceRacks(coll_config_xml, build_config_xml);
     112
    116113    return true;
    117114   
     
    133130     */
    134131    public boolean hasOAI() {
    135       if (service_rack_list == null) return false; 
    136       Element oai_service_rack = GSXML.getNamedElement(service_rack_list, GSXML.SERVICE_CLASS_ELEM,
    137                             OAIXML.NAME, OAIXML.OAIPMH);
    138       if (oai_service_rack == null) {
    139         logger.info("No oai for collection: " + this.cluster_name);
    140         return false;
    141       }
    142       return true;//oai_service_rack == null;
     132      return has_oai;
    143133    }
    144134    /**
     
    179169    }
    180170 
    181   lastmodified = build_config_file.lastModified();
     171    lastmodified = build_config_file.lastModified();
    182172 
    183173    return build_config_elem;
     
    244234    }
    245235
    246     protected boolean resolveMacros(Element display_list) {
     236  protected boolean configureServiceRacks(Element coll_config_xml,
     237                      Element build_config_xml){
     238    clearServices();
     239    Element service_list = (Element)GSXML.getChildByTagName(build_config_xml, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
     240    configureServiceRack(service_list, coll_config_xml);
     241   
     242    // Check for oai
     243    Element oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, OAIXML.NAME, OAIXML.OAIPMH);
     244    if (oai_service_rack == null) {
     245      has_oai = false;
     246      logger.info("No oai for collection: " + this.cluster_name);
     247     
     248    } else {
     249      has_oai = true;
     250    }
     251   
     252    // collection Config may also contain manually added service racks
     253    service_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
     254    if (service_list != null) {
     255      configureServiceRack(service_list, coll_config_xml);
     256    }
     257    return true;
     258  }
     259 
     260  protected boolean resolveMacros(Element display_list) {
    247261    if (display_list==null) return false;
    248262    NodeList displaynodes = display_list.getElementsByTagName(GSXML.DISPLAY_TEXT_ELEM);
     
    269283    Element build_config_elem = loadBuildConfigFile();
    270284    if (coll_config_elem == null||build_config_elem == null) {
    271         // wont be able to do any of teh requests
     285        // wont be able to do any of the requests
    272286        return false;
    273287    }   
    274288   
    275289    if (subset.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) {
    276         Element service_rack_list = (Element)GSXML.getChildByTagName(build_config_elem, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
    277        
    278         return configureServiceRack(service_rack_list, coll_config_elem);
     290      return configureServiceRacks(coll_config_elem, build_config_elem);
    279291    }
    280292
Note: See TracChangeset for help on using the changeset viewer.