Changeset 4567


Ignore:
Timestamp:
2003-06-11T13:56:21+12:00 (21 years ago)
Author:
kjdon
Message:

for parsing and writing classifier args: use toStringCOnfig for writing to file, and when reading in, if type is metadata, then make the value have the ex name space if it doesn't already have one.

File:
1 edited

Legend:

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

    r4527 r4567  
    286286        }
    287287
    288                 // Create the process.
     288        // Create the process.
    289289        Runtime runtime = Runtime.getRuntime();
    290290        Process process = runtime.exec(args);
     
    297297        xml.append("\n");
    298298        }
    299                 // Then read the xml from the piped input stream.
     299        // Then read the xml from the piped input stream.
    300300        InputSource source = new InputSource(new StringReader(xml.toString()));
    301301        DOMParser parser = new DOMParser();
     
    305305    catch (Exception error) {
    306306        error.printStackTrace();
    307                 //ystem.err.println("Error: Cannot parse " + getClassifierName(classifier));
     307        ///ystem.err.println("Error: Cannot parse " + getClassifierName(classifier));
    308308    }
    309309    if(document != null) {
     
    356356                if(argument.getType() != Argument.FLAG && tokenizer.hasMoreTokens()) {
    357357                String value = tokenizer.nextToken();
    358                 value = value.replace(':', MSMUtils.NS_SEP);
     358                // special hack for metadata
     359                if (argument.getType() == Argument.METADATA) {
     360                    value = value.replace(':', MSMUtils.NS_SEP);
     361                    if (value.indexOf(MSMUtils.NS_SEP)==-1){
     362                    value = Utility.EXTRACTED_METADATA_NAMESPACE +MSMUtils.NS_SEP+value;
     363                    }
     364                }
     365                // shoudl probably do the same for METADATUM
     366               
    359367                argument.setValue(value);
    360368                }
     
    497505        if(object instanceof Classifier) {
    498506        Classifier classifier = (Classifier) object;
    499         text.append(classifier.toString());
     507        text.append(classifier.toStringConfig());
    500508        }
    501509        else if(object instanceof CustomClassifier) {
     
    574582    File files[] = directory.listFiles();
    575583    if(files != null) {
    576                 // Create a progress indicator.
     584        // Create a progress indicator.
    577585        ParsingProgress progress = new ParsingProgress(get("CDM.ClassifierManager.Parsing.Title"), get("CDM.ClassifierManager.Parsing.Message"), files.length);
    578586        for(int i = 0; i < files.length; i++) {
     
    611619        classifier.setDesc(MSMUtils.getValue(node));
    612620        }
    613                 // Parse the multitude of arguments.
     621        // Parse the multitude of arguments.
    614622        else if(node_name.equals("Arguments")) {
    615623        for(Node arg = node.getFirstChild(); arg != null; arg = arg.getNextSibling()) {
Note: See TracChangeset for help on using the changeset viewer.