package main.org.ctrip.ops.sysdev.configs;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class HangoutConfig {

	public static Map parse(String filename) {
		HashMap configs = new HashMap();

		final HashMap kafkaInput1 = new HashMap();
		kafkaInput1.put("topic", "metric_thrift.15s");
		kafkaInput1.put("groupID", "hangout");
		kafkaInput1.put("zk", "192.168.81.156:2181");

		final HashMap kafkaInput2 = new HashMap();
		kafkaInput2.put("topic", "metric_thrift.1m");
		kafkaInput2.put("groupID", "hangout");
		kafkaInput2.put("zk", "192.168.81.156:2181");

		ArrayList<Map> inputs = new ArrayList<Map>() {
			{
				add(new HashMap() {
					{
						put("kafka", kafkaInput1);
					}
				});
				add(new HashMap() {
					{
						put("kafka", kafkaInput2);
					}
				});
			}
		};
		configs.put("inputs", inputs);

		return configs;

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

@@ -53,185 +53,705 @@
 ava.
-util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Apublic class HangoutConfig %7B%0A%0A%09public static Map parse(String filename) %7B%0A%09%09HashMap configs = new HashMap();%0A%0A%09%09
+io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.apache.log4j.Logger;%0Aimport org.yaml.snakeyaml.Yaml;%0A%0Apublic class HangoutConfig %7B%0A%09private static final Logger logger = Logger.getLogger(%22HangoutConfig%22);%0A%0A%09public static Map parse(String filename) %7B%0A%09%09Yaml yaml = new Yaml();%0A%09%09FileInputStream input;%0A%09%09try %7B%0A%09%09%09input = new FileInputStream(new File(filename));%0A%09%09%09Map configs = (Map) yaml.load(input);%0A%09%09%09return configs;%0A%09%09%7D catch (FileNotFoundException e) %7B%0A%09%09%09logger.error(String.format(%22parse %25s failed%22, filename));%0A%09%09%09logger.trace(e.getMessage());%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%09// 
 fina
@@ -783,32 +783,35 @@
 ew HashMap();%0A%09%09
+// 
 kafkaInput1.put(
@@ -839,24 +839,27 @@
 ft.15s%22);%0A%09%09
+// 
 kafkaInput1.
@@ -879,32 +879,35 @@
 , %22hangout%22);%0A%09%09
+// 
 kafkaInput1.put(
@@ -936,19 +936,26 @@
 2181%22);%0A
-%0A
 %09%09
+//%0A%09%09// 
 final Ha
@@ -987,24 +987,27 @@
 ashMap();%0A%09%09
+// 
 kafkaInput2.
@@ -1038,24 +1038,27 @@
 ift.1m%22);%0A%09%09
+// 
 kafkaInput2.
@@ -1086,16 +1086,19 @@
 ut%22);%0A%09%09
+// 
 kafkaInp
@@ -1135,19 +1135,26 @@
 2181%22);%0A
-%0A
 %09%09
+//%0A%09%09// 
 ArrayLis
@@ -1194,23 +1194,26 @@
 %3E() %7B%0A%09%09
-%09
+// 
 %7B%0A%09%09
-%09%09
+// 
 add(new 
@@ -1226,33 +1226,32 @@
 p() %7B%0A%09%09
-%09%09%09
+// 
 %7B%0A%09%09
-%09%09%09%09
+// 
 put(%22
-k
+K
 afka%22, k
@@ -1269,25 +1269,27 @@
 ;%0A%09%09
-%09%09%09
+// 
 %7D%0A%09%09
-%09%09
+// 
 %7D);%0A%09%09
-%09%09
+// 
 add(
@@ -1310,25 +1310,24 @@
 %7B%0A%09%09
-%09%09%09
+// 
 %7B%0A%09%09
-%09%09%09%09
+// 
 put(%22
-k
+K
 afka
@@ -1349,33 +1349,42 @@
 ;%0A%09%09
-%09%09%09
+// 
 %7D%0A%09%09
-%09%09
+// 
 %7D);%0A%09%09
-%09
+// 
 %7D%0A%09%09
+// 
 %7D;%0A%09%09
+// 
 conf
@@ -1413,16 +1413,19 @@
 ts);%0A%0A%09%09
+// 
 return c

use yaml parse