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


Java DisconfStoreProcessorFactory.getDisconfStoreFileProcessor方法代码示例

本文整理汇总了Java中com.baidu.disconf.client.store.DisconfStoreProcessorFactory.getDisconfStoreFileProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java DisconfStoreProcessorFactory.getDisconfStoreFileProcessor方法的具体用法?Java DisconfStoreProcessorFactory.getDisconfStoreFileProcessor怎么用?Java DisconfStoreProcessorFactory.getDisconfStoreFileProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.baidu.disconf.client.store.DisconfStoreProcessorFactory的用法示例。


在下文中一共展示了DisconfStoreProcessorFactory.getDisconfStoreFileProcessor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getByFile

import com.baidu.disconf.client.store.DisconfStoreProcessorFactory; //导入方法依赖的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

示例2: transformUpdateService

import com.baidu.disconf.client.store.DisconfStoreProcessorFactory; //导入方法依赖的package包/类
/**
 * 第二次扫描<br/>
 * 转换 更新 回调函数,将其写到 仓库中
 */
private static void transformUpdateService(Map<DisconfKey,
        List<IDisconfUpdate>> disconfUpdateServiceInverseIndexMap) {

    DisconfStoreProcessor disconfStoreProcessorFile = DisconfStoreProcessorFactory.getDisconfStoreFileProcessor();
    DisconfStoreProcessor disconfStoreProcessorItem = DisconfStoreProcessorFactory.getDisconfStoreItemProcessor();

    for (DisconfKey disconfKey : disconfUpdateServiceInverseIndexMap.keySet()) {

        //
        //
        //

        try {
            if (disconfKey.getDisConfigTypeEnum().equals(DisConfigTypeEnum.FILE)) {

                if (!disconfStoreProcessorFile.hasThisConf(disconfKey.getKey())) {
                    throw new Exception();
                }

                disconfStoreProcessorFile.addUpdateCallbackList(disconfKey.getKey(),
                        disconfUpdateServiceInverseIndexMap
                                .get(disconfKey));

            } else if (disconfKey.getDisConfigTypeEnum().equals(DisConfigTypeEnum.ITEM)) {

                if (!disconfStoreProcessorItem.hasThisConf(disconfKey.getKey())) {
                    throw new Exception();
                }

                disconfStoreProcessorItem.addUpdateCallbackList(disconfKey.getKey(),
                        disconfUpdateServiceInverseIndexMap
                                .get(disconfKey));
            }

        } catch (Exception e) {
            // 找不到回调对应的配置,这是用户配置 错误了
            StringBuffer sb = new StringBuffer();
            sb.append("cannot find " + disconfKey + "for: ");
            for (IDisconfUpdate serClass : disconfUpdateServiceInverseIndexMap.get(disconfKey)) {
                sb.append(serClass.toString() + "\t");
            }
            LOGGER.error(sb.toString());
        }
    }
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:50,代码来源:ScanDynamicStoreAdapter.java

示例3: decideAccess

import com.baidu.disconf.client.store.DisconfStoreProcessorFactory; //导入方法依赖的package包/类
/**
 * 获取配置文件数据, 只有开启disconf远程才会进行切面
 *
 * @throws Throwable
 */
@Around("anyPublicMethod() && @annotation(disconfFileItem)")
public Object decideAccess(ProceedingJoinPoint pjp, DisconfFileItem disconfFileItem) throws Throwable {

    if (DisClientConfig.getInstance().ENABLE_DISCONF) {

        MethodSignature ms = (MethodSignature) pjp.getSignature();
        Method method = ms.getMethod();

        //
        // 文件名
        //
        Class<?> cls = method.getDeclaringClass();
        DisconfFile disconfFile = cls.getAnnotation(DisconfFile.class);

        //
        // Field名
        //
        Field field = MethodUtils.getFieldFromMethod(method, cls.getDeclaredFields(), DisConfigTypeEnum.FILE);
        if (field != null) {

            //
            // 请求仓库配置数据
            //
            DisconfStoreProcessor disconfStoreProcessor =
                    DisconfStoreProcessorFactory.getDisconfStoreFileProcessor();
            Object ret = disconfStoreProcessor.getConfig(disconfFile.filename(), disconfFileItem.name());
            if (ret != null) {
                LOGGER.debug("using disconf store value: " + disconfFile.filename() + " ("
                        + disconfFileItem.name() +
                        " , " + ret + ")");
                return ret;
            }
        }
    }

    Object rtnOb;

    try {
        // 返回原值
        rtnOb = pjp.proceed();
    } catch (Throwable t) {
        LOGGER.info(t.getMessage());
        throw t;
    }

    return rtnOb;
}
 
开发者ID:knightliao,项目名称:disconf,代码行数:53,代码来源:DisconfAspectJ.java


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