Changeset 18360 for gli


Ignore:
Timestamp:
2009-01-12T11:18:49+13:00 (15 years ago)
Author:
kjdon
Message:

updated the rtl-gli branch with files from trunk. Result of a merge 14807:18318

Location:
gli/branches/rtl-gli/src/org/greenstone/gatherer/shell
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/shell/GImportProgressMonitor.java

    r12294 r18360  
    110110    /** The element name of a file not recognised. */
    111111    static final private String NONRECOGNISEDFILE_ELEMENT = "NonRecognisedFile";
     112    /** The element name of a Warning message */
     113    static final private String WARNING_ELEMENT = "Warning";
    112114    /** The element name of a BadArgument message */
    113115    static final private String BADARGUMENT_ELEMENT = "BadArgument";
     
    315317        }
    316318        }
     319        else if (name.equals(WARNING_ELEMENT)) {
     320        if(Configuration.getMode() <= threshold) {
     321            String args[] = new String[1];
     322            args[0] = element.getAttribute(PLUGIN_ATTRIBUTE);
     323            String reason = element.getAttribute(REASON_ATTRIBUTE);
     324            queue.add(new GShellEvent(event.getSource(), 0, event.getType(), Dictionary.get("GShell.Import.Warning", args) + " " + reason, event.getStatus()));
     325            args = null;
     326        }
     327        }
     328       
     329       
    317330        // Or the import complete element
    318331        else if(name.equals(IMPORTCOMPLETE_ELEMENT)) {
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/shell/GShell.java

    r14305 r18360  
    8989    static final public int CONVERT = 5;
    9090    static final public int EXPLODE = 6;
     91    static final public int SRCREPLACE = 7; // for replacing source docs with their html
     92    static final public int SCHEDULE = 8;
    9193
    9294    /** Elements in status type enumeration. */
     
    103105    static public String GSHELL_CONVERT = "gshell_convert";
    104106    static public String GSHELL_EXPLODE = "gshell_explode";
     107    static public String GSHELL_SRCREPLACE = "gshell_srcreplace"; // for replacing source docs with their html versions
     108    static public String GSHELL_SCHEDULE = "gshell_schedule";
    105109
    106110    /** Determine if the given process is still executing. It does this by attempting to throw an exception - not the most efficient way, but the only one as far as I know
     
    165169        if(line_buffer.length() > 0) {
    166170        String line = line_buffer.toString();
    167         // DebugStream.println("* " + line + " *");
     171        // DebugStream.println("* " + line + " *");     
    168172        fireMessage(type, typeAsString(type) + "> " + line, status, bos);
    169173        line_buffer = new StringBuffer();
     
    191195        String collection_name = args[args.length - 1];
    192196        System.err.println("Collection name: " + collection_name);
     197
    193198
    194199        String script_args = "";
     
    212217        System.err.println("Script args: " + script_args);
    213218        buffered_output_stream = bos;
    214         String command_output = RemoteGreenstoneServer.runScript(collection_name, script_name, script_args, this);
     219        String command_output = Gatherer.remoteGreenstoneServer.runScript(collection_name, script_name, script_args, this);
    215220        status = (command_output.equals("") ? CANCELLED : OK);
    216221    }
     
    235240        Runtime rt = Runtime.getRuntime();
    236241        Process prcs = null;
    237         if (Utility.isWindows()){
    238         prcs = rt.exec(args);
    239         }else{
    240         prcs = rt.exec(command);
    241         }
     242     
     243        prcs = rt.exec(args);
     244        // If we used single argument exec, spaces in filenames or paths cause problems
     245        // I.e. better to avoid: prcs = rt.exec(command);
    242246       
    243247        InputStreamReader eisr = new InputStreamReader( prcs.getErrorStream(), "UTF-8" );
    244         InputStreamReader stdisr = new InputStreamReader( prcs.getInputStream(), "UTF-8"  );
     248        InputStreamReader stdisr = new InputStreamReader( prcs.getInputStream(), "UTF-8"  );       
    245249   
    246250        StringBuffer eline_buffer = new StringBuffer();
     
    260264            sleep(100);
    261265            }
    262             catch(Exception exception) {
     266            catch(Exception exception) {         
    263267            }
    264268        }
     
    344348    String out_name = null;
    345349    BufferedOutputStream bos = null;
    346     if(type == IMPORT || type == BUILD) {
     350    if(type == IMPORT || type == BUILD || type == SCHEDULE) {
    347351        if(type == IMPORT) {
    348352        out_name = (String) Gatherer.c_man.getCollection().import_options.getValue("out");
    349353        }
    350         else {
     354        else if(type == BUILD) {
    351355        out_name = (String) Gatherer.c_man.getCollection().build_options.getValue("out");
     356        }
     357        else { // SCHEDULE
     358        out_name = (String) Gatherer.c_man.getCollection().schedule_options.getValue("out");
    352359        }
    353360        if(out_name != null && out_name.length() > 0) {
     
    376383        if (type == NEW) {
    377384        if (Gatherer.isGsdlRemote) {
    378             RemoteGreenstoneServer.downloadCollection(col_name);
     385            Gatherer.remoteGreenstoneServer.downloadCollection(col_name);
    379386        }
    380387        }
     
    388395            }
    389396
    390             RemoteGreenstoneServer.downloadCollectionArchives(col_name);
     397            Gatherer.remoteGreenstoneServer.downloadCollectionArchives(col_name);
    391398
    392399            if (progress!=null) {
     
    398405        fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Start"), status, null);
    399406        DocXMLFileManager.clearDocXMLFiles();
    400         DocXMLFileManager.loadDocXMLFiles(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath()));
     407        if (Configuration.fedora_info.isActive()) { // FLI case
     408            File collection_export_directory = new File(CollectionManager.getLoadedCollectionExportDirectoryPath());
     409            DocXMLFileManager.loadDocXMLFiles(collection_export_directory,"docmets.xml");
     410        }
     411        else {
     412            File collection_archives_directory = new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath());
     413            DocXMLFileManager.loadDocXMLFiles(collection_archives_directory,"doc.xml");
     414        }
     415
     416
    401417        fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Complete"), status, null);
    402418        }
     
    404420        else if(type == BUILD) {
    405421        // download the building directory (if gsdl server is remote)
    406         if (Gatherer.isGsdlRemote) {
     422        if ((Gatherer.isGsdlRemote) && (!Configuration.fedora_info.isActive())) {
    407423            if (progress!=null) {
    408424            progress.messageOnProgressBar("Downloading index data from server");
    409425            }
    410            
     426                       
    411427            if (!Gatherer.GS3){
    412428            // Only need to download build.cfg file
    413429            File build_cfg_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "build.cfg");
    414             RemoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file);
     430            Gatherer.remoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file);
    415431            }else{
    416432            // Only need to download buildConfig.xml file
    417433            File buildConfig_xml_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "buildConfig.xml");
    418             RemoteGreenstoneServer.downloadCollectionFile(col_name, buildConfig_xml_file);
     434            Gatherer.remoteGreenstoneServer.downloadCollectionFile(col_name, buildConfig_xml_file);
    419435            }
    420436
     
    545561        concerned = null;
    546562    }
     563   
     564    String msg = "";
     565    // If we are creating collection and have trouble with permissions, we need more messages
     566    if(status == ERROR && type == GShell.NEW){
     567      msg = args[args.length-1];
     568    }
    547569    // And firing off an event
    548     GShellEvent event = new GShellEvent(this, 0, type, "", status);
     570    GShellEvent event = new GShellEvent(this, 0, type, msg, status);
    549571    Object[] concerned = listeners.getListenerList();
    550572    for(int i = 0; i < concerned.length ; i++) {
     
    597619        name = "explode_metadata_database.pl";
    598620        break;
     621    case SRCREPLACE: // To work with replace_srcdoc_with_html.pl
     622        name = "replace_srcdoc_with_html.pl";
     623        break;
     624    case SCHEDULE:
     625        name = "schedule.pl";
     626        break;
    599627    default:
    600628        name = "";
Note: See TracChangeset for help on using the changeset viewer.