public static ConfigReadDataSource getConfigReadDataSource()

in appactive-java-client/client-channel/src/main/java/io/appactive/channel/ClientChannelService.java [65:88]


    public static <T> ConfigReadDataSource<T> getConfigReadDataSource(String uri, ConverterInterface<String, T> ruleConverterInterface) {
        if (StringUtils.isBlank(uri)) {
            throw ExceptionFactory.makeFault("uri is empty");
        }

        ConfigReadDataSource<T> configReadDataSource;
        switch (CHANNEL_TYPE_ENUM){
            case FILE:
                configReadDataSource = new FileReadDataSource<>(uri,
                        FileConstant.DEFAULT_CHARSET, FileConstant.DEFAULT_BUF_SIZE,
                        ruleConverterInterface);
                break;
            case NACOS:
                PathUtil pathUtil = getPathUtil();
                Properties extra = pathUtil.getExtras();
                configReadDataSource = new NacosReadDataSource<>(pathUtil.getConfigServerAddress(), uri,
                        extra.getProperty(RulePropertyConstant.GROUP_ID), extra.getProperty(RulePropertyConstant.NAMESPACE_ID),
                        ruleConverterInterface);
                break;
            default:
                throw ExceptionFactory.makeFault("unsupported channel:{}", CHANNEL_TYPE_ENUM.name());
        }
        return configReadDataSource;
    }