Package com.dianping.cat.core.config

Examples of com.dianping.cat.core.config.Config


  }

  @Override
  public void initialize() throws InitializationException {
    try {
      Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
      String content = config.getContent();

      m_thirdPartyConfig = DefaultSaxParser.parse(content);
      m_configId = config.getId();
    } catch (DalNotFoundException e) {
      try {
        String content = Files.forIO().readFrom(
              this.getClass().getResourceAsStream("/config/default-thirdParty-config.xml"), "utf-8");
        Config config = m_configDao.createLocal();

        config.setName(CONFIG_NAME);
        config.setContent(content);
        m_configDao.insert(config);

        m_thirdPartyConfig = DefaultSaxParser.parse(content);
        m_configId = config.getId();
      } catch (Exception ex) {
        Cat.logError(ex);
      }
    } catch (Exception e) {
      Cat.logError(e);
View Full Code Here


  }

  private boolean storeConfig() {
    synchronized (this) {
      try {
        Config config = m_configDao.createLocal();

        config.setId(m_configId);
        config.setKeyId(m_configId);
        config.setName(CONFIG_NAME);
        config.setContent(m_thirdPartyConfig.toString());
        m_configDao.updateByPK(config, ConfigEntity.UPDATESET_FULL);
      } catch (Exception e) {
        Cat.logError(e);
        return false;
      }
View Full Code Here

  }

  @Override
  public void initialize() throws InitializationException {
    try {
      Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
      String content = config.getContent();

      m_configId = config.getId();
      m_config = DefaultSaxParser.parse(content);
    } catch (DalNotFoundException e) {
      try {
        String content = Files.forIO().readFrom(
              this.getClass().getResourceAsStream("/config/default-web-rule-config.xml"), "utf-8");
        Config config = m_configDao.createLocal();

        config.setName(CONFIG_NAME);
        config.setContent(content);
        m_configDao.insert(config);

        m_configId = config.getId();
        m_config = DefaultSaxParser.parse(content);
      } catch (Exception ex) {
        Cat.logError(ex);
      }
    } catch (Exception e) {
View Full Code Here

  }

  @Override
  public void initialize() {
    try {
      Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
      String content = config.getContent();

      m_configId = config.getId();
      m_aggregation = DefaultSaxParser.parse(content);
      m_modifyTime = config.getModifyDate().getTime();
    } catch (DalNotFoundException e) {
      try {
        String content = Files.forIO().readFrom(
              this.getClass().getResourceAsStream("/config/default-aggregation-config.xml"), "utf-8");
        Config config = m_configDao.createLocal();

        config.setName(CONFIG_NAME);
        config.setContent(content);
        m_configDao.insert(config);
        m_configId = config.getId();
        m_aggregation = DefaultSaxParser.parse(content);
      } catch (Exception ex) {
        Cat.logError(ex);
      }
    } catch (Exception e) {
View Full Code Here

    return m_aggregation.findAggregationRule(key);
  }

  private Aggregation queryAggreation() {
    try {
      Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
      String content = config.getContent();

      return DefaultSaxParser.parse(content);
    } catch (Exception e) {
      Cat.logError(e);
    }
View Full Code Here

  public List<AggregationRule> queryAggregationRules() {
    return new ArrayList<AggregationRule>(m_aggregation.getAggregationRules().values());
  }

  public void refreshAggreationConfig() throws DalException, SAXException, IOException {
    Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
    long modifyTime = config.getModifyDate().getTime();

    synchronized (this) {
      if (modifyTime > m_modifyTime) {
        String content = config.getContent();
        Aggregation aggregation = DefaultSaxParser.parse(content);

        m_aggregation = aggregation;
        m_handler.register(queryAggregationRules());
        m_modifyTime = modifyTime;
View Full Code Here

    m_handler.register(rules);
  }

  private boolean storeConfig() {
    try {
      Config config = m_configDao.createLocal();

      config.setId(m_configId);
      config.setKeyId(m_configId);
      config.setName(CONFIG_NAME);
      config.setContent(m_aggregation.toString());
      m_configDao.updateByPK(config, ConfigEntity.UPDATESET_FULL);
    } catch (Exception e) {
      Cat.logError(e);
      return false;
    }
View Full Code Here

TOP

Related Classes of com.dianping.cat.core.config.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.