Changeset 26754

Show
Ignore:
Timestamp:
19.01.2013 15:29:32 (6 years ago)
Author:
davidb
Message:

When loading in collection/collection item objects each frameset directory will be searched for a collection.inf file. If this file exists then the frameset is considered a GlamED collection.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/GlamED/trunk/src/org/honours/Main.java

    r26742 r26754  
    1818 
    1919/** 
    20  * Main class for the cultural collections 
    21  * management system. 
     20 * Main class for the GlamED cultural  
     21 * collections management system. 
    2222 * @author Korii 
    2323 */ 
     
    3030    public static final String GSDL_HOME = "greenstone3-svn\\web"; 
    3131     
    32     // 
    3332    public static final String GSDL_COLLECT_PATH = GSDL_HOME + File.separator + "sites" + File.separator + "localsite" + 
    3433            File.separator + "collect" + File.separator; 
     
    3938    public static final int _assocfilePathXpos = 175; 
    4039    public static final int _assocfilePathYpos = 101; 
     40     
     41    //Collection info file name. 
     42    private static final String COLLECTION_INF_FILE = "collection.inf"; 
     43     
    4144     
    4245    /** 
     
    108111    /** 
    109112     * Set up collection objects which last for entire runtime. 
    110      * A "Collections" directory has been specially created where 
    111      * collection framesets from GSDL are kept. This method will only 
    112      * search this directory for collections (and not any other directories 
    113      * where framesets are kept). 
     113     * TODO: It would be good to set up a "Collections" frameset directory 
     114     * to import framesets from Greenstone into. However at this stage, accessing 
     115     * framesets not in the default framesets location makes loading them 
     116     * a lot slower. 
    114117     * @throws Exception 
    115118     */ 
    116119    private static void setUpCollectionObjects() throws Exception{ 
    117120         
    118         //File collectionsDir = new File(HonoursFrameIO.COLLECTIONS_PATH); 
    119          
    120121        File collectionsDir = new File(FrameIO.FRAME_PATH); 
     122         
    121123         
    122124        if(collectionsDir.isDirectory()){ 
     
    130132                    continue; 
    131133                 
     134                //Check if directory is a collection frameset from Greenstone. 
    132135                String fName = f.getName(); 
    133                  
    134                 //TODO: Change this so that "collection" framesets have their own special way of being identified. 
    135                 if(fName.equals("collectionsmain") || fName.equals("exhibitionsmain") || fName.equals("interface-overlays") || fName.equals("notesmain") || fName.equals("documentation")){ 
     136                File[] children = f.listFiles(); 
     137                boolean isCollection = false; 
     138                 
     139                for(int i =0; i < children.length; i++){ 
     140                    String currChildName = children[i].getName(); 
     141                    if(currChildName.equals(COLLECTION_INF_FILE)){ 
     142                        isCollection = true; 
     143                    } 
     144                } 
     145                 
     146                if(!isCollection) 
    136147                    continue; 
    137                 } 
    138                  
     148     
    139149                Collection collect = obtainCollectionItems(fName); 
    140150