// Path: src/com/tt/reaper/filter/FilterExecute.java
// public class FilterExecute extends Thread {
// 	private static Logger logger = Logger.getLogger(FilterExecute.class);
// 	public static final FilterExecute instance = new FilterExecute();
// 	private String command;
// 	private boolean running = false;
// 
// 	private FilterExecute() {
// 	}
// 
// 	public synchronized void init() {
// 		command = new Configuration().getCommand();
// 		if (command == null) {
// 			logger.error("Filter command not configured");
// 		}
// 		if (running == false)
// 			start();
// 		running = true;
// 	}
// 
// 	public void run() {
// 		try {
// 			logger.info("Running filter: " + command);
// 			Process p = Runtime.getRuntime().exec(command);
// 			p.waitFor();
// 			logger.warn("Filter exited with return value: " + p.exitValue());
// 		} catch (Exception e) {
// 			logger.error("Error running filter: ", e);
// 		}
// 	}
// 
// }
// 
// Path: src/com/tt/reaper/sip/CollectorStack.java
// public class CollectorStack {
// 	private static final String STACK_NAME = "CollectorStack";
// 	private static Logger logger = Logger.getLogger(CollectorStack.class);
// 	public static CollectorStack instance = new CollectorStack();
// 	private SipProvider collectorProvider;
// 	private static boolean initialized = false;
// 	public String lastSendData;
// 	
// 	private CollectorStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the collector stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperUdp = sipStack.createListeningPoint(configuration.getWriteInterface(), configuration.getWritePort(), "udp");
// 			collectorProvider = sipStack.createSipProvider(reaperUdp);
// 			collectorProvider.addSipListener(new CollectorListener());
// 			collectorProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Collector SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendResponse(ResponseMessage response) {
// 		try {
// 			ServerTransaction st = collectorProvider.getNewServerTransaction(response.getRequest());
// 			st.sendResponse(response.getResponse());
// 		}
// 		catch (Exception e) {
// 			logger.error("Error sending response: ", e);
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendMessage(String data) {
// 		lastSendData = data;
// 		try {
// 			PublishMessage publish = new PublishMessage(data);
// 			collectorProvider.sendRequest(publish.getRequest());
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error sending message: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public CallIdHeader getNewCallId() {
// 		logger.info("Get new call id: " + collectorProvider);
// 		return collectorProvider.getNewCallId();
// 	}
// }
// 
// Path: src/com/tt/reaper/sip/ReaperStack.java
// public class ReaperStack {
// 	private static final String STACK_NAME = "ReaperStack";
// 	private static Logger logger = Logger.getLogger(ReaperStack.class);
// 	public static ReaperStack instance = new ReaperStack();
// 	private SipProvider reaperProvider;
// 	private static boolean initialized = false;
// 	
// 	private ReaperStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the reaper stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperTcp = sipStack.createListeningPoint("127.0.0.1", configuration.getReadPort(), "tcp");
// 			reaperProvider = sipStack.createSipProvider(reaperTcp);
// 			reaperProvider.addSipListener(new ReaperListener());
// 			reaperProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Reaper SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// }


import com.tt.reaper.call.CallManager;
import com.tt.reaper.filter.FilterExecute;
import com.tt.reaper.http.WebServer;
import com.tt.reaper.sip.CollectorStack;
import com.tt.reaper.sip.ReaperStack;
package com.tt.reaper;


public class Reaper {
	private static boolean initialized = false;
	public static Reaper instance = new Reaper();
	
	private Reaper() {
	}

	public synchronized void init() {
		if (initialized == true)
			return;
		initialized = true;
		ReaperLogger.init();
		CollectorManager.instance.init();
		CallManager.instance.init();
		ReaperStack.instance.init();
		CollectorStack.instance.init();
// Path: src/com/tt/reaper/filter/FilterExecute.java
// public class FilterExecute extends Thread {
// 	private static Logger logger = Logger.getLogger(FilterExecute.class);
// 	public static final FilterExecute instance = new FilterExecute();
// 	private String command;
// 	private boolean running = false;
// 
// 	private FilterExecute() {
// 	}
// 
// 	public synchronized void init() {
// 		command = new Configuration().getCommand();
// 		if (command == null) {
// 			logger.error("Filter command not configured");
// 		}
// 		if (running == false)
// 			start();
// 		running = true;
// 	}
// 
// 	public void run() {
// 		try {
// 			logger.info("Running filter: " + command);
// 			Process p = Runtime.getRuntime().exec(command);
// 			p.waitFor();
// 			logger.warn("Filter exited with return value: " + p.exitValue());
// 		} catch (Exception e) {
// 			logger.error("Error running filter: ", e);
// 		}
// 	}
// 
// }
// 
// Path: src/com/tt/reaper/sip/CollectorStack.java
// public class CollectorStack {
// 	private static final String STACK_NAME = "CollectorStack";
// 	private static Logger logger = Logger.getLogger(CollectorStack.class);
// 	public static CollectorStack instance = new CollectorStack();
// 	private SipProvider collectorProvider;
// 	private static boolean initialized = false;
// 	public String lastSendData;
// 	
// 	private CollectorStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the collector stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperUdp = sipStack.createListeningPoint(configuration.getWriteInterface(), configuration.getWritePort(), "udp");
// 			collectorProvider = sipStack.createSipProvider(reaperUdp);
// 			collectorProvider.addSipListener(new CollectorListener());
// 			collectorProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Collector SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendResponse(ResponseMessage response) {
// 		try {
// 			ServerTransaction st = collectorProvider.getNewServerTransaction(response.getRequest());
// 			st.sendResponse(response.getResponse());
// 		}
// 		catch (Exception e) {
// 			logger.error("Error sending response: ", e);
// 		}
// 		return true;
// 	}
// 	
// 	public boolean sendMessage(String data) {
// 		lastSendData = data;
// 		try {
// 			PublishMessage publish = new PublishMessage(data);
// 			collectorProvider.sendRequest(publish.getRequest());
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error sending message: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// 	
// 	public CallIdHeader getNewCallId() {
// 		logger.info("Get new call id: " + collectorProvider);
// 		return collectorProvider.getNewCallId();
// 	}
// }
// 
// Path: src/com/tt/reaper/sip/ReaperStack.java
// public class ReaperStack {
// 	private static final String STACK_NAME = "ReaperStack";
// 	private static Logger logger = Logger.getLogger(ReaperStack.class);
// 	public static ReaperStack instance = new ReaperStack();
// 	private SipProvider reaperProvider;
// 	private static boolean initialized = false;
// 	
// 	private ReaperStack()
// 	{
// 	}
// 	
// 	public synchronized boolean init()
// 	{
// 		if (initialized == true)
// 			return true;
// 		initialized = true;
// 		logger.info("Starting the reaper stack...");
// 		try {
// 			SipStack sipStack;
// 			Configuration configuration;
// 			configuration = new Configuration();
// 			configuration.setStackName(STACK_NAME);
// 			SipFactory.getInstance().setPathName("gov.nist");
// 			sipStack = SipFactory.getInstance().createSipStack(configuration);
// 			RequestMessage.initFactory(SipFactory.getInstance(), configuration);
// 			ListeningPoint reaperTcp = sipStack.createListeningPoint("127.0.0.1", configuration.getReadPort(), "tcp");
// 			reaperProvider = sipStack.createSipProvider(reaperTcp);
// 			reaperProvider.addSipListener(new ReaperListener());
// 			reaperProvider.setAutomaticDialogSupportEnabled(false);
// 			logger.info("Reaper SIP stack initialized successfully");
// 		}
// 		catch (Exception e)
// 		{
// 			logger.error("Error initializing stack: ", e);
// 			return false;
// 		}
// 		return true;
// 	}
// }


// Path: src/com/tt/reaper/Reaper.java
import com.tt.reaper.call.CallManager;
import com.tt.reaper.filter.FilterExecute;
import com.tt.reaper.http.WebServer;
import com.tt.reaper.sip.CollectorStack;
import com.tt.reaper.sip.ReaperStack;

package com.tt.reaper;


public class Reaper {
	private static boolean initialized = false;
	public static Reaper instance = new Reaper();
	
	private Reaper() {
	}

	public synchronized void init() {
		if (initialized == true)
			return;
		initialized = true;
		ReaperLogger.init();
		CollectorManager.instance.init();
		CallManager.instance.init();
		ReaperStack.instance.init();
		CollectorStack.instance.init();
		FilterExecute.instance.init();