// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
// 
// 	/** D3 data plugin size. */
// 	public interface D3 {
// 		public final static int SIZE = 40;
// 	}
// 
// 	/** Kafka parameter setting. */
// 	public interface Kafka {
// 		public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// 		public final static int SINGLE_THREAD = 1;
// 		public final static int ACTIVER_INTERVAL = 10000;
// 	}
// 
// 	public interface Mail {
// 		public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// 	}
// 
// 	/** Custom variable separator. */
// 	public interface Separator {
// 		public final static String EIGHT = "________";
// 	}
// 
// 	public interface SessionAlias {
// 		public final static String CLUSTER_ALIAS = "clusterAlias";
// 	}
// 
// }
// 
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
// 
// 	private static final String UTF_16 = "UTF-16";
// 
// 	/**
// 	 * Strings compress to bytes.
// 	 * 
// 	 * @param str
// 	 * @return byte[]
// 	 */
// 	public static byte[] compressToByte(String str) {
// 		return compressToByte(str, UTF_16);
// 	}
// 
// 	/**
// 	 * Strings compress to bytes.
// 	 * 
// 	 * @param str
// 	 * @param encoding
// 	 * @return byte[]
// 	 */
// 	public static byte[] compressToByte(String str, String encoding) {
// 		if (str == null || str.length() == 0) {
// 			return null;
// 		}
// 		ByteArrayOutputStream out = new ByteArrayOutputStream();
// 		GZIPOutputStream gzip;
// 		try {
// 			gzip = new GZIPOutputStream(out);
// 			gzip.write(str.getBytes(encoding));
// 			gzip.close();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 		return out.toByteArray();
// 	}
// }
// 
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/ClusterService.java
// public interface ClusterService {
// 
// 	/** Execute zookeeper comand interface */
// 	public String execute(String clusterAlias, String cmd, String type);
// 
// 	/** Get Kafka & Zookeeper interface. */
// 	public String get(String clusterAlias, String type);
// 
// 	/** Get Zookkeeper status interface. */
// 	public JSONObject status(String clusterAlias);
// 
// 	/** Get multi cluster aliass interface. */
// 	public JSONArray clusterAliass();
// 
// 	/** Checked cluster alias is exist interface. */
// 	public boolean hasClusterAlias(String clusterAlias);
// 
// }


import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
import org.smartloli.kafka.eagle.web.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.smartloli.kafka.eagle.web.controller;





/**
 * Kafka & Zookeeper controller to viewer data.
 * 
 * @author smartloli.
 *
 *         Created by Sep 6, 2016.
 * 
 *         Update by hexiang 20170216
 */
@Controller
public class ClusterController {

// Path: src/main/java/org/smartloli/kafka/eagle/common/util/ConstantUtils.java
// public class ConstantUtils {
// 
// 	/** D3 data plugin size. */
// 	public interface D3 {
// 		public final static int SIZE = 40;
// 	}
// 
// 	/** Kafka parameter setting. */
// 	public interface Kafka {
// 		public final static String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
// 		public final static int SINGLE_THREAD = 1;
// 		public final static int ACTIVER_INTERVAL = 10000;
// 	}
// 
// 	public interface Mail {
// 		public final static String[] ARGS = new String[] { "toAddress", "subject", "content" };
// 	}
// 
// 	/** Custom variable separator. */
// 	public interface Separator {
// 		public final static String EIGHT = "________";
// 	}
// 
// 	public interface SessionAlias {
// 		public final static String CLUSTER_ALIAS = "clusterAlias";
// 	}
// 
// }
// 
// Path: src/main/java/org/smartloli/kafka/eagle/common/util/GzipUtils.java
// public class GzipUtils {
// 
// 	private static final String UTF_16 = "UTF-16";
// 
// 	/**
// 	 * Strings compress to bytes.
// 	 * 
// 	 * @param str
// 	 * @return byte[]
// 	 */
// 	public static byte[] compressToByte(String str) {
// 		return compressToByte(str, UTF_16);
// 	}
// 
// 	/**
// 	 * Strings compress to bytes.
// 	 * 
// 	 * @param str
// 	 * @param encoding
// 	 * @return byte[]
// 	 */
// 	public static byte[] compressToByte(String str, String encoding) {
// 		if (str == null || str.length() == 0) {
// 			return null;
// 		}
// 		ByteArrayOutputStream out = new ByteArrayOutputStream();
// 		GZIPOutputStream gzip;
// 		try {
// 			gzip = new GZIPOutputStream(out);
// 			gzip.write(str.getBytes(encoding));
// 			gzip.close();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 		return out.toByteArray();
// 	}
// }
// 
// Path: src/main/java/org/smartloli/kafka/eagle/web/service/ClusterService.java
// public interface ClusterService {
// 
// 	/** Execute zookeeper comand interface */
// 	public String execute(String clusterAlias, String cmd, String type);
// 
// 	/** Get Kafka & Zookeeper interface. */
// 	public String get(String clusterAlias, String type);
// 
// 	/** Get Zookkeeper status interface. */
// 	public JSONObject status(String clusterAlias);
// 
// 	/** Get multi cluster aliass interface. */
// 	public JSONArray clusterAliass();
// 
// 	/** Checked cluster alias is exist interface. */
// 	public boolean hasClusterAlias(String clusterAlias);
// 
// }


// Path: src/main/java/org/smartloli/kafka/eagle/web/controller/ClusterController.java
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.smartloli.kafka.eagle.common.util.ConstantUtils;
import org.smartloli.kafka.eagle.common.util.GzipUtils;
import org.smartloli.kafka.eagle.web.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.smartloli.kafka.eagle.web.controller;





/**
 * Kafka & Zookeeper controller to viewer data.
 * 
 * @author smartloli.
 *
 *         Created by Sep 6, 2016.
 * 
 *         Update by hexiang 20170216
 */
@Controller
public class ClusterController {

	@Autowired