FileDocCategorySizeDatePackage
LocalizedStringsGenerator.javaAPI DocphoneME MR2 API (J2ME)24131Wed May 02 18:00:26 BST 2007com.sun.midp.l10n.generator

LocalizedStringsGenerator

public class LocalizedStringsGenerator extends Object
Driver class with main(). Parses command line arguments and invokes LocalizedStringsGeneratorImpl instance that does all the transformation work.

Fields Summary
private static LocalizedStringsGeneratorImpl
transformer
Transformer that does actual transformation
public static String
xmlFileName
XML file name to apply transformation to
public static String
outFileName
Output file name
private static boolean
debug
Print debug output while running
private static boolean
printHelp
Print usage info and exit
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
Main method

param
args Command line arguments



                
         
        try {
            parseArgs(args);
            if (printHelp) {
                printHelp();
                return;
            }

            transformer = new LocalizedStringsGeneratorImpl(debug);
            transformer.transform(xmlFileName, outFileName);
        } catch (SAXException e) {
            // error was already reported
            e.printStackTrace();
            System.exit(1);
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    
private static voidparseArgs(java.lang.String[] args)
Parse command line arguments, adding Transformation objects to transformations vector for each transformation specified.

param
args command line arguments

        for (int i = 0; i < args.length; ++i) {
            String arg = args[i];
            if (debug) {
                System.err.println("arg: " + arg);
            }
            if (arg.equals("-xml")) {
                xmlFileName = args[++i];
            } else if (arg.equals("-out")) {
                outFileName = args[++i];
            } else if (arg.equals("-debug")) {
                debug = true;
            } else {
                printHelp = true;
            }
        }
    
private static voidprintHelp()
Print usage information

        /**
         * Following options are recognized:
         * -xml:        Source XML file.
         * -out:        Output file. If empty, output will be to stdout.
         * -help:       Print usage information
         * -debug:      Be verbose: print some debug info while running.
         */
        System.err.println("Usage: java -jar <l10n_generator_jar_file>"
            + "-xml <localXMLFile> "
            + "-out <localOutputFile> "
            + "[-debug] "
            + "[-help]");