Package com.baidu.disconf.client.common.model

Examples of com.baidu.disconf.client.common.model.DisconfCenterFile


     *
     */
    @Override
    public DisConfCommonModel getCommonModel(String keyName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(keyName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.error("canot find " + keyName + " in store....");
            return null;
        }

        return disconfCenterFile.getDisConfCommonModel();
    }
View Full Code Here


     *
     */
    @Override
    public void inject2Instance(Object object, String fileName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(fileName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.error("canot find " + fileName + " in store....");
            return;
        }

        //
        // 静态类
        //
        if (object != null) {
            // 设置object
            disconfCenterFile.setObject(object);
        }

        // 根据类型设置值
        //
        // 注入实体
        //
        Map<String, FileItemValue> keMap = disconfCenterFile.getKeyMaps();
        for (String fileItem : keMap.keySet()) {

            // 根据类型设置值
            try {

View Full Code Here

     *
     */
    @Override
    public Object getConfig(String fileName, String keyName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(fileName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.debug("canot find " + fileName + " in store....");
            return null;
        }

        if (disconfCenterFile.getKeyMaps().get(keyName) == null) {
            LOGGER.debug("canot find " + fileName + ", " + keyName
                    + " in store....");
            return null;
        }

        return disconfCenterFile.getKeyMaps().get(keyName).getValue();
    }
View Full Code Here

     *
     */
    @Override
    public void inject2Store(String fileName, DisconfValue disconfValue) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(fileName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.error("canot find " + fileName + " in store....");
            return;
        }

        if (disconfValue == null || disconfValue.getProperties() == null) {
            LOGGER.error("value is null for {}", fileName);
            return;
        }

        // 存储
        Map<String, FileItemValue> keMap = disconfCenterFile.getKeyMaps();
        for (String fileItem : keMap.keySet()) {

            Object object = disconfValue.getProperties().get(fileItem);
            if (object == null) {
                LOGGER.error(
                        "cannot find {} to be injectd. file content is: {}",
                        fileItem, disconfValue.getProperties().toString());
                continue;
            }

            // 根据类型设置值
            try {

                Object value = ClassUtils.getValeByType(keMap.get(fileItem)
                        .getField().getType(), (String) object);
                keMap.get(fileItem).setValue(value);

                // 如果Object非null,则顺便也注入
                if (disconfCenterFile.getObject() != null) {
                    keMap.get(fileItem)
                            .getField()
                            .set(disconfCenterFile.getObject(),
                                    keMap.get(fileItem).getValue());
                }

            } catch (Exception e) {
                LOGGER.error(e.toString(), e);
View Full Code Here

        for (String fileName : disconfStoreProcessor.getConfKeySet()) {

            LOGGER.debug("==============\tstart to process disconf file: "
                    + fileName + "\t=============================");

            DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor
                    .getConfData(fileName);

            try {
                updateOneConfFile(fileName, disconfCenterFile);
            } catch (Exception e) {
View Full Code Here

     *
     */
    @Override
    public void updateOneConf(String fileName) throws Exception {

        DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor
                .getConfData(fileName);

        if (disconfCenterFile != null) {
            updateOneConfFile(fileName, disconfCenterFile);
        }
View Full Code Here

        for (String key : disconfStoreProcessor.getConfKeySet()) {

            LOGGER.debug("==============\tstart to inject value to disconf file item instance: "
                    + key + "\t=============================");

            DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor
                    .getConfData(key);

            if (disconfCenterFile == null) {
                continue;
            }

            try {

                //
                // 获取实例
                //

                Object object = null;
                try {

                    object = disconfCenterFile.getObject();
                    if (object == null) {
                        object = DisconfCoreProcessUtils
                                .getSpringBean(disconfCenterFile.getCls());
                    }

                } catch (Exception e) {

                    LOGGER.debug(disconfCenterFile.getCls()
                            + " may be a non-java-bean");
                    object = null;
                }

                // 注入实体中
View Full Code Here

     *
     */
    @Override
    public DisConfCommonModel getCommonModel(String keyName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(keyName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.error("canot find " + keyName + " in store....");
            return null;
        }

        return disconfCenterFile.getDisConfCommonModel();
    }
View Full Code Here

     *
     */
    @Override
    public void inject2Instance(Object object, String fileName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(fileName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.error("canot find " + fileName + " in store....");
            return;
        }

        //
        // 静态类
        //
        if (object != null) {
            // 设置object
            disconfCenterFile.setObject(object);
        }

        // 根据类型设置值
        //
        // 注入实体
        //
        Map<String, FileItemValue> keMap = disconfCenterFile.getKeyMaps();
        for (String fileItem : keMap.keySet()) {

            // 根据类型设置值
            try {

View Full Code Here

     *
     */
    @Override
    public Object getConfig(String fileName, String keyName) {

        DisconfCenterFile disconfCenterFile = DisconfCenterStore.getInstance()
                .getConfFileMap().get(fileName);

        // 校验是否存在
        if (disconfCenterFile == null) {
            LOGGER.info("canot find " + fileName + " in store....");
            return null;
        }

        if (disconfCenterFile.getKeyMaps().get(keyName) == null) {
            LOGGER.info("canot find " + fileName + ", " + keyName
                    + " in store....");
            return null;
        }

        return disconfCenterFile.getKeyMaps().get(keyName).getValue();
    }
View Full Code Here

TOP

Related Classes of com.baidu.disconf.client.common.model.DisconfCenterFile

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.