Changeset 18365 for gli

Show
Ignore:
Timestamp:
12.01.2009 11:55:50 (11 years ago)
Author:
kjdon
Message:

added in a bit of stuff that seemed to get missed out in the merge

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java

    r18364 r18365  
    3939import org.greenstone.gatherer.util.StaticStrings; 
    4040import org.greenstone.gatherer.util.Utility; 
     41import org.greenstone.gatherer.shell.GShell; 
     42import org.greenstone.gatherer.shell.GShellEvent; 
     43import org.greenstone.gatherer.shell.GShellListener; 
     44import org.greenstone.gatherer.shell.GShellProgressMonitor; 
    4145 
    4246/** A dialog which provides a straight-forward access to the currently installed collections. It also will contain the ability to continue through to the original OpenCollectionDialog if your source collection is located somewhere other than the gsdl collect folder. */ 
     
    261265 
    262266    private TreeSet data; 
     267    static final public int COLLECT   = 3; 
    263268 
    264269    public CollectionListModel() { 
     
    294299             
    295300            File config_file = new File(collection_folder, file_name); 
    296             File collection_metadata_directory = new File(collection_folder, "metadata"); 
     301            File collection_metadata_directory = new File(collection_folder, "metadata"); 
    297302            if (collection_metadata_directory.exists() && config_file.exists()) { 
    298303            BasicCollectionConfiguration collection_configuration = new BasicCollectionConfiguration(config_file); 
     
    335340    public int getSize() { 
    336341        return data.size(); 
     342    } 
     343 
     344    public void convertToGS3Collection(File collection_folder) { 
     345 
     346        File collect_cfg_file = new File(collection_folder.getAbsolutePath() + File.separator + "etc" + File.separator + "collect.cfg"); 
     347        File build_cfg_file = new File(collection_folder.getAbsolutePath() + File.separator+"index" + File.separator + "build.cfg"); 
     348 
     349        if (collect_cfg_file.exists() && build_cfg_file.exists()){ 
     350        // Generate the convert_coll_from_gs2.pl command 
     351        ArrayList command_parts_list = new ArrayList(); 
     352        if ((Utility.isWindows()) && (!Gatherer.isGsdlRemote)) { 
     353            command_parts_list.add(Configuration.perl_path); 
     354            command_parts_list.add("-S"); 
     355        } 
     356        command_parts_list.add(Configuration.getGS3ScriptPath() + "convert_coll_from_gs2.pl"); 
     357        command_parts_list.add("-collectdir"); 
     358        command_parts_list.add(collection_folder.getParent()); 
     359        command_parts_list.add(collection_folder.getName()); 
     360 
     361        // Run the convert_coll_from_gs2.pl command 
     362        String[] command_parts = (String[]) command_parts_list.toArray(new String[0]); 
     363        GShell process = new GShell(command_parts, GShell.CONVERT, COLLECT, null, null, GShell.GSHELL_CONVERT); 
     364        //process.addGShellListener(this); 
     365        process.run(); // Don't bother threading this... yet 
     366         
     367        collect_cfg_file.delete(); 
     368        build_cfg_file.delete(); 
     369        } 
    337370    } 
    338371    }