Changeset 21312

Show
Ignore:
Timestamp:
09.12.2009 15:28:39 (10 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

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection
Files:
2 modified

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 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java

    r16688 r21312  
    205205     
    206206    // do the service racks 
     207    // empty the service map in case this is a reconfigure 
     208    clearServices(); 
    207209    Element service_rack_list = (Element)GSXML.getChildByTagName(service_cluster_info, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER); 
    208210    if (service_rack_list == null) { 
     
    274276    return true; 
    275277    } 
    276      
     278 
     279     
     280  protected void clearServices() { 
     281    service_map.clear(); 
     282    this.service_list = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 
     283  } 
    277284    /** creates and configures all the services - extra_info is some more xml  
    278285that is passed to teh service  - eg used for coll config files for Collection 
     
    280287    protected boolean configureServiceRack(Element service_rack_list,  
    281288                       Element extra_info) { 
    282  
    283     // empty the service map in case this is a reconfigure 
    284     service_map.clear(); 
    285     this.service_list = this.doc.createElement(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER); 
    286289 
    287290    // create all the services 
     
    607610    if (subset.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) { 
    608611        Element service_rack_list = (Element)GSXML.getChildByTagName(cluster_config_elem, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER); 
    609          
     612        clearServices(); 
    610613        return configureServiceRack(service_rack_list, null); 
    611614    } else if (subset.equals(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER)) {