@Override public void initialize() throws InitializationException { try { Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL); String content = config.getContent(); m_config = DefaultSaxParser.parse(content); m_configId = config.getId(); } catch (DalNotFoundException e) { try { String content = Files.forIO() .readFrom( this.getClass().getResourceAsStream("/config/default-metric-group-config.xml"), "utf-8"); Config config = m_configDao.createLocal(); config.setName(CONFIG_NAME); config.setContent(content); m_configDao.insert(config); m_config = DefaultSaxParser.parse(content); m_configId = config.getId(); } catch (Exception ex) { Cat.logError(ex); } } catch (Exception e) { Cat.logError(e); } if (m_config == null) { m_config = new MetricGroupConfig(); } }
public boolean insert(String xml) { try { m_config = DefaultSaxParser.parse(xml); return storeConfig(); } catch (Exception e) { Cat.logError(e); return false; } }