private void initConfigure(Properties properties) { String applyChildren = (String) properties.get("applyChildren"); if (applyChildren != null) { conf.applyChildren = Boolean.parseBoolean(applyChildren); } else { conf.applyChildren = false; } String childrenKeys = (String) properties.get("childrenKeys"); if (childrenKeys != null) { for (String key : childrenKeys.split(",")) { conf.childrenKeys.add(key); } } String applyLayer = (String) properties.get("applyLayer"); if (applyLayer != null) { conf.applyLayer = Boolean.parseBoolean(applyLayer); } else { conf.applyLayer = false; } String layer = (String) properties.get("layer"); if (layer != null && layer.length() > 0) { conf.layer = Integer.parseInt(layer); } }
private void save() throws JDependException { FileOutputStream os = null; Properties properties = new Properties(); try { properties.put("applyChildren", String.valueOf(conf.applyChildren)); properties.put("childrenKeys", String.valueOf(conf.getChildrenKeys())); properties.put("applyLayer", String.valueOf(conf.applyLayer)); if (conf.layer != null) { properties.put("layer", String.valueOf(conf.layer)); } else { properties.put("layer", ""); } File file = getDefaultPropertyFile(); if (!file.exists()) { file.createNewFile(); } os = new FileOutputStream(file); properties.store(os, "UTF-8"); } catch (Exception e) { e.printStackTrace(); LogUtil.getInstance(ComponentJudgeRepo.class).systemError("保存componentJudge配置信息出错。"); throw new JDependException("保存componentJudge配置信息出错。", e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } }