Package com.alibaba.antx.config

Examples of com.alibaba.antx.config.ConfigRuntimeImpl


        }

        cli = manager.parse(args);

        String charset = cli.getOptionValue(CLIManager.OPT_CHARSET);
        ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

        runtime = runtimeImpl;

        // ��ʾ����
        if (cli.hasOption(CLIManager.OPT_HELP)) {
            manager.help(runtimeImpl.getOut());
            return 0;
        }

        // ����cli�����ݣ�����runtime���ԡ�
        if (cli.hasOption(CLIManager.OPT_GUI_MODE)) {
            runtimeImpl.setGuiMode();
        }

        if (cli.hasOption(CLIManager.OPT_TEXT_MODE)) {
            runtimeImpl.setTextMode();
        }

        if (cli.hasOption(CLIManager.OPT_NON_INTERACTIVE_MODE)) {
            runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_OFF);
        } else if (cli.hasOption(CLIManager.OPT_INTERACTIVE_MODE)) {
            String mode = cli.getOptionValue(CLIManager.OPT_INTERACTIVE_MODE);

            if (StringUtil.isBlank(mode)) {
                runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_ON);
            } else {
                runtimeImpl.setInteractiveMode(mode);
            }
        }

        runtimeImpl.setDescriptorPatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_DESCRIPTORS), cli
                .getOptionValue(CLIManager.OPT_EXCLUDE_DESCRIPTORS));
        runtimeImpl.setPackagePatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_PACKAGES), cli
                .getOptionValue(CLIManager.OPT_EXCLUDE_PACKAGES));

        runtimeImpl.setType(cli.getOptionValue(CLIManager.OPT_TYPE));
        runtimeImpl.setDests(cli.getArgs());

        String[] outputs = null;

        if (cli.hasOption(CLIManager.OPT_OUTPUT_FILES)) {
            String outputFileNames = cli.getOptionValue(CLIManager.OPT_OUTPUT_FILES);

            if (outputFileNames != null) {
                outputs = outputFileNames.split("[,\\s]+");
            }

            runtimeImpl.setOutputs(outputs);
        }

        if (cli.hasOption(CLIManager.OPT_USER_PROPERTIES)) {
            runtimeImpl.setUserPropertiesFile(cli.getOptionValue(CLIManager.OPT_USER_PROPERTIES), charset);
        }

        if (cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES) || cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES_NAME)) {
            String[] sharedPropertiesFiles = StringUtil.split(cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES));
            String sharedPropertiesName = cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES_NAME);

            runtimeImpl.setSharedPropertiesFiles(sharedPropertiesFiles, sharedPropertiesName, charset);
        }

        if (cli.hasOption(CLIManager.OPT_VERBOSE)) {
            runtimeImpl.setVerbose();
            initLogging(true, charset);
        } else {
            initLogging(false, charset);
        }

        // ����antxconfig
        try {
            runtimeImpl.start();
        } catch (Exception e) {
            runtimeImpl.error(e);
        }

        return 0;
    }
View Full Code Here


            getLog().info("  mvn -Dautoconfig.charset=yourcharset");
            getLog().info("");

            LogConfigurator.getConfigurator().configureDefault(false, charset);

            ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

            runtimeImpl.setInteractiveMode(interactiveMode);
            runtimeImpl.setDests(new String[] { dest.getAbsolutePath() });
            runtimeImpl.setType(type);

            if (userProperties != null) {
                runtimeImpl.setUserPropertiesFile(userProperties.getAbsolutePath(), null);
            }

            getLog().info(
                    "Configuring " + dest.getAbsolutePath() + ", interactiveMode=" + interactiveMode + ", strict="
                            + strict);
            getLog().info("-------------------------------------------------");

            try {
                if (!runtimeImpl.start() && strict) {
                    throw new RuntimeException("undefined placeholders");
                }
            } catch (Exception e) {
                runtimeImpl.error(e);
                throw new MojoExecutionException("Autoconfig failed", e);
            }

            if (exploding && explodedDirectory != null) {
                unpack(dest, explodedDirectory);
View Full Code Here

        }

        cli = manager.parse(args);

        String charset = cli.getOptionValue(CLIManager.OPT_CHARSET);
        ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

        runtime = runtimeImpl;

        // 显示帮助
        if (cli.hasOption(CLIManager.OPT_HELP)) {
            manager.help(runtimeImpl.getOut());
            return 0;
        }

        // 根据cli的内容,设置runtime属性。
        if (cli.hasOption(CLIManager.OPT_GUI_MODE)) {
            runtimeImpl.setGuiMode();
        }

        if (cli.hasOption(CLIManager.OPT_TEXT_MODE)) {
            runtimeImpl.setTextMode();
        }

        if (cli.hasOption(CLIManager.OPT_NON_INTERACTIVE_MODE)) {
            runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_OFF);
        } else if (cli.hasOption(CLIManager.OPT_INTERACTIVE_MODE)) {
            String mode = cli.getOptionValue(CLIManager.OPT_INTERACTIVE_MODE);

            if (StringUtil.isBlank(mode)) {
                runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_ON);
            } else {
                runtimeImpl.setInteractiveMode(mode);
            }
        }

        runtimeImpl.setDescriptorPatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_DESCRIPTORS),
                                          cli.getOptionValue(CLIManager.OPT_EXCLUDE_DESCRIPTORS));
        runtimeImpl.setPackagePatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_PACKAGES),
                                       cli.getOptionValue(CLIManager.OPT_EXCLUDE_PACKAGES));

        runtimeImpl.setType(cli.getOptionValue(CLIManager.OPT_TYPE));
        runtimeImpl.setDests(cli.getArgs());

        String[] outputs = null;

        if (cli.hasOption(CLIManager.OPT_OUTPUT_FILES)) {
            String outputFileNames = cli.getOptionValue(CLIManager.OPT_OUTPUT_FILES);

            if (outputFileNames != null) {
                outputs = outputFileNames.split("[,\\s]+");
            }

            runtimeImpl.setOutputs(outputs);
        }

        if (cli.hasOption(CLIManager.OPT_USER_PROPERTIES)) {
            runtimeImpl.setUserPropertiesFile(cli.getOptionValue(CLIManager.OPT_USER_PROPERTIES), charset);
        }

        if (cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES) || cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES_NAME)) {
            String[] sharedPropertiesFiles = StringUtil.split(cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES));
            String sharedPropertiesName = cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES_NAME);

            runtimeImpl.setSharedPropertiesFiles(sharedPropertiesFiles, sharedPropertiesName, charset);
        }

        if (cli.hasOption(CLIManager.OPT_VERBOSE)) {
            runtimeImpl.setVerbose();
            initLogging(true, charset);
        } else {
            initLogging(false, charset);
        }

        // 运行antxconfig
        try {
            runtimeImpl.start();
        } catch (Exception e) {
            runtimeImpl.error(e);
        }

        return 0;
    }
View Full Code Here

            getLog().info("  mvn -Dautoconfig.charset=yourcharset");
            getLog().info("");

            LogConfigurator.getConfigurator().configureDefault(false, charset);

            ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

            runtimeImpl.setInteractiveMode(interactiveMode);
            runtimeImpl.setDests(new String[] { dest.getAbsolutePath() });
            runtimeImpl.setType(type);

            if (userProperties != null) {
                runtimeImpl.setUserPropertiesFile(userProperties.getAbsolutePath(), null);
            }

            getLog().info(
                    "Configuring " + dest.getAbsolutePath() + ", interactiveMode=" + interactiveMode + ", strict="
                            + strict);
            getLog().info("-------------------------------------------------");

            try {
                if (!runtimeImpl.start() && strict) {
                    throw new RuntimeException("undefined placeholders");
                }
            } catch (Exception e) {
                runtimeImpl.error(e);
                throw new MojoExecutionException("Autoconfig failed", e);
            }

            if (exploding && explodedDirectory != null) {
                unpack(dest, explodedDirectory);
View Full Code Here

        }

        cli = manager.parse(args);

        String charset = cli.getOptionValue(CLIManager.OPT_CHARSET);
        ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

        runtime = runtimeImpl;

        // ��ʾ����
        if (cli.hasOption(CLIManager.OPT_HELP)) {
            manager.help(runtimeImpl.getOut());
            return 0;
        }

        // ����cli�����ݣ�����runtime���ԡ�
        if (cli.hasOption(CLIManager.OPT_GUI_MODE)) {
            runtimeImpl.setGuiMode();
        }

        if (cli.hasOption(CLIManager.OPT_TEXT_MODE)) {
            runtimeImpl.setTextMode();
        }

        if (cli.hasOption(CLIManager.OPT_NON_INTERACTIVE_MODE)) {
            runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_OFF);
        } else if (cli.hasOption(CLIManager.OPT_INTERACTIVE_MODE)) {
            String mode = cli.getOptionValue(CLIManager.OPT_INTERACTIVE_MODE);

            if (StringUtil.isBlank(mode)) {
                runtimeImpl.setInteractiveMode(ConfigConstant.INTERACTIVE_ON);
            } else {
                runtimeImpl.setInteractiveMode(mode);
            }
        }

        runtimeImpl.setDescriptorPatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_DESCRIPTORS), cli
                .getOptionValue(CLIManager.OPT_EXCLUDE_DESCRIPTORS));
        runtimeImpl.setPackagePatterns(cli.getOptionValue(CLIManager.OPT_INCLUDE_PACKAGES), cli
                .getOptionValue(CLIManager.OPT_EXCLUDE_PACKAGES));

        runtimeImpl.setType(cli.getOptionValue(CLIManager.OPT_TYPE));
        runtimeImpl.setDests(cli.getArgs());

        String[] outputs = null;

        if (cli.hasOption(CLIManager.OPT_OUTPUT_FILES)) {
            String outputFileNames = cli.getOptionValue(CLIManager.OPT_OUTPUT_FILES);

            if (outputFileNames != null) {
                outputs = outputFileNames.split("[,\\s]+");
            }

            runtimeImpl.setOutputs(outputs);
        }

        if (cli.hasOption(CLIManager.OPT_USER_PROPERTIES)) {
            runtimeImpl.setUserPropertiesFile(cli.getOptionValue(CLIManager.OPT_USER_PROPERTIES), charset);
        }

        if (cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES) || cli.hasOption(CLIManager.OPT_SHARED_PROPERTIES_NAME)) {
            String[] sharedPropertiesFiles = StringUtil.split(cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES));
            String sharedPropertiesName = cli.getOptionValue(CLIManager.OPT_SHARED_PROPERTIES_NAME);

            runtimeImpl.setSharedPropertiesFiles(sharedPropertiesFiles, sharedPropertiesName, charset);
        }

        if (cli.hasOption(CLIManager.OPT_VERBOSE)) {
            runtimeImpl.setVerbose();
            initLogging(true, charset);
        } else {
            initLogging(false, charset);
        }

        // ����antxconfig
        try {
            runtimeImpl.start();
        } catch (Exception e) {
            runtimeImpl.error(e);
        }

        return 0;
    }
View Full Code Here

            getLog().info("  mvn -Dautoconfig.charset=yourcharset");
            getLog().info("");

            LogConfigurator.getConfigurator().configureDefault(false, charset);

            ConfigRuntimeImpl runtimeImpl = new ConfigRuntimeImpl(System.in, System.out, System.err, charset);

            runtimeImpl.setInteractiveMode(interactiveMode);
            runtimeImpl.setDests(new String[] { dest.getAbsolutePath() });
            runtimeImpl.setType(type);

            if (descriptors != null) {
                runtimeImpl.setDescriptorPatterns(descriptors.getIncludes(), descriptors.getExcludes());
            }

            if (packages != null) {
                runtimeImpl.setPackagePatterns(packages.getIncludes(), packages.getExcludes());
            }

            if (userProperties != null) {
                runtimeImpl.setUserPropertiesFile(userProperties.getAbsolutePath(), null);
            }

            getLog().info(
                    "Configuring " + dest.getAbsolutePath() + ", interactiveMode=" + interactiveMode + ", strict="
                    + strict);
            getLog().info("-------------------------------------------------");

            try {
                if (!runtimeImpl.start() && strict) {
                    throw new RuntimeException("undefined placeholders");
                }
            } catch (Exception e) {
                runtimeImpl.error(e);
                throw new MojoExecutionException("Autoconfig failed", e);
            }

            if (exploding && explodedDirectory != null) {
                unpack(dest, explodedDirectory);
View Full Code Here

TOP

Related Classes of com.alibaba.antx.config.ConfigRuntimeImpl

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.