Changeset 6992


Ignore:
Timestamp:
2004-03-09T16:22:47+13:00 (20 years ago)
Author:
kjdon
Message:

now load up plugins and classifiers in the right language

Location:
trunk/gli/src/org/greenstone/gatherer/cdm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java

    r6861 r6992  
    304304     * @param classifier The classifier <strong>File</strong> you wish to load.
    305305     */
    306     private void loadClassifier(File classifier) {
     306    private void loadClassifier(File classifier, String lang) {
    307307    ///ystem.err.println("Attempting to parse " + classifier.toString());
    308308    Document document = null;
     
    313313        String args[] = null;
    314314        if(Utility.isWindows()) {
    315         args = new String[4];
     315        args = new String[6];
    316316        if(Gatherer.config.perl_path != null) {
    317317            args[0] = Gatherer.config.perl_path;
     
    322322        args[1] = Gatherer.config.gsdl_path + "bin" + File.separator + "script" + File.separator + "classinfo.pl";
    323323        args[2] = "-xml";
    324         args[3] = getClassifierName(classifier);
     324        args[3] = "-language";
     325        args[4] = lang;
     326        args[5] = getClassifierName(classifier);
    325327        }
    326328        else {
    327         args = new String[3];
     329        args = new String[5];
    328330        args[0] = "classinfo.pl";
    329331        args[1] = "-xml";
    330         args[2] = getClassifierName(classifier);
     332        args[2] = "-language";
     333        args[3] = lang;
     334        args[4] = getClassifierName(classifier);
    331335        }
    332336
     
    334338        Runtime runtime = Runtime.getRuntime();
    335339        Process process = runtime.exec(args);
    336         BufferedReader error_in = new BufferedReader(new InputStreamReader(process.getErrorStream()));
     340        BufferedReader error_in = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
    337341        String line = "";
    338342        StringBuffer xml = new StringBuffer("");
     
    395399        String directory = Gatherer.config.gsdl_path;
    396400        directory = directory + "perllib" + File.separator + "classify" + File.separator;
     401        String current_lang = Gatherer.config.getLanguage();
    397402        File files[] = (new File(directory)).listFiles();
    398403        if(files != null) {
     
    402407            // We only want to check Perl Modules.
    403408            if(files[i].getName().endsWith(".pm")) {
    404             loadClassifier(files[i]);
     409            loadClassifier(files[i], current_lang);
    405410            }
    406411            progress.inc();
  • trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java

    r6862 r6992  
    354354     * @param plugin The plugin <strong>File</strong> you wish to load.
    355355     */
    356     private void loadPlugIn(File plugin) {
     356    private void loadPlugIn(File plugin, String lang) {
    357357    Document document = null;
     358   
    358359    // Run pluginfo on this plugin, and then send the results for parsing.
    359360    try {
    360361        String args[] = null;
    361362        if(Utility.isWindows()) {
    362         args = new String[4];
     363        args = new String[6];
    363364        if(Gatherer.config.perl_path != null) {
    364365            args[0] = Gatherer.config.perl_path;
     
    369370        args[1] = Gatherer.config.gsdl_path + "bin" + File.separator + "script" + File.separator + "pluginfo.pl";
    370371        args[2] = "-xml";
    371         args[3] = getPlugInName(plugin);
     372        args[3] = "-language";
     373        args[4] = lang;
     374        args[5] = getPlugInName(plugin);
    372375        }
    373376        else {
    374         args = new String[3];
     377        args = new String[5];
    375378        args[0] = "pluginfo.pl";
    376379        args[1] = "-xml";
    377         args[2] = getPlugInName(plugin);
     380        args[2] = "-language";
     381        args[3] = lang;
     382        args[4] = getPlugInName(plugin);
    378383        }
    379384        // Create the process.
     
    381386        Process process = runtime.exec(args);
    382387        //InputStream input_stream = process.getErrorStream();
    383         BufferedReader error_in = new BufferedReader(new InputStreamReader(process.getErrorStream()));
     388        BufferedReader error_in = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
    384389        String line = "";
    385390        StringBuffer xml = new StringBuffer("");
     
    453458    boolean is_windows = Utility.isWindows();
    454459    boolean is_mac = Utility.isMac();
     460    String current_lang = Gatherer.config.getLanguage();
    455461    if(files != null) {
    456462        // Create a progress indicator.
     
    462468            // don't load DBPlug for windows
    463469            } else {
    464             loadPlugIn(files[i]);
     470            loadPlugIn(files[i], current_lang);
    465471            }
    466472        }
Note: See TracChangeset for help on using the changeset viewer.