Changeset 13837


Ignore:
Timestamp:
2007-01-31T16:33:12+13:00 (17 years ago)
Author:
qq6
Message:

public=true add collect to both collection_list and module_map, otherwise add it to the module_map only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java

    r13209 r13837  
    9898    protected XMLConverter converter=null;
    9999
    100    
    101100    //***************************************************************
    102101    // public methods
     
    774773
    775774    logger.info("Activating collection: "+col_name+".");
    776        
     775
     776    // now we need to look at the etc/collectionConfigure.xml file, and see whether the collection is public
     777    String public_info="false";
     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    Element collectionConfig_info = collectionConfig_doc.getDocumentElement();
     786
     787    NodeList metadateList_node_list=null;
     788    if (collectionConfig_info!=null){
     789        metadateList_node_list = collectionConfig_info.getElementsByTagName(GSXML.METADATA_ELEM);
     790     }
     791
     792    for (int i=0; i<metadateList_node_list.getLength(); i++) {
     793        Element opt = (Element)metadateList_node_list.item(i);
     794        String name = opt.getAttribute(GSXML.NAME_ATT);
     795        if (name.equals("public")) {
     796        public_info = GSXML.getValue(opt);
     797        }
     798    }
     799
     800
    777801    // now we need to look for the etc/collectionInit.xml file, and see what sort of Collection to load
    778802    Collection c = null;
    779803    File init_file = new File(GSFile.collectionInitFile(this.site_home, col_name));
     804
    780805    if (init_file.exists()) {
    781806        Document init_doc = this.converter.getDOM(init_file);
     
    807832        // add to list of collections
    808833        this.module_map.put(col_name, c);
    809         //add short description_ to collection_list_
    810         Element e = this.doc.createElement(GSXML.COLLECTION_ELEM);
    811         e.setAttribute(GSXML.NAME_ATT, col_name);
    812         this.collection_list.appendChild(e);
     834        public_info=public_info.toLowerCase().trim();
     835         if(public_info.equals("true")){
     836        //add short description_ to collection_list_
     837        Element e = this.doc.createElement(GSXML.COLLECTION_ELEM);
     838        e.setAttribute(GSXML.NAME_ATT, col_name);
     839        this.collection_list.appendChild(e);
     840        }else{
     841        return false;
     842        }
    813843        return true;
    814844    } else {
     
    817847        return false;
    818848    }
    819    
    820849    }
    821850   
Note: See TracChangeset for help on using the changeset viewer.