private void initFromFile()

in appactive-java-client/client-channel/src/main/java/io/appactive/channel/file/FilePathUtil.java [111:140]


    private void initFromFile() throws Exception {
        String filePathName = JvmPropertyUtil.getJvmAndEnvValue(RulePropertyConstant.PROPERTY_HEADER+".path");
        if (StringUtils.isBlank(filePathName)){
            filePathName = ALL_RULE_DEFINE_PATH;
        }

        ConverterInterface<String, Map<String,String>> converterInterface = source -> JSON.parseObject(source,
                new TypeReference<Map<String,String>>() {});
        FileReadDataSource<Map<String,String>> fileReadDataSource = new FileReadDataSource<>(filePathName,
                FileConstant.DEFAULT_CHARSET, FileConstant.DEFAULT_BUF_SIZE, converterInterface);
        Map<String, String> pathMap = fileReadDataSource.read();
        if (machineRulePath == null) {
            machineRulePath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".machineRulePath");
        }
        if (dataScopeRuleDirectoryPath == null) {
            dataScopeRuleDirectoryPath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".dataScopeRuleDirectoryPath");
        }
        if (forbiddenRulePath == null) {
            forbiddenRulePath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".forbiddenRulePath");
        }
        if (trafficRouteRulePath == null) {
            trafficRouteRulePath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".trafficRulePath");
        }
        if (transformerRulePath == null) {
            transformerRulePath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".transformerRulePath");
        }
        if (idSourceRulePath == null) {
            idSourceRulePath = pathMap.get(RulePropertyConstant.PROPERTY_HEADER + ".idSourceRulePath");
        }
    }