Changeset 13860


Ignore:
Timestamp:
2007-02-05T17:13:25+13:00 (17 years ago)
Author:
kjdon
Message:

made the determination of public/private come from the collection, which is already reading in collectionConfig.xml, rather than determined by the MessageRouter, which shouldn't need to read collectionConfig.xml

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3
Files:
2 edited

Legend:

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

    r13830 r13860  
    4848    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.collection.Collection.class.getName());
    4949
     50    /** is this collection public or private */
     51    protected boolean is_public = true;
    5052    protected XMLTransformer transformer = null;
    5153    /** same as setClusterName */
     
    9395   
    9496    }
     97
     98    public boolean isPublic() {
     99    return is_public;
     100    }
    95101    /**
    96102     * load in the collection config file into a DOM Element
     
    153159        resolveMacros(display_list);
    154160        addDisplayItems(display_list);
     161    }
     162
     163    // check whether we are public or not
     164    if (meta_list != null) {
     165        Element meta_elem = (Element) GSXML.getNamedElement(metadata_list, GSXML.METADATA_ELEM, GSXML.NAME_ATT, "public");
     166        if (meta_elem != null) {
     167        String value = GSXML.getValue(meta_elem).toLowerCase().trim();
     168        if (value.equals("false")) {
     169            is_public = false;
     170        }
     171        }
    155172    }
    156173    return true;
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java

    r13850 r13860  
    774774    logger.info("Activating collection: "+col_name+".");
    775775
    776     // now we need to look at the etc/collectionConfig.xml file, and see whether the collection is public
    777     boolean is_public = true; // public unless state otherwise
    778     File collectionConfig_file= new File(GSFile.collectionConfigFile(this.site_home, col_name));
    779     if (!collectionConfig_file.exists() ) {
    780         System.err.println("MessageRouter: site collection config file: "+collectionConfig_file.getPath()+" not found!");
    781         return false;
    782     }
    783    
    784     Document collectionConfig_doc = this.converter.getDOM(collectionConfig_file);
    785     if (collectionConfig_doc != null) {
    786         Element collectionConfig_info = collectionConfig_doc.getDocumentElement();
    787 
    788         if (collectionConfig_info!=null){
    789         Element metadata_list = (Element) GSXML.getChildByTagName(collectionConfig_info,GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER);
    790         if (metadata_list != null) {
    791             Element meta_elem = (Element) GSXML.getNamedElement(metadata_list, GSXML.METADATA_ELEM, GSXML.NAME_ATT, "public");
    792             if (meta_elem != null) {
    793             String value = GSXML.getValue(meta_elem).toLowerCase().trim();
    794             if (value.equals("false")) {
    795                 is_public = false;
    796             }
    797             }
    798         }
    799         }
    800     }
    801 
    802     // now we need to look for the etc/collectionInit.xml file, and see what sort of Collection to load
     776    // Look for the etc/collectionInit.xml file, and see what sort of Collection to load
    803777    Collection c = null;
    804778    File init_file = new File(GSFile.collectionInitFile(this.site_home, col_name));
     
    820794        }
    821795    }
    822     if (c==null) { // we haven't found anpther classname to use
     796    if (c==null) { // we haven't found another classname to use
    823797        c = new Collection();
    824798    }
     
    834808        this.module_map.put(col_name, c);
    835809       
    836         if(is_public) {
     810        if(c.isPublic()) {
    837811        // only public collections will appear on the home page
    838812        // add short description_ to collection_list_
Note: See TracChangeset for help on using the changeset viewer.