Package com.alibaba.antx.config.props

Examples of com.alibaba.antx.config.props.PropertiesSet


    }

    public void loadAndStart() {
        // ʹ��wizard��֤�����û�����
        ConfigDescriptor[] descriptors = getAllDescriptors();
        PropertiesSet props = settings.getPropertiesSet();
        ConfigWizard wizard = new ConfigWizard(descriptors, props, settings.getCharset());
        boolean valid = wizard.validate();
        String interactiveMode = settings.getInteractiveMode();
        boolean interactiveAuto = ConfigConstant.INTERACTIVE_AUTO.equals(interactiveMode);
        boolean interactiveOn = ConfigConstant.INTERACTIVE_ON.equals(interactiveMode);

        if (interactiveOn || (interactiveAuto && !valid)) {
            if (!valid) {
                StringBuffer confirm = new StringBuffer();

                confirm.append("�q������������������������������������������������������\n");
                confirm.append("��\n");
                confirm.append("�� ���������ļ���Ҫ�����£�\n");
                confirm.append("��\n");
                confirm.append("�� ").append(props.getUserPropertiesFile().getURI()).append("\n");
                confirm.append("��\n");
                confirm.append("�� ����ļ������������˵��������ã�\n");
                confirm.append("�� �����������˿ڡ������ʼ���ַ�����ݡ�\n");
                confirm.append("��\n");
                confirm.append("��������������������������������������\n");
                confirm.append("\n").append(" ��������´��ļ������ܻᵼ�������ļ������ݲ�������\n");
                confirm.append(" ����Ҫ���ڸ��´��ļ���?");

                wizard.setConfirmMessage(confirm.toString());
            }

            wizard.start();

            valid = wizard.validate();
        }

        // ����valid����Ϊtrue�����׳��쳣
        if (!valid) {
            throw new ConfigWizardException("��Ϊ�����ļ���" + props.getUserPropertiesFile().getURI() + "��δ׼���ã������޷�������ȥ��");
        }
    }
View Full Code Here


        return outputFiles;
    }

    public PropertiesSet getPropertiesSet() {
        if (props == null) {
            props = new PropertiesSet(getIn(), getOut());
        }

        return props;
    }
View Full Code Here

    public void setOutputFiles(File[] outputFiles) {
        this.outputFiles = (File[]) outputFiles.clone();
    }

    public void setUserPropertiesFile(String userPropertiesFile, String charset) {
        PropertiesSet props = getPropertiesSet();

        props.setUserPropertiesFile(userPropertiesFile);
        props.getUserPropertiesFile().setCharset(charset);
    }
View Full Code Here

    }

    public void loadAndStart() {
        // 使用wizard验证并和用户交互
        ConfigDescriptor[] descriptors = getAllDescriptors();
        PropertiesSet props = settings.getPropertiesSet();
        ConfigWizard wizard = new ConfigWizard(descriptors, props, settings.getCharset());
        boolean valid = wizard.validate();
        String interactiveMode = settings.getInteractiveMode();
        boolean interactiveAuto = ConfigConstant.INTERACTIVE_AUTO.equals(interactiveMode);
        boolean interactiveOn = ConfigConstant.INTERACTIVE_ON.equals(interactiveMode);

        if (interactiveOn || interactiveAuto && !valid) {
            if (!valid) {
                StringBuffer confirm = new StringBuffer();

                confirm.append("╭───────────────────────┈┈┈┈\n");
                confirm.append("│\n");
                confirm.append("│ 您的配置文件需要被更新:\n");
                confirm.append("│\n");
                confirm.append("│ ").append(props.getUserPropertiesFile().getURI()).append("\n");
                confirm.append("│\n");
                confirm.append("│ 这个文件包括了您个人的特殊设置,\n");
                confirm.append("│ 包括服务器端口、您的邮件地址等内容。\n");
                confirm.append("│\n");
                confirm.append("└───────┈┈┈┈┈┈┈┈┈┈┈\n");
                confirm.append("\n").append(" 如果不更新此文件,可能会导致配置文件的内容不完整。\n");
                confirm.append(" 您需要现在更新此文件吗?");

                wizard.setConfirmMessage(confirm.toString());
            }

            wizard.start();

            valid = wizard.validate();
        }

        // 设置valid变量为true,或抛出异常
        if (!valid) {
            throw new ConfigWizardException("因为配置文件“" + props.getUserPropertiesFile().getURI() + "”未准备好,所以无法继续下去!");
        }
    }
View Full Code Here

        return outputFiles;
    }

    public PropertiesSet getPropertiesSet() {
        if (props == null) {
            props = new PropertiesSet(getIn(), getOut());
        }

        return props;
    }
View Full Code Here

    public void setOutputFiles(File[] outputFiles) {
        this.outputFiles = outputFiles.clone();
    }

    public void setUserPropertiesFile(String userPropertiesFile, String charset) {
        PropertiesSet props = getPropertiesSet();

        props.setUserPropertiesFile(userPropertiesFile);
        props.getUserPropertiesFile().setCharset(charset);
    }
View Full Code Here

    }

    public void loadAndStart() {
        // ʹ��wizard��֤�����û�����
        ConfigDescriptor[] descriptors = getAllDescriptors();
        PropertiesSet props = settings.getPropertiesSet();
        ConfigWizard wizard = new ConfigWizard(descriptors, props, settings.getCharset());
        boolean valid = wizard.validate();
        String interactiveMode = settings.getInteractiveMode();
        boolean interactiveAuto = ConfigConstant.INTERACTIVE_AUTO.equals(interactiveMode);
        boolean interactiveOn = ConfigConstant.INTERACTIVE_ON.equals(interactiveMode);

        if (interactiveOn || (interactiveAuto && !valid)) {
            if (!valid) {
                StringBuffer confirm = new StringBuffer();

                confirm.append("�q������������������������������������������������������\n");
                confirm.append("��\n");
                confirm.append("�� ���������ļ���Ҫ�����£�\n");
                confirm.append("��\n");
                confirm.append("�� ").append(props.getUserPropertiesFile().getURI()).append("\n");
                confirm.append("��\n");
                confirm.append("�� ����ļ������������˵��������ã�\n");
                confirm.append("�� �����������˿ڡ������ʼ���ַ�����ݡ�\n");
                confirm.append("��\n");
                confirm.append("��������������������������������������\n");
                confirm.append("\n").append(" ��������´��ļ������ܻᵼ�������ļ������ݲ�������\n");
                confirm.append(" ����Ҫ���ڸ��´��ļ���?");

                wizard.setConfirmMessage(confirm.toString());
            }

            wizard.start();

            valid = wizard.validate();
        }

        // ����valid����Ϊtrue�����׳��쳣
        if (!valid) {
            throw new ConfigWizardException("��Ϊ�����ļ���" + props.getUserPropertiesFile().getURI() + "��δ׼���ã������޷�������ȥ��");
        }
    }
View Full Code Here

        return outputFiles;
    }

    public PropertiesSet getPropertiesSet() {
        if (props == null) {
            props = new PropertiesSet(getIn(), getOut());
        }

        return props;
    }
View Full Code Here

    public void setOutputFiles(File[] outputFiles) {
        this.outputFiles = (File[]) outputFiles.clone();
    }

    public void setUserPropertiesFile(String userPropertiesFile, String charset) {
        PropertiesSet props = getPropertiesSet();

        props.setUserPropertiesFile(userPropertiesFile);
        props.getUserPropertiesFile().setCharset(charset);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.antx.config.props.PropertiesSet

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.