当前位置: 首页>>代码示例>>Java>>正文


Java DisconfCenterFile类代码示例

本文整理汇总了Java中com.baidu.disconf.client.common.model.DisconfCenterFile的典型用法代码示例。如果您正苦于以下问题:Java DisconfCenterFile类的具体用法?Java DisconfCenterFile怎么用?Java DisconfCenterFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DisconfCenterFile类属于com.baidu.disconf.client.common.model包,在下文中一共展示了DisconfCenterFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDisconfFiles

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 * 获取配置文件数据
 */
private static List<DisconfCenterBaseModel> getDisconfFiles(ScanStaticModel scanModel) {

    List<DisconfCenterBaseModel> disconfCenterFiles = new ArrayList<DisconfCenterBaseModel>();

    Set<Class<?>> classSet = scanModel.getDisconfFileClassSet();
    for (Class<?> disconfFile : classSet) {

        Set<Method> methods = scanModel.getDisconfFileItemMap().get(disconfFile);
        if (methods == null) {
            continue;
        }

        DisconfCenterFile disconfCenterFile = transformScanFile(disconfFile, methods);

        disconfCenterFiles.add(disconfCenterFile);
    }

    return disconfCenterFiles;
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:23,代码来源:StaticScannerFileMgrImpl.java

示例2: callUpdatePipeline

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 * @param key
 */
private void callUpdatePipeline(String key) {

    Object object = disconfStoreProcessor.getConfData(key);
    if (object != null) {
        DisconfCenterFile disconfCenterFile = (DisconfCenterFile) object;

        IDisconfUpdatePipeline iDisconfUpdatePipeline =
                DisconfCenterStore.getInstance().getiDisconfUpdatePipeline();
        if (iDisconfUpdatePipeline != null) {
            try {
                iDisconfUpdatePipeline.reloadDisconfFile(key, disconfCenterFile.getFilePath());
            } catch (Exception e) {
                LOGGER.error(e.toString(), e);
            }
        }
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:21,代码来源:DisconfFileCoreProcessorImpl.java

示例3: inject2Conf

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
@Override
public void inject2Conf() {

    /**
     * 配置文件列表处理
     */
    for (String key : disconfStoreProcessor.getConfKeySet()) {

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

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

        inject2OneConf(key, disconfCenterFile);
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:17,代码来源:DisconfFileCoreProcessorImpl.java

示例4: getConfig

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
@Override
public Object getConfig(String fileName, String keyName) {

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

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

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

    return disconfCenterFile.getKeyMaps().get(keyName).getValue();
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:22,代码来源:DisconfStoreFileProcessorImpl.java

示例5: confToString

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
@Override
public String confToString() {

    StringBuffer sBuffer = new StringBuffer();
    sBuffer.append("\n");
    Map<String, DisconfCenterFile> disMap = getInstance().getConfFileMap();
    for (String file : disMap.keySet()) {
        sBuffer.append("disconf-file:\t" + file + "\t");

        if (LOGGER.isDebugEnabled()) {
            sBuffer.append(disMap.get(file).toString());
        } else {
            sBuffer.append(disMap.get(file).infoString());
        }
        sBuffer.append("\n");
    }

    return sBuffer.toString();
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:23,代码来源:DisconfStoreFileProcessorImpl.java

示例6: storeOneFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 * 存储 一个配置文件
 */
public void storeOneFile(DisconfCenterBaseModel disconfCenterBaseModel) {

    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfCenterBaseModel;

    String fileName = disconfCenterFile.getFileName();

    if (confFileMap.containsKey(fileName)) {

        LOGGER.warn("There are two same fileName key!!!! " + fileName);
        DisconfCenterFile existCenterFile = confFileMap.get(fileName);

        // 如果是 同时使用了 注解式 和 非注解式 两种方式,则当修改时也要 进行 XML 式 reload
        if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {
            existCenterFile.setIsTaggedWithNonAnnotationFile(true);
        }

    } else {
        confFileMap.put(fileName, disconfCenterFile);
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:24,代码来源:DisconfCenterStore.java

示例7: getByFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
@Override
public Map<String, Object> getByFile(String fileName) {

    DisconfStoreProcessor disconfStoreProcessor =
            DisconfStoreProcessorFactory.getDisconfStoreFileProcessor();

    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor.getConfData(fileName);
    if (disconfCenterFile == null) {
        return new HashMap<String, Object>();
    }

    return disconfCenterFile.getKV();
}
 
开发者ID:ningyu1,项目名称:disconf-client-ext,代码行数:14,代码来源:DisconfDataGetterDefaultImpl.java

示例8: getDisconfCenterFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
public static DisconfCenterBaseModel getDisconfCenterFile(String fileName) {

    DisconfCenterFile disconfCenterFile = new DisconfCenterFile();

    fileName = fileName.trim();

    //
    // file name
    disconfCenterFile.setFileName(fileName);

    // file type
    disconfCenterFile.setSupportFileTypeEnum(SupportFileTypeEnum.getByFileName(fileName));

    //
    // disConfCommonModel
    DisConfCommonModel disConfCommonModel = makeDisConfCommonModel(DisClientConfigExt.GLOBAL_APP, "", DisClientConfigExt.GLOBAL_VERSION);
    disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

    // Remote URL
    String url = DisconfWebPathMgr.getRemoteUrlParameter(DisClientSysConfig.getInstance().CONF_SERVER_STORE_ACTION,
            disConfCommonModel.getApp(),
            disConfCommonModel.getVersion(),
            disConfCommonModel.getEnv(),
            disconfCenterFile.getFileName(),
            DisConfigTypeEnum.FILE);
    disconfCenterFile.setRemoteServerUrl(url);

    return disconfCenterFile;
}
 
开发者ID:ningyu1,项目名称:disconf-client-ext,代码行数:33,代码来源:StaticScannerNonAnnotationFileMgrImplExt.java

示例9: getDisconfCenterFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
public static DisconfCenterBaseModel getDisconfCenterFile(String fileName) {

    DisconfCenterFile disconfCenterFile = new DisconfCenterFile();

    fileName = fileName.trim();

    //
    // file name
    disconfCenterFile.setFileName(fileName);

    // 非注解式
    disconfCenterFile.setIsTaggedWithNonAnnotationFile(true);

    // file type
    disconfCenterFile.setSupportFileTypeEnum(SupportFileTypeEnum.getByFileName(fileName));

    //
    // disConfCommonModel
    DisConfCommonModel disConfCommonModel = makeDisConfCommonModel("", "", "");
    disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

    // Remote URL
    String url = DisconfWebPathMgr.getRemoteUrlParameter(DisClientSysConfig.getInstance().CONF_SERVER_STORE_ACTION,
            disConfCommonModel.getApp(),
            disConfCommonModel.getVersion(),
            disConfCommonModel.getEnv(),
            disconfCenterFile.getFileName(),
            DisConfigTypeEnum.FILE);
    disconfCenterFile.setRemoteServerUrl(url);

    return disconfCenterFile;
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:36,代码来源:StaticScannerNonAnnotationFileMgrImpl.java

示例10: processOneItem

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
@Override
public void processOneItem(String key) {

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

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

    try {
        updateOneConfFile(key, disconfCenterFile);
    } catch (Exception e) {
        LOGGER.error(e.toString(), e);
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:15,代码来源:DisconfFileCoreProcessorImpl.java

示例11: updateOneConf

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 * 更新消息:某个配置文件
 */
private void updateOneConf(String fileName) throws Exception {

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

    if (disconfCenterFile != null) {

        // 更新仓库
        updateOneConfFile(fileName, disconfCenterFile);

        // 更新实例
        inject2OneConf(fileName, disconfCenterFile);
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:17,代码来源:DisconfFileCoreProcessorImpl.java

示例12: getCommonModel

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
@Override
public DisConfCommonModel getCommonModel(String keyName) {

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

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

    return disconfCenterFile.getDisConfCommonModel();
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:17,代码来源:DisconfStoreFileProcessorImpl.java

示例13: inject2Instance

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
@Override
public void inject2Instance(Object object, String fileName) {

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

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

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

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

        // 根据类型设置值
        try {

            //
            // 静态类
            //
            if (object == null) {

                if (keMap.get(fileItem).isStatic()) {
                    LOGGER.debug(fileItem + " is a static field. ");
                    keMap.get(fileItem).setValue4StaticFileItem(keMap.get(fileItem).getValue());
                }

                //
                // 非静态类
                //
            } else {

                LOGGER.debug(fileItem + " is a non-static field. ");

                if (keMap.get(fileItem).getValue() == null) {

                    // 如果仓库值为空,则实例 直接使用默认值
                    Object defaultValue = keMap.get(fileItem).getFieldDefaultValue(object);
                    keMap.get(fileItem).setValue(defaultValue);

                } else {

                    // 如果仓库里的值为非空,则实例使用仓库里的值
                    keMap.get(fileItem).setValue4FileItem(object, keMap.get(fileItem).getValue());
                }
            }

        } catch (Exception e) {
            LOGGER.error("inject2Instance fileName " + fileName + " " + e.toString(), e);
        }
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:68,代码来源:DisconfStoreFileProcessorImpl.java

示例14: inject2Store

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
/**
 *
 */
@Override
public void inject2Store(String fileName, DisconfValue disconfValue) {

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

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

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

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

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

            // 根据类型设置值
            try {

                Object value = keMap.get(fileItem).getFieldValueByType(object);
                keMap.get(fileItem).setValue(value);

            } catch (Exception e) {
                LOGGER.error("inject2Store filename: " + fileName + " " + e.toString(), e);
            }
        }
    }

    // 使用过 XML式配置
    if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {

        if (disconfCenterFile.getSupportFileTypeEnum().equals(SupportFileTypeEnum.PROPERTIES)) {
            // 如果是采用XML进行配置的,则需要利用spring的reload将数据reload到bean里
            ReloadConfigurationMonitor.reload();
        }
        disconfCenterFile.setAdditionalKeyMaps(disconfValue.getFileData());
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:54,代码来源:DisconfStoreFileProcessorImpl.java

示例15: getConfFileMap

import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
public Map<String, DisconfCenterFile> getConfFileMap() {
    return confFileMap;
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:4,代码来源:DisconfCenterStore.java


注:本文中的com.baidu.disconf.client.common.model.DisconfCenterFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。