// Path: src/main/java/com/dianping/polestar/EnvironmentConstants.java
// public final class EnvironmentConstants {
// 	public final static Log LOG = LogFactory.getLog(EnvironmentConstants.class);
// 
// 	public final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
// 			"yyyy-MM-dd HH:mm:ss");
// 	public static String DATA_FILE_EXTENSION = ".gz";
// 	public static String WORKING_DIRECTORY_ROOT = "/tmp";
// 	public static int DEFAULT_RESULT_DATA_NUMBER = 500;
// 	public static int MAX_RESULT_DATA_NUMBER = 1000000;
// 	// result data will be stored in this location
// 	public static String HDFS_DATA_ROOT_PATH = "hdfs://10.1.77.86/data/polestar";
// 
// 	// hadoop security
// 	public static String HADOOP_PRINCIPAL = "hadoop@DIANPING.COM";
// 	public static String HADOOP_KEYTAB_FILE = "/home/hadoop/.keytab";
// 
// 	public static String LOCAL_HOST_ADDRESS;
// 
// 	static {
// 		try {
// 			LOCAL_HOST_ADDRESS = InetAddress.getLocalHost().getHostAddress();
// 			LOG.info("local host address: " + LOCAL_HOST_ADDRESS);
// 		} catch (UnknownHostException uhe) {
// 			LOG.error("get local host address failed, " + uhe);
// 		}
// 
// 		InputStream is = ClassUtils.getResourceAsStream("polestar.properties");
// 		Properties pros = new Properties();
// 		try {
// 			pros.load(is);
// 
// 			DATA_FILE_EXTENSION = pros.getProperty("DATA_FILE_EXTENSION",
// 					DATA_FILE_EXTENSION);
// 
// 			WORKING_DIRECTORY_ROOT = pros.getProperty("WORKING_DIRECTORY_ROOT",
// 					WORKING_DIRECTORY_ROOT);
// 
// 			DEFAULT_RESULT_DATA_NUMBER = Integer.valueOf(pros.getProperty(
// 					"DEFAULT_RESULT_DATA_NUMBER",
// 					String.valueOf(DEFAULT_RESULT_DATA_NUMBER)));
// 
// 			MAX_RESULT_DATA_NUMBER = Integer.valueOf(pros.getProperty(
// 					"MAX_RESULT_DATA_NUMBER",
// 					String.valueOf(MAX_RESULT_DATA_NUMBER)));
// 
// 			HDFS_DATA_ROOT_PATH = pros.getProperty("HDFS_DATA_ROOT_PATH",
// 					HDFS_DATA_ROOT_PATH);
// 
// 			HADOOP_PRINCIPAL = pros.getProperty(
// 					pros.getProperty("HADOOP_PRINCIPAL"), HADOOP_PRINCIPAL);
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/dao/QueryDAO.java
// public interface QueryDAO {
// 
// 	public void insertQueryInfo(QueryInfo queryInfo);
// 
// 	public List<QueryInfo> findQueryInfoByUsername(String username);
// 
// 	public void insertQueryProgress(QueryProgress queryProgress);
// 
// 	public QueryProgress findQueryProgressById(String id);
// 
// 	public void insertQueryCancel(QueryCancel qc);
// 
// 	public List<QueryCancel> findQueryCancelWithouHost(String host);
// 
// 	public void deleteQueryCancelById(String id);
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/dao/impl/QueryDAOFactory.java
// public final class QueryDAOFactory {
// 
// 	public static QueryDAO queryDao;
// 
// 	public static QueryDAO getInstance() {
// 		if (queryDao == null) {
// 			synchronized (QueryDAOFactory.class) {
// 				if (queryDao == null) {
// 					AbstractApplicationContext cxt = new ClassPathXmlApplicationContext(
// 							"applicationContext.xml");
// 					queryDao = (QueryDAO) cxt.getBean("queryDaoImpl");
// 				}
// 			}
// 		}
// 		return queryDao;
// 	}
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/domain/QueryProgress.java
// public class QueryProgress {
// 	private String id;
// 	private String progressInfo;
// 
// 	public QueryProgress() {
// 	}
// 
// 	public QueryProgress(String id, String progressInfo) {
// 		this.id = id;
// 		this.progressInfo = progressInfo;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 
// 	public String getProgressInfo() {
// 		return progressInfo;
// 	}
// 
// 	public void setProgressInfo(String progressInfo) {
// 		this.progressInfo = progressInfo;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "QueryProgress [id=" + id + ", progressInfo=" + progressInfo
// 				+ "]";
// 	}
// }


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.dianping.polestar.EnvironmentConstants;
import com.dianping.polestar.store.mysql.dao.QueryDAO;
import com.dianping.polestar.store.mysql.dao.impl.QueryDAOFactory;
import com.dianping.polestar.store.mysql.domain.QueryProgress;
package com.dianping.polestar.jobs;




public class ProcessJob extends AbstractJob {
	public final static Log LOG = LogFactory.getLog(ProcessJob.class);

	private final static int FLUSH_STDERROR_IN_MILLISECONDS = 2000;
	private final static String KRB5CCNAME = "KRB5CCNAME";
	private final static String TICKET_CACHE_EXTENTION = ".ticketcache";
	private final static String SHARK_FILTER_STRING = "spray-io-worker";

// Path: src/main/java/com/dianping/polestar/EnvironmentConstants.java
// public final class EnvironmentConstants {
// 	public final static Log LOG = LogFactory.getLog(EnvironmentConstants.class);
// 
// 	public final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
// 			"yyyy-MM-dd HH:mm:ss");
// 	public static String DATA_FILE_EXTENSION = ".gz";
// 	public static String WORKING_DIRECTORY_ROOT = "/tmp";
// 	public static int DEFAULT_RESULT_DATA_NUMBER = 500;
// 	public static int MAX_RESULT_DATA_NUMBER = 1000000;
// 	// result data will be stored in this location
// 	public static String HDFS_DATA_ROOT_PATH = "hdfs://10.1.77.86/data/polestar";
// 
// 	// hadoop security
// 	public static String HADOOP_PRINCIPAL = "hadoop@DIANPING.COM";
// 	public static String HADOOP_KEYTAB_FILE = "/home/hadoop/.keytab";
// 
// 	public static String LOCAL_HOST_ADDRESS;
// 
// 	static {
// 		try {
// 			LOCAL_HOST_ADDRESS = InetAddress.getLocalHost().getHostAddress();
// 			LOG.info("local host address: " + LOCAL_HOST_ADDRESS);
// 		} catch (UnknownHostException uhe) {
// 			LOG.error("get local host address failed, " + uhe);
// 		}
// 
// 		InputStream is = ClassUtils.getResourceAsStream("polestar.properties");
// 		Properties pros = new Properties();
// 		try {
// 			pros.load(is);
// 
// 			DATA_FILE_EXTENSION = pros.getProperty("DATA_FILE_EXTENSION",
// 					DATA_FILE_EXTENSION);
// 
// 			WORKING_DIRECTORY_ROOT = pros.getProperty("WORKING_DIRECTORY_ROOT",
// 					WORKING_DIRECTORY_ROOT);
// 
// 			DEFAULT_RESULT_DATA_NUMBER = Integer.valueOf(pros.getProperty(
// 					"DEFAULT_RESULT_DATA_NUMBER",
// 					String.valueOf(DEFAULT_RESULT_DATA_NUMBER)));
// 
// 			MAX_RESULT_DATA_NUMBER = Integer.valueOf(pros.getProperty(
// 					"MAX_RESULT_DATA_NUMBER",
// 					String.valueOf(MAX_RESULT_DATA_NUMBER)));
// 
// 			HDFS_DATA_ROOT_PATH = pros.getProperty("HDFS_DATA_ROOT_PATH",
// 					HDFS_DATA_ROOT_PATH);
// 
// 			HADOOP_PRINCIPAL = pros.getProperty(
// 					pros.getProperty("HADOOP_PRINCIPAL"), HADOOP_PRINCIPAL);
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/dao/QueryDAO.java
// public interface QueryDAO {
// 
// 	public void insertQueryInfo(QueryInfo queryInfo);
// 
// 	public List<QueryInfo> findQueryInfoByUsername(String username);
// 
// 	public void insertQueryProgress(QueryProgress queryProgress);
// 
// 	public QueryProgress findQueryProgressById(String id);
// 
// 	public void insertQueryCancel(QueryCancel qc);
// 
// 	public List<QueryCancel> findQueryCancelWithouHost(String host);
// 
// 	public void deleteQueryCancelById(String id);
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/dao/impl/QueryDAOFactory.java
// public final class QueryDAOFactory {
// 
// 	public static QueryDAO queryDao;
// 
// 	public static QueryDAO getInstance() {
// 		if (queryDao == null) {
// 			synchronized (QueryDAOFactory.class) {
// 				if (queryDao == null) {
// 					AbstractApplicationContext cxt = new ClassPathXmlApplicationContext(
// 							"applicationContext.xml");
// 					queryDao = (QueryDAO) cxt.getBean("queryDaoImpl");
// 				}
// 			}
// 		}
// 		return queryDao;
// 	}
// }
// 
// Path: src/main/java/com/dianping/polestar/store/mysql/domain/QueryProgress.java
// public class QueryProgress {
// 	private String id;
// 	private String progressInfo;
// 
// 	public QueryProgress() {
// 	}
// 
// 	public QueryProgress(String id, String progressInfo) {
// 		this.id = id;
// 		this.progressInfo = progressInfo;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 
// 	public String getProgressInfo() {
// 		return progressInfo;
// 	}
// 
// 	public void setProgressInfo(String progressInfo) {
// 		this.progressInfo = progressInfo;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "QueryProgress [id=" + id + ", progressInfo=" + progressInfo
// 				+ "]";
// 	}
// }


// Path: src/main/java/com/dianping/polestar/jobs/ProcessJob.java
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.dianping.polestar.EnvironmentConstants;
import com.dianping.polestar.store.mysql.dao.QueryDAO;
import com.dianping.polestar.store.mysql.dao.impl.QueryDAOFactory;
import com.dianping.polestar.store.mysql.domain.QueryProgress;

package com.dianping.polestar.jobs;




public class ProcessJob extends AbstractJob {
	public final static Log LOG = LogFactory.getLog(ProcessJob.class);

	private final static int FLUSH_STDERROR_IN_MILLISECONDS = 2000;
	private final static String KRB5CCNAME = "KRB5CCNAME";
	private final static String TICKET_CACHE_EXTENTION = ".ticketcache";
	private final static String SHARK_FILTER_STRING = "spray-io-worker";

	private final QueryDAO queryDao = QueryDAOFactory.getInstance();