// Path: reference/src/main/java/me/doubledutch/stroom/client/StreamConnection.java
// public interface StreamConnection{
// 	public final static int LINEAR=0;
// 	public final static int SYNC=1;
// 	public final static int FLUSH=2;
// 	public final static int NONE=3;
// 
// 	public List<String> get(long index,long endIndex) throws IOException;
// 	public String get(long index) throws IOException;
// 	public String getLast() throws IOException;
// 	public long getCount() throws IOException;
// 	
// 	public long append(JSONObject data) throws IOException,JSONException;
// 	public long append(String data) throws IOException,JSONException;
// 	public List<Long> append(List<String> data) throws IOException,JSONException;
// 	
// 	public long append(JSONObject data,int hint) throws IOException,JSONException;
// 	public long append(String data,int hint) throws IOException,JSONException;
// 	public List<Long> append(List<String> data,int hint) throws IOException,JSONException;
// 
// 	public void truncate(long index) throws IOException;
// }


import org.json.*;
import java.io.*;
import java.net.*;
import java.util.*;
import me.doubledutch.stroom.streams.*;
import me.doubledutch.stroom.client.StreamConnection;
import javax.script.*;
import me.doubledutch.stroom.perf.*;
package me.doubledutch.stroom;



public abstract class Service implements Runnable{
	public static int HTTP=0;
	public static int QUERY=1;
	public static int JAVASCRIPT=2;
	public static int SAMPLE=3;

	public int type=HTTP;

	public String url=null;

	private int WAIT_TIME=1000;
	private int BATCH_SIZE=1000;
	private int BATCH_TIMEOUT=10*1000;
	public long index=-1;

	public static int ERR_IGNORE=0;
	public static int ERR_RETRY=1;
	public static int ERR_HALT=2;
	private int errorStrategy=ERR_IGNORE;
	private String lastError=null;


	private Map<String,MockStreamConnection> mockMap=new HashMap<String,MockStreamConnection>();
	private StreamHandler streamHandler=null;

	private boolean isRunning=false;
	private boolean shouldBeRunning=false;
	private Thread thread=null;
	private boolean isDisabled=false;

	private String id;

	private String script=null;

	public ScriptEngine jsEngine;
	public Invocable jsInvocable;
	private JSONObject config;

	private BatchMetric lastMetric=null;

// Path: reference/src/main/java/me/doubledutch/stroom/client/StreamConnection.java
// public interface StreamConnection{
// 	public final static int LINEAR=0;
// 	public final static int SYNC=1;
// 	public final static int FLUSH=2;
// 	public final static int NONE=3;
// 
// 	public List<String> get(long index,long endIndex) throws IOException;
// 	public String get(long index) throws IOException;
// 	public String getLast() throws IOException;
// 	public long getCount() throws IOException;
// 	
// 	public long append(JSONObject data) throws IOException,JSONException;
// 	public long append(String data) throws IOException,JSONException;
// 	public List<Long> append(List<String> data) throws IOException,JSONException;
// 	
// 	public long append(JSONObject data,int hint) throws IOException,JSONException;
// 	public long append(String data,int hint) throws IOException,JSONException;
// 	public List<Long> append(List<String> data,int hint) throws IOException,JSONException;
// 
// 	public void truncate(long index) throws IOException;
// }


// Path: reference/src/main/java/me/doubledutch/stroom/Service.java
import org.json.*;
import java.io.*;
import java.net.*;
import java.util.*;
import me.doubledutch.stroom.streams.*;
import me.doubledutch.stroom.client.StreamConnection;
import javax.script.*;
import me.doubledutch.stroom.perf.*;

package me.doubledutch.stroom;



public abstract class Service implements Runnable{
	public static int HTTP=0;
	public static int QUERY=1;
	public static int JAVASCRIPT=2;
	public static int SAMPLE=3;

	public int type=HTTP;

	public String url=null;

	private int WAIT_TIME=1000;
	private int BATCH_SIZE=1000;
	private int BATCH_TIMEOUT=10*1000;
	public long index=-1;

	public static int ERR_IGNORE=0;
	public static int ERR_RETRY=1;
	public static int ERR_HALT=2;
	private int errorStrategy=ERR_IGNORE;
	private String lastError=null;


	private Map<String,MockStreamConnection> mockMap=new HashMap<String,MockStreamConnection>();
	private StreamHandler streamHandler=null;

	private boolean isRunning=false;
	private boolean shouldBeRunning=false;
	private Thread thread=null;
	private boolean isDisabled=false;

	private String id;

	private String script=null;

	public ScriptEngine jsEngine;
	public Invocable jsInvocable;
	private JSONObject config;

	private BatchMetric lastMetric=null;

	private Map<String,StreamConnection> streamMap=new HashMap<String,StreamConnection>();