Search in sources :

Example 1 with Property

use of com.actiontech.dble.config.loader.zkprocess.entity.Property in project dble by actiontech.

the class RulesxmlTozkLoader method readMapFileAddFunction.

/**
 * readMapFileAddFunction
 *
 * @param functionList
 * @Created 2016/9/18
 */
private void readMapFileAddFunction(List<Function> functionList) {
    List<Property> tempData = new ArrayList<>();
    for (Function function : functionList) {
        List<Property> proList = function.getProperty();
        if (null != proList && !proList.isEmpty()) {
            for (Property property : proList) {
                // if mapfile,read and save to json
                if (ParseParamEnum.ZK_PATH_RULE_MAPFILE_NAME.getKey().equals(property.getName())) {
                    Property mapFilePro = new Property();
                    mapFilePro.setName(property.getValue());
                    try {
                        mapFilePro.setValue(ConfFileRWUtils.readFile(property.getValue()));
                        tempData.add(mapFilePro);
                    } catch (IOException e) {
                        LOGGER.warn(AlarmCode.CORE_ZK_WARN + "RulesxmlTozkLoader readMapFile IOException", e);
                    }
                }
            }
            proList.addAll(tempData);
            tempData.clear();
        }
    }
}
Also used : Function(com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Property(com.actiontech.dble.config.loader.zkprocess.entity.Property)

Example 2 with Property

use of com.actiontech.dble.config.loader.zkprocess.entity.Property in project dble by actiontech.

the class UXmlRuleLoader method writeMapFileAddFunction.

/**
 * writeMapFileAddFunction
 *
 * @param functionList
 * @Created 2016/9/18
 */
private void writeMapFileAddFunction(List<Function> functionList) {
    List<Property> tempData = new ArrayList<>();
    List<Property> writeData = new ArrayList<>();
    for (Function function : functionList) {
        List<Property> proList = function.getProperty();
        if (null != proList && !proList.isEmpty()) {
            for (Property property : proList) {
                if (ParseParamEnum.ZK_PATH_RULE_MAPFILE_NAME.getKey().equals(property.getName())) {
                    tempData.add(property);
                }
            }
            if (!tempData.isEmpty()) {
                for (Property property : tempData) {
                    for (Property prozkdownload : proList) {
                        if (property.getValue().equals(prozkdownload.getName())) {
                            writeData.add(prozkdownload);
                        }
                    }
                }
            }
            if (!writeData.isEmpty()) {
                for (Property writeMsg : writeData) {
                    try {
                        ConfFileRWUtils.writeFile(writeMsg.getName(), writeMsg.getValue());
                    } catch (IOException e) {
                        LOGGER.warn(AlarmCode.CORE_ZK_WARN + "RuleszkToxmlLoader write File IOException", e);
                    }
                }
            }
            proList.removeAll(writeData);
            tempData.clear();
            writeData.clear();
        }
    }
}
Also used : Function(com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Property(com.actiontech.dble.config.loader.zkprocess.entity.Property)

Example 3 with Property

use of com.actiontech.dble.config.loader.zkprocess.entity.Property in project dble by actiontech.

the class UXmlRuleLoader method readMapFileAddFunction.

/**
 * readMapFileAddFunction
 *
 * @param functionList
 * @Created 2016/9/18
 */
private void readMapFileAddFunction(List<Function> functionList) {
    List<Property> tempData = new ArrayList<>();
    for (Function function : functionList) {
        List<Property> proList = function.getProperty();
        if (null != proList && !proList.isEmpty()) {
            for (Property property : proList) {
                // if mapfile,read and save to json
                if (ParseParamEnum.ZK_PATH_RULE_MAPFILE_NAME.getKey().equals(property.getName())) {
                    Property mapFilePro = new Property();
                    mapFilePro.setName(property.getValue());
                    try {
                        mapFilePro.setValue(ConfFileRWUtils.readFile(property.getValue()));
                        tempData.add(mapFilePro);
                    } catch (IOException e) {
                        LOGGER.warn(AlarmCode.CORE_ZK_WARN + "RulesxmlTozkLoader readMapFile IOException", e);
                    }
                }
            }
            proList.addAll(tempData);
            tempData.clear();
        }
    }
}
Also used : Function(com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Property(com.actiontech.dble.config.loader.zkprocess.entity.Property)

Example 4 with Property

use of com.actiontech.dble.config.loader.zkprocess.entity.Property in project dble by actiontech.

the class RuleszkToxmlLoader method writeMapFileAddFunction.

/**
 * writeMapFileAddFunction
 *
 * @param functionList
 * @Created 2016/9/18
 */
private void writeMapFileAddFunction(List<Function> functionList) {
    List<Property> tempData = new ArrayList<>();
    List<Property> writeData = new ArrayList<>();
    for (Function function : functionList) {
        List<Property> proList = function.getProperty();
        if (null != proList && !proList.isEmpty()) {
            for (Property property : proList) {
                if (ParseParamEnum.ZK_PATH_RULE_MAPFILE_NAME.getKey().equals(property.getName())) {
                    tempData.add(property);
                }
            }
            if (!tempData.isEmpty()) {
                for (Property property : tempData) {
                    for (Property prozkdownload : proList) {
                        if (property.getValue().equals(prozkdownload.getName())) {
                            writeData.add(prozkdownload);
                        }
                    }
                }
            }
            if (!writeData.isEmpty()) {
                for (Property writeMsg : writeData) {
                    try {
                        ConfFileRWUtils.writeFile(writeMsg.getName(), writeMsg.getValue());
                    } catch (IOException e) {
                        LOGGER.warn(AlarmCode.CORE_ZK_WARN + "RuleszkToxmlLoader write File IOException", e);
                    }
                }
            }
            proList.removeAll(writeData);
            tempData.clear();
            writeData.clear();
        }
    }
}
Also used : Function(com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Property(com.actiontech.dble.config.loader.zkprocess.entity.Property)

Aggregations

Property (com.actiontech.dble.config.loader.zkprocess.entity.Property)4 Function (com.actiontech.dble.config.loader.zkprocess.entity.rule.function.Function)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4