greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 16267

Show
Ignore:
Timestamp:
2008-07-02 09:04:06 (2 months ago)
Author:
davidb
Message:

Support for 'collectgroup' added, whereby Greenstone 2 collections can be grouped into different sets of collections. Thought I had all the angles covered but it turns out I've overlooked the case of 'base this on' collection feature of GLI, which currently doesn't know about the collectgroup feature. Committing what I have for now, as since there are no instructions on how to use this feature, no one is going to activating it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gli/trunk/src/org/greenstone/gatherer/collection/BasicCollectionConfiguration.java

    r14049 r16267  
    5656    private String name = ""; 
    5757    private String is_public = ""; 
     58    private String collectgroup = "false"; 
    5859     
    5960    private String site = null; // used for gs3 colls 
     
    9596                        else if(command_type_str.equals(StaticStrings.COLLECTIONMETADATA_MAINTAINER_STR)) { 
    9697                            maintainer = tokenizer.nextToken(); 
     98                        } 
     99                        else if(command_type_str.equals(StaticStrings.COLLECTIONMETADATA_COLLECTGROUP_STR)) { 
     100                            collectgroup = tokenizer.nextToken(); 
    97101                        } 
    98102                        else if(command_type_str.equalsIgnoreCase(StaticStrings.COLLECTIONMETADATA_STR)) { 
     
    228232        return is_public; 
    229233    } 
     234 
     235    public String getCollectGroup() { 
     236        return collectgroup; 
     237    } 
    230238     
    231239    /** Retrieve the short name for this collection which, given this current file is in <col_name>/etc/collect.cfg, is the name of this file's parent file's parent. 
  • gli/trunk/src/org/greenstone/gatherer/collection/ScriptOptions.java

    r14974 r16267  
    252252                Process process = runtime.exec(args); 
    253253 
    254                 /* 
     254                 
    255255                for (int i=0; i<args.length; i++) {  
    256256                    System.err.print(args[i] + " "); 
    257257                } 
    258258                System.err.println(""); 
    259                 */ 
     259                 
    260260 
    261261 
  • gli/trunk/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java

    r14753 r16267  
    253253                return; 
    254254            } 
     255 
     256            load_collection_configs(data,collect_directory); 
     257 
     258        } 
     259 
     260 
     261        protected void load_collection_configs(TreeSet data, File collect_directory) { 
     262 
    255263            File[] collection_folders = collect_directory.listFiles(); 
     264 
    256265            for(int i = 0; i < collection_folders.length; i++) { 
    257266                File collection_folder = collection_folders[i]; 
    258267                String collection_foldername = collection_folder.getName(); 
     268 
    259269                if(collection_folder.isDirectory() && !collection_foldername.equals(StaticStrings.MODEL_COLLECTION_NAME)) { 
    260270                    // this 'file_name' has already been prefixed by 'etc' 
     
    267277                    } 
    268278                     
    269                     //String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 
    270279                    File config_file = new File(collection_folder, file_name); 
    271280                    File collection_metadata_directory = new File(collection_folder, "metadata"); 
    272281                    if (collection_metadata_directory.exists() && config_file.exists()) { 
    273282                        BasicCollectionConfiguration collection_configuration = new BasicCollectionConfiguration(config_file); 
    274                         data.add(collection_configuration); 
     283 
     284                        // look to see if group set? 
     285                        // => if it is, don't add, but recurse to look for child collections in collect-group 
     286 
     287                        if (collection_configuration.getCollectGroup().equals("true")) { 
     288                            load_collection_configs(data, collection_folder); 
     289                        } 
     290                        else { 
     291                            data.add(collection_configuration); 
     292                        } 
    275293                    } 
    276294                    config_file = null; 
     
    282300            collect_directory = null; 
    283301        } 
     302 
     303 
    284304 
    285305        public Object getElementAt(int index) { 
  • gli/trunk/src/org/greenstone/gatherer/util/StaticStrings.java

    r15882 r16267  
    7373    static final public String COLLECTIONMETADATA_PUBLIC_ELEMENT = "Public"; 
    7474    static final public String COLLECTIONMETADATA_PUBLIC_STR = "public"; 
     75    static final public String COLLECTIONMETADATA_COLLECTGROUP_STR = "collectgroup"; 
    7576    static final public String COLLECTIONMETADATA_STR = "collectionmeta"; 
    7677    static final public String COLON_CHARACTER = ":";