package com.doctor.esper.common;

import java.util.ArrayList;
import java.util.List;

import com.espertech.esper.client.EPStatement;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.SafeIterator;

/**
 * @author docotr
 *
 * @time 2015年6月1日 下午4:28:33
 */
public enum EsperUtil {
	;
	public static List<EventBean> get(EPStatement epStatement) {
		List<EventBean> list = new ArrayList<>();
		SafeIterator<EventBean> safeIterator = epStatement.safeIterator();
		try {
			while (safeIterator.hasNext()) {
				list.add(safeIterator.next());
			}
		} catch (Throwable e) {
			safeIterator.close();
			e.printStackTrace();
		}
		return list;
	}
}

@@ -79,16 +79,178 @@
 .List;%0A%0A
+import com.espertech.esper.client.Configuration;%0Aimport com.espertech.esper.client.EPServiceProvider;%0Aimport com.espertech.esper.client.EPServiceProviderManager;%0A
 import c
@@ -822,11 +822,280 @@
 list;%0A%09%7D
+%0A%0A%09public static EPServiceProvider esperConfig(String config) %7B%0A%09%09Configuration configuration = new Configuration();%0A%09%09configuration.configure(EsperUtil.class.getClassLoader().getResource(config));%0A%09%09return EPServiceProviderManager.getDefaultProvider(configuration);%0A%09%7D
 %0A%7D%0A

add public static EPServiceProvider esperConfig(String config)