Package org.ini4j.Profile

Examples of org.ini4j.Profile.Section


       
    Set<String> sections = ini.keySet();
    for (String sectionName : sections) {
      StringBuilder strbuilder = new StringBuilder();
      Map<String, String> params = new HashMap<String, String>();     
      Section currentsection = ini.get(sectionName);
      Set<Entry<String,String>> entrySet = currentsection.entrySet();
      String currentContent = contentUnparsed;
      for (Entry<String,String> entry : entrySet) {
        currentContent = currentContent.replace("${"+entry.getKey()+"}", entry.getValue());
      }
      strbuilder.append(currentContent);
View Full Code Here


 
    if (sect != null)
    {
      for (String pipename : sect.childrenNames())
      {
        Section pipe = sect.getChild(pipename);
        if (pipe.containsKey(OPT_DATA_STRING))
          data.put(pipename, pipe.get(OPT_DATA_STRING).getBytes());
        else if (pipe.containsKey(OPT_DATA_PATH))
          data.put(pipename, IOUtils.toByteArray(getInputStream(pipe.get(OPT_DATA_PATH), context)));
        else
          throw new Exception("No data source.");
      }
    }
   
View Full Code Here

        final ConcurrentHashMap<String/* topic */, TopicConfig> newTopicConfigMap =
                new ConcurrentHashMap<String, TopicConfig>();
        for (final String name : set) {
            // Is it a topic section?
            if (name != null && name.startsWith("topic=")) {
                final Section section = conf.get(name);
                final String topic = name.substring("topic=".length());

                final TopicConfig topicConfig = new TopicConfig(topic, this);
                Set<String> validKeySet = topicConfig.getFieldSet();
                Set<String> allKeySet = section.keySet();
                Set<String> filterClassKeys = new HashSet<String>();
                Set<String> configKeySet = new HashSet<String>();
                for (String key : allKeySet) {
                    if (key.startsWith("group.")) {
                        filterClassKeys.add(key);
                    }
                    else {
                        configKeySet.add(key);
                    }
                }
                this.checkConfigKeys(configKeySet, validKeySet);

                if (StringUtils.isNotBlank(section.get("numPartitions"))) {
                    topicConfig.setNumPartitions(this.getInt(section, "numPartitions"));
                }
                if (StringUtils.isNotBlank(section.get("stat"))) {
                    topicConfig.setStat(Boolean.valueOf(section.get("stat")));
                }
                if (StringUtils.isNotBlank(section.get("deletePolicy"))) {
                    topicConfig.setDeletePolicy(section.get("deletePolicy"));
                }

                if (StringUtils.isNotBlank(section.get("deleteWhen"))) {
                    topicConfig.setDeleteWhen(section.get("deleteWhen"));
                }

                if (StringUtils.isNotBlank(section.get("dataPath"))) {
                    topicConfig.setDataPath(section.get("dataPath"));
                }

                if (StringUtils.isNotBlank(section.get("unflushInterval"))) {
                    topicConfig.setUnflushInterval(this.getInt(section, "unflushInterval"));
                }

                if (StringUtils.isNotBlank(section.get("unflushThreshold"))) {
                    topicConfig.setUnflushThreshold(this.getInt(section, "unflushThreshold"));
                }
                // added by dennis,2012-05-19
                if (!StringUtils.isBlank(section.get("acceptSubscribe"))) {
                    topicConfig.setAcceptSubscribe(this.getBoolean(section, "acceptSubscribe"));
                }
                if (!StringUtils.isBlank(section.get("acceptPublish"))) {
                    topicConfig.setAcceptPublish(this.getBoolean(section, "acceptPublish"));
                }

                // Added filter class
                for (String key : filterClassKeys) {
                    String consumerGroup = key.substring(6);
                    if (!StringUtils.isBlank(section.get(key))) {
                        topicConfig.addFilterClass(consumerGroup, section.get(key));
                    }
                }

                // this.topicPartitions.put(topic, numPartitions);
                newTopicConfigMap.put(topic, topicConfig);
View Full Code Here

        this.propertyChangeSupport.firePropertyChange("topicConfigMap", null, null);
    }


    private void populateZookeeperConfig(final Ini conf) {
        final Section zkConf = conf.get("zookeeper");
        Set<String> configKeySet = zkConf.keySet();
        Set<String> validKeySet = new ZKConfig().getFieldSet();
        validKeySet.addAll(this.getFieldSet());
        this.checkConfigKeys(configKeySet, validKeySet);
        if (!StringUtils.isBlank(zkConf.get("zk.zkConnect"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkConnect = zkConf.get("zk.zkConnect");
        }
        if (!StringUtils.isBlank(zkConf.get("zk.zkSessionTimeoutMs"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkSessionTimeoutMs = this.getInt(zkConf, "zk.zkSessionTimeoutMs");
        }
        if (!StringUtils.isBlank(zkConf.get("zk.zkConnectionTimeoutMs"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkConnectionTimeoutMs = this.getInt(zkConf, "zk.zkConnectionTimeoutMs");
        }
        if (!StringUtils.isBlank(zkConf.get("zk.zkSyncTimeMs"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkSyncTimeMs = this.getInt(zkConf, "zk.zkSyncTimeMs");
        }
        if (!StringUtils.isBlank(zkConf.get("zk.zkEnable"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkEnable = this.getBoolean(zkConf, "zk.zkEnable");
        }
        if (!StringUtils.isBlank(zkConf.get("zk.zkRoot"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkRoot = zkConf.get("zk.zkRoot");
        }
    }
View Full Code Here

        }
    }


    private void populateSystemConf(final Ini conf) {
        final Section sysConf = conf.get("system");

        Set<String> configKeySet = sysConf.keySet();
        Set<String> validKeySet = this.getFieldSet();
        this.checkConfigKeys(configKeySet, validKeySet);

        this.brokerId = this.getInt(sysConf, "brokerId");
        this.serverPort = this.getInt(sysConf, "serverPort", 8123);
        this.dashboardHttpPort = this.getInt(sysConf, "dashboardHttpPort", 8120);
        if (!StringUtils.isBlank(sysConf.get("dataPath"))) {
            this.setDataPath(sysConf.get("dataPath"));
        }
        if (!StringUtils.isBlank(sysConf.get("appClassPath"))) {
            this.appClassPath = sysConf.get("appClassPath");
        }
        if (!StringUtils.isBlank(sysConf.get("dataLogPath"))) {
            this.dataLogPath = sysConf.get("dataLogPath");
        }
        if (!StringUtils.isBlank(sysConf.get("hostName"))) {
            this.hostName = sysConf.get("hostName");
        }
        this.numPartitions = this.getInt(sysConf, "numPartitions");
        this.unflushThreshold = this.getInt(sysConf, "unflushThreshold");
        this.unflushInterval = this.getInt(sysConf, "unflushInterval");
        this.maxSegmentSize = this.getInt(sysConf, "maxSegmentSize");
        this.maxTransferSize = this.getInt(sysConf, "maxTransferSize");
        if (!StringUtils.isBlank(sysConf.get("getProcessThreadCount"))) {
            this.getProcessThreadCount = this.getInt(sysConf, "getProcessThreadCount");
        }
        if (!StringUtils.isBlank(sysConf.get("putProcessThreadCount"))) {
            this.putProcessThreadCount = this.getInt(sysConf, "putProcessThreadCount");
        }
        if (!StringUtils.isBlank(sysConf.get("deletePolicy"))) {
            this.deletePolicy = sysConf.get("deletePolicy");
        }
        if (!StringUtils.isBlank(sysConf.get("deleteWhen"))) {
            this.deleteWhen = sysConf.get("deleteWhen");
        }
        if (!StringUtils.isBlank(sysConf.get("quartzThreadCount"))) {
            this.quartzThreadCount = this.getInt(sysConf, "quartzThreadCount");
        }
        if (!StringUtils.isBlank(sysConf.get("maxCheckpoints"))) {
            this.maxCheckpoints = this.getInt(sysConf, "maxCheckpoints");
        }
        if (!StringUtils.isBlank(sysConf.get("checkpointInterval"))) {
            this.checkpointInterval = this.getLong(sysConf, "checkpointInterval");
        }
        if (!StringUtils.isBlank(sysConf.get("maxTxTimeoutTimerCapacity"))) {
            this.maxTxTimeoutTimerCapacity = this.getInt(sysConf, "maxTxTimeoutTimerCapacity");
        }
        if (!StringUtils.isBlank(sysConf.get("flushTxLogAtCommit"))) {
            this.flushTxLogAtCommit = this.getInt(sysConf, "flushTxLogAtCommit");
        }
        if (!StringUtils.isBlank(sysConf.get("maxTxTimeoutInSeconds"))) {
            this.maxTxTimeoutInSeconds = this.getInt(sysConf, "maxTxTimeoutInSeconds");
        }

        // added by dennis,2012-05-19
        if (!StringUtils.isBlank(sysConf.get("acceptSubscribe"))) {
            this.acceptSubscribe = this.getBoolean(sysConf, "acceptSubscribe");
        }
        if (!StringUtils.isBlank(sysConf.get("acceptPublish"))) {
            this.acceptPublish = this.getBoolean(sysConf, "acceptPublish");
        }
        // added by dennis,2012-06-21
        if (!StringUtils.isBlank(sysConf.get("stat"))) {
            this.stat = this.getBoolean(sysConf, "stat");
        }
        if (!StringUtils.isBlank(sysConf.get("updateConsumerOffsets"))) {
            this.updateConsumerOffsets = this.getBoolean(sysConf, "updateConsumerOffsets");
        }
        if (!StringUtils.isBlank(sysConf.get("loadMessageStoresInParallel"))) {
            this.loadMessageStoresInParallel = this.getBoolean(sysConf, "loadMessageStoresInParallel");
        }
    }
View Full Code Here

    this.populateFilterTopicConfig(iniConfig);
  }


  private void populateFilterTopicConfig(Ini iniConfig) {
    final Section filterTopicConf = iniConfig.get("filterTopic");
    if(!StringUtils.isBlank(filterTopicConf.get("topic"))){
      this.filterTopicList.addAll(Arrays.asList(filterTopicConf.get("topic").split(",")));
    }
  }
View Full Code Here

  private void populateGroupConfig(Ini iniConfig) {
    final Set<String> set = iniConfig.keySet();
    List<Group> newGroupList = new LinkedList<Group>();
        for (final String name : set) {
            if (name != null && name.startsWith("group=")) {
              final Section section = iniConfig.get(name);
              Group group = new Group();
              group.setGroup(name.substring("group=".length()));
                group.setMobileList(Arrays.asList(section.get("mobile").split(",")));
                group.setTopicList(Arrays.asList(section.get("topic").split(",")));
                group.setWwList(Arrays.asList(section.get("ww").split(",")));
                if(!StringUtils.isBlank(section.get("ignoreTopic"))){
                  group.setIgnoreTopicList(Arrays.asList(section.get("ignoreTopic").split(",")))
                }
                newGroupList.add(group);
            }
        }
        if(!this.groupList.equals(newGroupList)){
View Full Code Here

    final Set<String> set = iniConfig.keySet();
    List<String> newServerUrlList = new LinkedList<String>();
    List<MetaServer> newMetaServerList = new LinkedList<MetaServer>();
        for (final String name : set) {
            if (name != null && name.startsWith("server=")) {
              final Section section = iniConfig.get(name);
              MetaServer metaServer = new MetaServer();
              metaServer.setUrl(name.substring("server=".length()));
              newServerUrlList.add(metaServer.getUrl());
              metaServer.setCluster(section.get("cluster"));
              metaServer.setHostIp(section.get("hostIp"));
              metaServer.setHostName(section.get("hostName"));
              metaServer.setJmxPort(this.getInt(section, "jmxPort"));
              metaServer.setServerPort(this.getInt(section,"serverPort"));
              metaServer.setStatus(this.getInt(section,"status"));
              metaServer.setBrokeId(this.getInt(section,"brokeId"));
              newMetaServerList.add(metaServer);
View Full Code Here

       
  }


  private void populateSystemConfig(Ini iniConfig) {
    final Section sysConf = iniConfig.get("system");
   
    if (!StringUtils.isBlank(sysConf.get("wangwangList"))) {
            this.wangwangList = Arrays.asList(StringUtils.split(sysConf.get("wangwangList"), ","));
        }else{
          this.wangwangList = Collections.emptyList();
        }

        if (!StringUtils.isBlank(sysConf.get("mobileList"))) {
            this.mobileList = Arrays.asList(StringUtils.split(sysConf.get("mobileList"), ","));
        }else{
          this.mobileList = Collections.emptyList();
        }

        if (!StringUtils.isBlank(sysConf.get("sendTimeout"))) {
            this.sendTimeout = Integer.parseInt(sysConf.get("sendTimeout"));
        }

        if (!StringUtils.isBlank(sysConf.get("receiveTimeout"))) {
            this.receiveTimeout = Integer.parseInt(sysConf.get("receiveTimeout"));
        }

        if (!StringUtils.isBlank(sysConf.get("realtimePutFailThreshold"))) {
            this.realtimePutFailThreshold = Integer.parseInt(sysConf.get("realtimePutFailThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("probeInterval"))) {
            this.probeInterval = Integer.parseInt(sysConf.get("probeInterval"));
        }

        if (!StringUtils.isBlank(sysConf.get("msgProbeCycleTime"))) {
            this.msgProbeCycleTime = Integer.parseInt(sysConf.get("msgProbeCycleTime"));
        }

        if (!StringUtils.isBlank(sysConf.get("statsProbCycleTime"))) {
            this.statsProbCycleTime = Integer.parseInt(sysConf.get("statsProbCycleTime"));
        }

        if (!StringUtils.isBlank(sysConf.get("offsetProbCycleTime"))) {
            this.offsetProbCycleTime = Integer.parseInt(sysConf.get("offsetProbCycleTime"));
        }

        if (!StringUtils.isBlank(sysConf.get("systemProbCycleTime"))) {
            this.systemProbCycleTime = Integer.parseInt(sysConf.get("systemProbCycleTime"));
        }

        if (!StringUtils.isBlank(sysConf.get("monitorPoolCoreSize"))) {
            this.monitorPoolCoreSize = Integer.parseInt(sysConf.get("monitorPoolCoreSize"));
        }
        if (!StringUtils.isBlank(sysConf.get("offsetNoChangeTimeThreshold"))) {
            this.offsetNoChangeTimeThreshold = Integer.parseInt(sysConf.get("offsetNoChangeTimeThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("cpuLoadThreshold"))) {
            this.cpuLoadThreshold = Integer.parseInt(sysConf.get("cpuLoadThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("diskUsedThreshold"))) {
            this.diskUsedThreshold = Integer.parseInt(sysConf.get("diskUsedThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("metaConnectionPerIpThreshold"))) {
            this.metaConnectionPerIpThreshold = Integer.parseInt(sysConf.get("metaConnectionPerIpThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("metaConnectionThreshold"))) {
            this.metaConnectionThreshold = Integer.parseInt(sysConf.get("metaConnectionThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("preparedTransactionCountThreshold"))) {
            this.preparedTransactionCountThreshold =
                    Integer.parseInt(sysConf.get("preparedTransactionCountThreshold"));
        }

        if (!StringUtils.isBlank(sysConf.get("jmxPort"))) {
            this.jmxPort = Integer.parseInt(sysConf.get("jmxPort"));
        }

        if (!StringUtils.isBlank(sysConf.get("loginUser"))) {
            this.loginUser = sysConf.get("loginUser");
        }

        if (!StringUtils.isBlank(sysConf.get("loginPassword"))) {
            this.loginPassword = sysConf.get("loginPassword");
        }
        if (!StringUtils.isBlank(sysConf.get("offsetMaxGap"))) {
            this.offsetMaxGap = Integer.parseInt(sysConf.get("offsetMaxGap"));
        }
        if (!StringUtils.isBlank(sysConf.get("zkMaxOverStep"))) {
            this.zkMaxOverStep = Integer.parseInt(sysConf.get("zkMaxOverStep"));
        }

        if (!StringUtils.isBlank(sysConf.get("topicOffsetMaxGap"))) {
            Map<String, Integer> newTopicOffsetMaxGapMap = new HashMap<String, Integer>();
            String topicOffsetMaxGap = sysConf.get("topicOffsetMaxGap");
            String[] topicOffsetMaxGapArr = topicOffsetMaxGap.split(",");
            for (int i = 0; i < topicOffsetMaxGapArr.length; i++) {
        String offsetItem = topicOffsetMaxGapArr[i];
        String[] offsetItemArr = offsetItem.split(":");
        newTopicOffsetMaxGapMap.put(offsetItemArr[0], Integer.parseInt(offsetItemArr[1]));
View Full Code Here

TOP

Related Classes of org.ini4j.Profile.Section

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.