Package org.exolab.castor.util

Examples of org.exolab.castor.util.CommandLineOptions


     *
     * @param args
     *            the command line parameters
     */
    public static void main(final String[] args) {
        CommandLineOptions allOptions = new CommandLineOptions();

        // -- Input classname flag
        allOptions.addFlag("i", "classname", "Sets the input class");

        // -- Output filename flag
        String desc = "Sets the output mapping filename";
        allOptions.addFlag("o", "filename", desc, true);

        // -- Force flag
        desc = "Force overwriting of files.";
        allOptions.addFlag("f", "", desc, true);

        // -- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

        // -- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        // -- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String classname = options.getProperty("i");
        String mappingName = options.getProperty("o");
        boolean force = (options.getProperty("f") != null);

        if (classname == null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printUsage(pw);
            pw.flush();
            return;
        }

        MappingTool tool;
View Full Code Here


     *
     * @return a new CommandLineOptions object fully configured to parse our
     *         command line.
     */
    private static CommandLineOptions setupCommandLineOptions() {
        CommandLineOptions allOptions = new CommandLineOptions();
        String desc;

        //-- filename flag
        desc = "Sets the filename for the schema used as input.";
        allOptions.addFlag(ARGUMENT_INPUT, "schema filename", desc);

        //-- filename flag
        desc = "Sets the input source for the schema used as input.";
        allOptions.addFlag(ARGUMENT_INPUT_SOURCE, "input source for XML schema", desc);

        //-- package name flag
        desc = "Sets the package name for generated code.";
        allOptions.addFlag(ARGUMENT_PACKAGE, "package name", desc, true);

        //-- destination directory
        desc = "Sets the destination output directory.";
        allOptions.addFlag(ARGUMENT_DESTINATION_DIR, "destination directory", desc, true);

        //-- line break flag
        desc = "Sets the line separator style for the desired platform.";
        allOptions.addFlag(ARGUMENT_LINE_SEPARATOR, "(unix | mac | win)", desc, true);

        //-- Force flag
        desc = "Suppresses non fatal warnings, such as overwriting files.";
        allOptions.addFlag(ARGUMENT_FORCE, "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag(ARGUMENT_HELP, "", desc, true);

        //-- verbose flag
        desc = "Prints out additional messages when creating source.";
        allOptions.addFlag(ARGUMENT_VERBOSE, "", desc, true);

        //-- fail on first error flag
        desc = "Causes source generation to fail on the first error encountered.";
        allOptions.addFlag(ARGUMENT_FAIL_ON_ERROR, "", desc, true);

        //-- no descriptors flag
        desc = "Disables the generation of the Class descriptors.";
        allOptions.addFlag(ARGUMENT_DISABLE_DESCRIPTORS, "", desc, true);

        //-- mapping file flag
        desc = "Indicates that a mapping file should be generated.";
        allOptions.addFlag(ARGUMENT_GENERATE_MAPPING, "mapping filename", desc, true);

        //-- source generator types name flag
        desc = "Sets the source generator types name (SGTypeFactory).";
        allOptions.addFlag(ARGUMENT_TYPES, "types", desc, true);

        //-- We temporarily maintain backwards compatibility, but this argument is deprecated
        desc = "";
        allOptions.addFlag(ARGUMENT_TYPES_DEPRECATED, "collections class name", desc, true);

        //-- no marshaling framework methods
        desc = "Disables the generation of the methods specific to the XML marshaling framework.";
        allOptions.addFlag(ARGUMENT_NOMARSHALL, "", desc, true);

        //-- implements org.castor.xmlctf.CastorTestable?
        desc = "Implements some specific methods to allow the generated classes"
                + " to be used with Castor Testing Framework.";
        allOptions.addFlag(ARGUMENT_TESTABLE, "", desc, true);

        //-- use SAX1?
        desc = "Uses SAX 1 in the generated code.";
        allOptions.addFlag(ARGUMENT_SAX1, "", desc, true);

        //-- Source Generator Binding
        desc = "Sets the Source Generator Binding File name.";
        allOptions.addFlag(ARGUMENT_BINDING_FILENAME, "filename", desc, true);

        //-- Generates sources for imported XML Schemas
        desc = "Generates sources for imported XML schemas.";
        allOptions.addFlag(ARGUMENT_GENERATE_IMPORTED_SCHEMAS, "", desc, true);

        //-- Sets enumerated type to use a case insensitive lookup
        desc = "Sets enumerated types to use a case insensitive lookup.";
        allOptions.addFlag(ARGUMENT_CASE_INSENSITIVE, "", desc);

        //-- Sets enumerated type to use a case insensitive lookup
        desc = "Sets name conflict strategy to use (possible values are "
            + "'informViaLog', 'warnViaConsoleDialog').";
        allOptions.addFlag(ARGUMENT_NAME_CONFLICT_STRATEGY, "", desc);

        return allOptions;
    }
View Full Code Here

    /**
     * @param args options
     */
    public static void main(final String[] args) {
        CommandLineOptions allOptions = new CommandLineOptions();
       
        allOptions.addFlag(
                "m", "mapping.xml", "input mapping file.");
        allOptions.addFlag(
                "c", "ddl.properties", "configuration file.", true);
        allOptions.addFlag(
                "d", "mysql.properties", "specific database configuration file.", true);
        allOptions.addFlag(
                "e", "MySQL", "database engine, for example MySQL, Oracle", true);
        allOptions.addFlag(
                "o", "output.sql", "output ddl file", true);
        allOptions.addFlag(
                "h", "", "Displays this help screen.", true);

        // Process the specified command line options.
        Properties options = allOptions.getOptions(args);
       
        String  mappingName     = options.getProperty("m");
        String  ddlName         = options.getProperty("o");
        String  globalConfig    = options.getProperty("c");
        String  specificConfig  = options.getProperty("d");
        String  engine  = options.getProperty("e");
       
        if (options.getProperty("h") != null || mappingName == null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            System.exit(0);
        }
       
        // Verify and adjust output file.
View Full Code Here

    /**
     * Command line method
    **/
    public static void main( String[] args )
    {
        CommandLineOptions allOptions = new CommandLineOptions();

        //-- Input classname flag
        allOptions.addFlag("i", "classname", "Sets the input class");

        //-- Output filename flag
        String desc = "Sets the output mapping filename";
        allOptions.addFlag("o", "filename", desc, true);

        //-- Force flag
        desc = "Force overwriting of files.";
        allOptions.addFlag("f", "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

    //-- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        //-- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String  classname       = options.getProperty("i");
        String  mappingName     = options.getProperty("o");
        boolean force           = (options.getProperty("f") != null);
       
       
        if (classname == null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printUsage(pw);
            pw.flush();
            return;
        }
       
        MappingTool tool;
View Full Code Here

     * @param args the String[] consisting of the command line arguments
    **/
    public static void main(String[] args) {


        CommandLineOptions allOptions = new CommandLineOptions();

        //-- filename flag
        allOptions.addFlag("i", "filename", "Sets the input filename");

        //-- package name flag
        allOptions.addFlag("package", "package-name", "Sets the package name", true);

        //-- destination directory
        String desc = "Sets the destination output directory";
        allOptions.addFlag("dest", "dest-dir", desc, true);

        //-- line break flag
        desc = "Sets the line separator style for the desired platform";
        allOptions.addFlag("line-separator", "( unix | mac | win)", desc, true);

        //-- Force flag
        desc = "Suppresses non fatal warnings, such as overwriting files.";
        allOptions.addFlag("f", "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

        //-- verbose flag
        desc = "Prints out additional messages when creaing source";
        allOptions.addFlag("verbose", "", desc, true);

        //-- no descriptors flag
        desc = "Disables the generation of the Class descriptors";
        allOptions.addFlag("nodesc", "", desc, true);

        //-- source generator types name flag
        desc = "Sets the source generator types name (SGTypeFactory)";
        allOptions.addFlag("types", "types", desc, true);

        //-- XXX maintained temporarily
        allOptions.addFlag("type-factory", "classname", "", true);

        //-- no marshalling framework methods
    desc = "Disables the generation of the methods specific to the XML marshalling framework";
    allOptions.addFlag("nomarshall","",desc,true);

        //-- implements org.exolab.castor.tests.CastorTestable?
    desc = "Implements some specific methods to allow the generated classes to be used with Castor Testing Framework";
    allOptions.addFlag("testable","",desc,true);

        //-- use SAX1?
    desc = "Uses SAX 1 in the generated code.";
    allOptions.addFlag("sax1","",desc,true);

        //-- Source Generator Binding
        desc = "Sets the Source Generator Binding File name";
        allOptions.addFlag("binding-file","filename",desc,true);
       
        //-- Generates sources for imported XML Schemas
        desc = "Generates sources for imported XML schemas";
        allOptions.addFlag("generateImportedSchemas","",desc,true);

        //-- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        //-- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String  schemaFilename  = options.getProperty("i");
        String  packageName     = options.getProperty("package");
        String  lineSepStyle    = options.getProperty("line-separator");
        boolean force          = (options.getProperty("f") != null);
        String  typeFactory     = options.getProperty("types");
        boolean verbose        = (options.getProperty("verbose") != null);

        if (schemaFilename == null) {
            System.out.println(APP_NAME);
            allOptions.printUsage(new PrintWriter(System.out));
            return;
        }

        // -- XXX maintained temporarily
        if (typeFactory == null)
View Full Code Here

     * @param args the String[] consisting of the command line arguments
    **/
    public static void main(String[] args) {


        CommandLineOptions allOptions = new CommandLineOptions();

        //-- filename flag
        allOptions.addFlag("i", "filename", "Sets the input filename");

        //-- package name flag
        allOptions.addFlag("package", "package-name", "Sets the package name", true);

        //-- destination directory
        String desc = "Sets the destination output directory";
        allOptions.addFlag("dest", "dest-dir", desc, true);

        //-- line break flag
        desc = "Sets the line separator style for the desired platform";
        allOptions.addFlag("line-separator", "( unix | mac | win)", desc, true);

        //-- Force flag
        desc = "Suppresses non fatal warnings, such as overwriting files.";
        allOptions.addFlag("f", "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

        //-- verbose flag
        desc = "Prints out additional messages when creaing source";
        allOptions.addFlag("verbose", "", desc, true);

        //-- no descriptors flag
        desc = "Disables the generation of the Class descriptors";
        allOptions.addFlag("nodesc", "", desc, true);

        //-- source generator types name flag
        desc = "Sets the source generator types name (SGTypeFactory)";
        allOptions.addFlag("types", "types", desc, true);

        //-- XXX maintained temporarily
        allOptions.addFlag("type-factory", "classname", "", true);

        //-- no marshalling framework methods
    desc = "Disables the generation of the methods specific to the XML marshalling framework";
    allOptions.addFlag("nomarshall","",desc,true);

        //-- implements org.exolab.castor.tests.CastorTestable?
    desc = "Implements some specific methods to allow the generated classes to be used with Castor Testing Framework";
    allOptions.addFlag("testable","",desc,true);

        //-- use SAX1?
    desc = "Uses SAX 1 in the generated code.";
    allOptions.addFlag("sax1","",desc,true);

        //-- Source Generator Binding
        desc = "Sets the Source Generator Binding File name";
        allOptions.addFlag("binding-file","filename",desc,true);

        //-- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        //-- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String  schemaFilename  = options.getProperty("i");
        String  packageName     = options.getProperty("package");
        String  lineSepStyle    = options.getProperty("line-separator");
        boolean force          = (options.getProperty("f") != null);
        String  typeFactory     = options.getProperty("types");
        boolean verbose        = (options.getProperty("verbose") != null);

        if (schemaFilename == null) {
            System.out.println(APP_NAME);
            allOptions.printUsage(new PrintWriter(System.out));
            return;
        }

        // -- XXX maintained temporarily
        if (typeFactory == null)
View Full Code Here

    /**
     * Command line method
    **/
    public static void main( String[] args )
    {
        CommandLineOptions allOptions = new CommandLineOptions();

        //-- Input classname flag
        allOptions.addFlag("i", "classname", "Sets the input class");

        //-- Output filename flag
        String desc = "Sets the output mapping filename";
        allOptions.addFlag("o", "filename", desc, true);

        //-- Force flag
        desc = "Force overwriting of files.";
        allOptions.addFlag("f", "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

    //-- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        //-- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String  classname       = options.getProperty("i");
        String  mappingName     = options.getProperty("o");
        boolean force           = (options.getProperty("f") != null);
       
       
        if (classname == null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printUsage(pw);
            pw.flush();
            return;
        }
       
        MappingTool tool;
View Full Code Here

TOP

Related Classes of org.exolab.castor.util.CommandLineOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.