Package org.jpox.util

Examples of org.jpox.util.CommandLine


     * Constructor
     */
    public SchemaTool()
    {
        omfContext = new OMFContext(this);
        cmd = new CommandLine();
        cmd.addOption("create", "create", null, LOCALISER.msg(false, "014026"));
        cmd.addOption("delete", "delete", null, LOCALISER.msg(false, "014027"));
        cmd.addOption("validate", "validate", null, LOCALISER.msg(false, "014028"));
        cmd.addOption("dbinfo", "dbinfo", null, LOCALISER.msg(false, "014029"));
        cmd.addOption("schemainfo", "schemainfo", null, LOCALISER.msg(false, "014030"));
View Full Code Here


     * Set the command line arguments.
     * @param args The args
     */
    public void setCommandLineArgs(String[] args)
    {
        CommandLine cmd = new CommandLine();
        cmd.addOption("d", "dest", "<directory>", "output directory");
        cmd.addOption("api", "api", "<adapter-name>", "API Adapter (JDO, JPA, etc)");
        cmd.addOption("enhancerName", "enhancerName", "<enhancer-name>", "Class Enhancer name (ASM, BCEL, etc)");
        cmd.addOption("v", "verbose", null, "verbose output");
        cmd.addOption("verify", "verify", null, "verify the enhancement");
        cmd.addOption("checkonly", "checkonly", null, "only check if the class is enhanced");
        cmd.addOption("check", "check", null, "after enhancement, check if the class was enhanced");
        cmd.addOption("persistenceUnit", "persistenceUnit", "<name-of-persistence-unit>", "name of the persistence unit to enhance");

        cmd.parse(args);

        if (cmd.hasOption("api"))
        {
            api = cmd.getOptionArg("api");
            omfContext.setApi(api);
        }
        if (cmd.hasOption("enhancerName"))
        {
            setEnhancerName(cmd.getOptionArg("enhancerName"));
        }

        if (cmd.hasOption("d"))
        {
            String destination = cmd.getOptionArg("d");
            File tmp = new File(destination);
            if (tmp.exists())
            {
                if (!tmp.isDirectory())
                {
                    System.out.println(destination + " is not directory. please set directory.");
                    System.exit(1);
                }
            }
            else
            {
                tmp.mkdirs();
            }
            setDestination(destination);
        }
       
        defaultArgs = cmd.getDefaultArgs();

        // populate options
        ApiAdapter adapter = omfContext.getApiAdapter();
        Map map = adapter.getDefaultFactoryProperties();
        setOptions(map);
        if (cmd.hasOption("persistenceUnit"))
        {
            setProperty("org.jpox.PersistenceUnitName", cmd.getOptionArg("persistenceUnit"));
        }
        if (cmd.hasOption("api"))
        {
            setProperty("org.jpox.persistenceApiName", cmd.getOptionArg("api"));
        }
        if (cmd.hasOption("verify"))
        {
            setProperty(ENHANCER_OPTION_VERIFY, "true");
        }
        if (cmd.hasOption("v"))
        {
            setProperty(ENHANCER_OPTION_VERBOSE, "true");
        }
        if (cmd.hasOption("checkonly"))
        {
            setProperty(ENHANCER_OPTION_CHECKONLY, "true");
        }
    }
View Full Code Here

TOP

Related Classes of org.jpox.util.CommandLine

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.